summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1997-06-20 20:11:31 +0000
committerNiels Provos <provos@cvs.openbsd.org>1997-06-20 20:11:31 +0000
commit19965f1c8e763d99a15f99101f969ba3cffe3804 (patch)
tree9483939c128a48a01c835aaf6555276c5077ff6f /sys
parenteae0c37b704b3da1a1ebc7191d156a6592a5997d (diff)
make SHA1Final(NULL, &ctx) behave as MD5Final, only update context
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_sha1.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet/ip_sha1.c b/sys/netinet/ip_sha1.c
index e05d643d0a2..c9cfafbf703 100644
--- a/sys/netinet/ip_sha1.c
+++ b/sys/netinet/ip_sha1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_sha1.c,v 1.4 1997/06/20 05:41:54 provos Exp $ */
+/* $OpenBSD: ip_sha1.c,v 1.5 1997/06/20 20:11:30 provos Exp $ */
/*
SHA-1 in C
@@ -153,10 +153,12 @@ unsigned char finalcount[8];
SHA1Update(context, (unsigned char *)"\0", 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
- for (i = 0; i < 20; i++) {
- digest[i] = (unsigned char)
- ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
- }
+
+ if (digest)
+ for (i = 0; i < 20; i++) {
+ digest[i] = (unsigned char)
+ ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
+ }
#if 0 /* We want to use this for "keyfill" */
/* Wipe variables */
i = 0;