diff options
Diffstat (limited to 'lib/libmd/md5c.c')
-rw-r--r-- | lib/libmd/md5c.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/libmd/md5c.c b/lib/libmd/md5c.c index 583d009..c1fdc6d 100644 --- a/lib/libmd/md5c.c +++ b/lib/libmd/md5c.c @@ -22,7 +22,7 @@ * These notices must be retained in any copies of any part of this * documentation and/or software. * - * $Id$ + * $Id: md5c.c,v 1.10 1997/10/21 13:28:36 phk Exp $ * * This code is the same as the code published by RSA Inc. It has been * edited for clarity and style only. @@ -31,7 +31,6 @@ #include <sys/types.h> #ifdef KERNEL -#include <sys/param.h> #include <sys/systm.h> #else #include <string.h> @@ -174,7 +173,7 @@ MD5Update (context, input, inputLen) /* Transform as many times as possible. */ if (inputLen >= partLen) { - memcpy((void *)&context->buffer[index], (void *)input, + memcpy((void *)&context->buffer[index], (const void *)input, partLen); MD5Transform (context->state, context->buffer); @@ -187,18 +186,16 @@ MD5Update (context, input, inputLen) i = 0; /* Buffer remaining input */ - memcpy ((void *)&context->buffer[index], (void *)&input[i], + memcpy ((void *)&context->buffer[index], (const void *)&input[i], inputLen-i); } /* - * MD5 finalization. Ends an MD5 message-digest operation, writing the - * the message digest and zeroizing the context. + * MD5 padding. Adds padding followed by original length. */ void -MD5Final (digest, context) - unsigned char digest[16]; +MD5Pad (context) MD5_CTX *context; { unsigned char bits[8]; @@ -214,6 +211,20 @@ MD5Final (digest, context) /* Append length (before padding) */ MD5Update (context, bits, 8); +} + +/* + * MD5 finalization. Ends an MD5 message-digest operation, writing the + * the message digest and zeroizing the context. + */ + +void +MD5Final (digest, context) + unsigned char digest[16]; + MD5_CTX *context; +{ + /* Do padding. */ + MD5Pad (context); /* Store state in digest */ Encode (digest, context->state, 16); |