diff options
author | Werner Koch <wk@gnupg.org> | 2016-03-31 20:16:10 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-03-31 20:33:14 +0200 |
commit | fcce0cb6e8af70b134c6ecc3f56afa07a7d31f27 (patch) | |
tree | d118da298ec720b4a5856f82ce20a7e14b9f0771 /cipher/rmd160.c | |
parent | a9cbe2d1f6a517a831517da8bc1d29e3e0b2c0c0 (diff) | |
download | libgcrypt-fcce0cb6e8af70b134c6ecc3f56afa07a7d31f27.tar.gz |
cipher: Remove specialized rmd160 functions.
* cipher/rmd160.c: Replace rmd.h by hash-common.h.
(RMD160_CONTEXT): Move from rmd.h to here.
(_gcry_rmd160_init): Remove.
(_gcry_rmd160_mixblock): Remove.
(_gcry_rmd160_hash_buffer): Use rmd160_init directly.
* cipher/md.c: Remove rmd.h which was not actually used.
* cipher/rmd.h: Remove.
* cipher/Makefile.am (libcipher_la_SOURCES): Remove rmd.h.
* configure.ac (USE_RMD160): Allow to build without RMD160.
--
Those functions are not anymore required because random-csprng.c now
uses SHA-1.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/rmd160.c')
-rw-r--r-- | cipher/rmd160.c | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/cipher/rmd160.c b/cipher/rmd160.c index cf7531e5..0a019b9c 100644 --- a/cipher/rmd160.c +++ b/cipher/rmd160.c @@ -24,7 +24,7 @@ #include <string.h> #include "g10lib.h" -#include "rmd.h" +#include "hash-common.h" #include "cipher.h" /* Only used for the rmd160_hash_buffer() prototype. */ #include "bithelp.h" @@ -140,6 +140,13 @@ * 1 million times "a" 52783243c1697bdbe16d37f97f68f08325dc1528 */ +typedef struct +{ + gcry_md_block_ctx_t bctx; + u32 h0,h1,h2,h3,h4; +} RMD160_CONTEXT; + + static unsigned int transform ( void *ctx, const unsigned char *data, size_t nblks ); @@ -164,13 +171,6 @@ rmd160_init (void *context, unsigned int flags) } -void -_gcry_rmd160_init (void *context) -{ - rmd160_init (context, 0); -} - - /**************** * Transform the message X which consists of 16 32-bit-words */ @@ -399,32 +399,9 @@ transform ( void *c, const unsigned char *data, size_t nblks ) } -/**************** - * Apply the rmd160 transform function on the buffer which must have - * a length 64 bytes. Do not use this function together with the - * other functions, use rmd160_init to initialize internal variables. - * Buffer must be 32-bit aligned. - * Returns: 20 bytes in buffer with the mixed contents of buffer. +/* + * The routine terminates the computation */ -void -_gcry_rmd160_mixblock ( RMD160_CONTEXT *hd, void *blockof64byte ) -{ - u32 *p = blockof64byte; - - transform ( hd, blockof64byte, 1 ); -#define X(a) do { p[a] = hd->h##a; } while(0) - X(0); - X(1); - X(2); - X(3); - X(4); -#undef X -} - - -/* The routine terminates the computation - */ - static void rmd160_final( void *context ) { @@ -503,7 +480,7 @@ _gcry_rmd160_hash_buffer (void *outbuf, const void *buffer, size_t length ) { RMD160_CONTEXT hd; - _gcry_rmd160_init ( &hd ); + rmd160_init (&hd, 0); _gcry_md_block_write ( &hd, buffer, length ); rmd160_final ( &hd ); memcpy ( outbuf, hd.bctx.buf, 20 ); |