summaryrefslogtreecommitdiff
path: root/lib/libc/hash/sha1.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-05-28 15:10:28 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-05-28 15:10:28 +0000
commit17d2c85d9d3efc20e6eff3b12f905ed70ba24983 (patch)
tree99becf88119a703a8b275748133ee7fcde045163 /lib/libc/hash/sha1.c
parentc2888a975d59102b19a3bfe63b7e9ac0f50fe419 (diff)
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.
Diffstat (limited to 'lib/libc/hash/sha1.c')
-rw-r--r--lib/libc/hash/sha1.c6
1 files changed, 3 insertions, 3 deletions
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 <sys/param.h>
@@ -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));
}