From 17d2c85d9d3efc20e6eff3b12f905ed70ba24983 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 28 May 2004 15:10:28 +0000 Subject: In the Final function, move the context zeroing into the digest != NULL scope so that passing a NULL digest is equivalent to the Pad function (like it used to be). Fixes skey w/ sha1 as noticed by David Krause. --- lib/libc/hash/sha1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libc/hash/sha1.c') diff --git a/lib/libc/hash/sha1.c b/lib/libc/hash/sha1.c index bb901ff4df7..968c2b322f8 100644 --- a/lib/libc/hash/sha1.c +++ b/lib/libc/hash/sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.c,v 1.18 2004/05/05 17:09:46 millert Exp $ */ +/* $OpenBSD: sha1.c,v 1.19 2004/05/28 15:10:27 millert Exp $ */ /* * SHA-1 in C @@ -15,7 +15,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: sha1.c,v 1.18 2004/05/05 17:09:46 millert Exp $"; +static const char rcsid[] = "$OpenBSD: sha1.c,v 1.19 2004/05/28 15:10:27 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -173,6 +173,6 @@ SHA1Final(u_int8_t digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context) digest[i] = (u_int8_t) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } + memset(context, 0, sizeof(*context)); } - memset(context, 0, sizeof(*context)); } -- cgit v1.2.3