diff options
author | Werner Koch <wk@gnupg.org> | 2000-03-13 18:19:12 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2000-03-13 18:19:12 +0000 |
commit | 3d60fba196552fb4bb5f30bd80214c9d31759d11 (patch) | |
tree | 64e3e0fbd2a157f3d371395474354db600fb89db /cipher | |
parent | d201740fc1c0c042b422a0e1b436e5238cfcfcf5 (diff) | |
download | libgcrypt-3d60fba196552fb4bb5f30bd80214c9d31759d11.tar.gz |
See ChangeLog: Mon Mar 13 19:22:46 CET 2000 Werner Koch
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/ChangeLog | 4 | ||||
-rw-r--r-- | cipher/md.c | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog index c0657d72..a8118970 100644 --- a/cipher/ChangeLog +++ b/cipher/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 13 19:22:46 CET 2000 Werner Koch <wk@openit.de> + + * md.c (gcry_md_hash_buffer): Add support for the other algorithms. + Mon Jan 31 16:37:34 CET 2000 Werner Koch <wk@gnupg.de> * genprime.c (generate_elg_prime): Fixed returned factors which never diff --git a/cipher/md.c b/cipher/md.c index bc0a6c30..680558db 100644 --- a/cipher/md.c +++ b/cipher/md.c @@ -596,15 +596,22 @@ gcry_md_get( GCRY_MD_HD hd, int algo, byte *buffer, int buflen ) * Shortcut function to hash a buffer with a given algo. The only supported * algorithm is RIPE-MD. The supplied digest buffer must be large enough * to store the resulting hash. No error is returned, the function will - * abort on an invalite algo. DISABLED_ALGOS are ignored here. + * abort on an invalid algo. DISABLED_ALGOS are ignored here. */ void gcry_md_hash_buffer( int algo, char *digest, const char *buffer, size_t length) { if( algo == GCRY_MD_RMD160 ) rmd160_hash_buffer( digest, buffer, length ); - else - BUG(); + else { /* for the others we do not have a fast function, so + * we use the normal functions to do it */ + GCRY_MD_HD h = md_open( algo, 0 ); + if( !h ) + BUG(); /* algo not available */ + md_write( h, (byte*)buffer, length ); + md_final( h ); + memcpy( digest, md_read( h, algo ), md_digest_length( algo ) ); + } } static int |