diff options
author | phk <phk@FreeBSD.org> | 1998-03-27 10:23:00 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1998-03-27 10:23:00 +0000 |
commit | 4db0fa09db895f439a5a91029e7625e329fda730 (patch) | |
tree | 7280db4f963d90af6e88e2567a99dd70e34b3f35 /sys/kern/md5c.c | |
parent | 1eaa978a478cdf6768e93ba276482ac8140c290d (diff) | |
download | FreeBSD-src-4db0fa09db895f439a5a91029e7625e329fda730.zip FreeBSD-src-4db0fa09db895f439a5a91029e7625e329fda730.tar.gz |
Split the padding out into a separate function.
Synchronize the kernel and libmd versions of md5c.c
PR: misc/6127
Reviewed by: phk
Submitted by: Ari Suutari <ari@suutari.iki.fi>
Diffstat (limited to 'sys/kern/md5c.c')
-rw-r--r-- | sys/kern/md5c.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/kern/md5c.c b/sys/kern/md5c.c index 606e3c8..c1fdc6d 100644 --- a/sys/kern/md5c.c +++ b/sys/kern/md5c.c @@ -22,7 +22,7 @@ * These notices must be retained in any copies of any part of this * documentation and/or software. * - * $Id: md5c.c,v 1.9 1997/08/02 14:31:35 bde Exp $ + * $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. @@ -191,13 +191,11 @@ MD5Update (context, input, inputLen) } /* - * 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]; @@ -213,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); |