diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1997-07-03 23:30:23 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1997-07-03 23:30:23 +0000 |
commit | 4520ec7779303ac6aaa5d5991df942598cfcd0e6 (patch) | |
tree | 53b334dc410d17caa30395907b90eec83796c552 /lib/libc/md/md4c.c | |
parent | 2473def0a00b8475801f6c70fb3692639f321f02 (diff) |
MD[45]Final(NULL,&ctx) applies padding to context and can still be used with M[45]Update afterwards.
Diffstat (limited to 'lib/libc/md/md4c.c')
-rw-r--r-- | lib/libc/md/md4c.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libc/md/md4c.c b/lib/libc/md/md4c.c index f85d41cc6c3..c1af994a56d 100644 --- a/lib/libc/md/md4c.c +++ b/lib/libc/md/md4c.c @@ -22,7 +22,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: md4c.c,v 1.9 1997/04/30 05:56:05 tholo Exp $"; +static char rcsid[] = "$OpenBSD: md4c.c,v 1.10 1997/07/03 23:30:20 provos Exp $"; #endif /* LIBC_SCCS and not lint */ #include <string.h> @@ -205,12 +205,15 @@ MD4_CTX *context; /* context */ /* Append length (before padding) */ MD4Update (context, bits, 8); - /* Store state in digest */ - Encode (digest, context->state, 16); - /* Zeroize sensitive information. - */ - memset ((POINTER)context, 0, sizeof (*context)); + if (digest != NULL) { + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset ((POINTER)context, 0, sizeof (*context)); + } } /* MD4 basic transformation. Transforms state based on block. |