summaryrefslogtreecommitdiff
path: root/cipher/rmd160.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-07-09 13:37:05 +0000
committerWerner Koch <wk@gnupg.org>1998-07-09 13:37:05 +0000
commit82a03a214a2ddc00a68a215158fbbad86e85678c (patch)
tree6a022c025c8f21ab75821397da7308f5513e30f0 /cipher/rmd160.c
parent1bb8ca57ffc47f1d0194497eeab2089f94cf5c6d (diff)
downloadlibgcrypt-82a03a214a2ddc00a68a215158fbbad86e85678c.tar.gz
fixed severe exploit
Diffstat (limited to 'cipher/rmd160.c')
-rw-r--r--cipher/rmd160.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/cipher/rmd160.c b/cipher/rmd160.c
index e3817249..3b1702cb 100644
--- a/cipher/rmd160.c
+++ b/cipher/rmd160.c
@@ -26,7 +26,7 @@
#include "util.h"
#include "memory.h"
#include "rmd.h"
-
+#include "cipher.h" /* only used for the rmd160_hash_buffer() prototype */
/*********************************
* RIPEMD-160 is not patented, see (as of 25.10.97)
@@ -530,6 +530,24 @@ rmd160_read( RMD160_CONTEXT *hd )
return hd->buf;
}
+
+
+/****************
+ * Shortcut functions which puts the hash value of the supplied buffer
+ * into outbuf which must have a size of 20 bytes.
+ */
+void
+rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length )
+{
+ RMD160_CONTEXT hd;
+
+ rmd160_init( &hd );
+ rmd160_write( &hd, (byte*)buffer, length );
+ rmd160_final( &hd );
+ memcpy( outbuf, hd.buf, 20 );
+}
+
+
/****************
* Return some information about the algorithm. We need algo here to
* distinguish different flavors of the algorithm.