summaryrefslogtreecommitdiff
path: root/cipher/sha1.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-02-21 13:26:38 +0000
committerWerner Koch <wk@gnupg.org>2007-02-21 13:26:38 +0000
commit56d370e0084511d9f9d706d0bcf2e3375b46ca25 (patch)
treedb028f7ec619291d6ed5ee5929f58bf835fa4ff3 /cipher/sha1.c
parentbfb2b7eaf2808d7ba17914b91c00bfc02b4ec6c2 (diff)
downloadlibgcrypt-56d370e0084511d9f9d706d0bcf2e3375b46ca25.tar.gz
A lot of cleanups as well as minor API changes.
Ported some changes from 1.2 to here.
Diffstat (limited to 'cipher/sha1.c')
-rw-r--r--cipher/sha1.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cipher/sha1.c b/cipher/sha1.c
index 7f1e38b8..c393a570 100644
--- a/cipher/sha1.c
+++ b/cipher/sha1.c
@@ -66,7 +66,7 @@ sha1_init (void *context)
* Transform the message X which consists of 16 32-bit-words
*/
static void
-transform( SHA1_CONTEXT *hd, byte *data )
+transform ( SHA1_CONTEXT *hd, const unsigned char *data )
{
register u32 a,b,c,d,e,tm;
u32 x[16];
@@ -209,8 +209,9 @@ transform( SHA1_CONTEXT *hd, byte *data )
* of INBUF with length INLEN.
*/
static void
-sha1_write( void *context, byte *inbuf, size_t inlen)
+sha1_write( void *context, const void *inbuf_arg, size_t inlen)
{
+ const unsigned char *inbuf = inbuf_arg;
SHA1_CONTEXT *hd = context;
if( hd->count == 64 ) /* flush the buffer */
@@ -332,12 +333,12 @@ sha1_read( void *context )
* into outbuf which must have a size of 20 bytes.
*/
void
-_gcry_sha1_hash_buffer (char *outbuf, const char *buffer, size_t length)
+_gcry_sha1_hash_buffer (void *outbuf, const void *buffer, size_t length)
{
SHA1_CONTEXT hd;
sha1_init (&hd);
- sha1_write (&hd, (byte*)buffer, length);
+ sha1_write (&hd, buffer, length);
sha1_final (&hd);
memcpy (outbuf, hd.buf, 20);
}