diff options
author | 1997-06-20 20:11:30 +0000 | |
---|---|---|
committer | 1997-06-20 20:11:30 +0000 | |
commit | cf3167a9e367bfba022dfdb1768a895237d9e1ed (patch) | |
tree | 231d7e872898adff9ce1ddac3ff34b088fce666a | |
parent | 3des ede (diff) | |
download | wireguard-openbsd-cf3167a9e367bfba022dfdb1768a895237d9e1ed.tar.xz wireguard-openbsd-cf3167a9e367bfba022dfdb1768a895237d9e1ed.zip |
make SHA1Final(NULL, &ctx) behave as MD5Final, only update context
-rw-r--r-- | sys/netinet/ip_sha1.c | 12 |
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; |