summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-07-17 05:57:37 +0000
committermillert <millert@openbsd.org>1997-07-17 05:57:37 +0000
commite8559f79e7f291eaac2588eb2c59f073a13186f0 (patch)
tree59338da169eb8966f7edb269ebb63a0a12a697c9 /lib
parentAdd RIPEMD-160 (rmd160) support to OTP (s/key). (diff)
downloadwireguard-openbsd-e8559f79e7f291eaac2588eb2c59f073a13186f0.tar.xz
wireguard-openbsd-e8559f79e7f291eaac2588eb2c59f073a13186f0.zip
Allow passing of a NULL digest to RMD160Final(3).
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/hash/rmd160.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/hash/rmd160.c b/lib/libc/hash/rmd160.c
index 92874ab8b6e..95b65ed68f6 100644
--- a/lib/libc/hash/rmd160.c
+++ b/lib/libc/hash/rmd160.c
@@ -371,12 +371,14 @@ void RMD160Final(digest, context)
(context->length[1] << 3);
RMD160Transform(context->state, context->buffer);
- for (i = 0; i < 20; i += 4) {
- /* extracts the 8 least significant bits. */
- digest[i] = context->state[i>>2];
- digest[i + 1] = (context->state[i>>2] >> 8);
- digest[i + 2] = (context->state[i>>2] >> 16);
- digest[i + 3] = (context->state[i>>2] >> 24);
+ if (digest != NULL) {
+ for (i = 0; i < 20; i += 4) {
+ /* extracts the 8 least significant bits. */
+ digest[i] = context->state[i>>2];
+ digest[i + 1] = (context->state[i>>2] >> 8);
+ digest[i + 2] = (context->state[i>>2] >> 16);
+ digest[i + 3] = (context->state[i>>2] >> 24);
+ }
}
}