diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2015-01-15 13:06:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2015-01-15 13:06:00 +0000 |
commit | 982b97b5bd3344bf8ab9f25588df649cf052eb85 (patch) | |
tree | ea00488fec2231bb5aa530f64c4b9d2e4f76543f /lib/libc/hash/sha2.c | |
parent | 353fcd36fc6d76d190995196ec7069ab62fa3d00 (diff) |
Use explicit_bzero instead of memset in hash Final and End functions.
OK deraadt@ djm@
Diffstat (limited to 'lib/libc/hash/sha2.c')
-rw-r--r-- | lib/libc/hash/sha2.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/hash/sha2.c b/lib/libc/hash/sha2.c index 23b41841767..4842e429670 100644 --- a/lib/libc/hash/sha2.c +++ b/lib/libc/hash/sha2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha2.c,v 1.22 2014/12/19 15:14:04 tedu Exp $ */ +/* $OpenBSD: sha2.c,v 1.23 2015/01/15 13:05:59 millert Exp $ */ /* * FILE: sha2.c @@ -316,7 +316,7 @@ SHA224Final(u_int8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *context) #else memcpy(digest, context->state.st32, SHA224_DIGEST_LENGTH); #endif - memset(context, 0, sizeof(*context)); + explicit_bzero(context, sizeof(*context)); } #endif /* !defined(SHA2_SMALL) */ @@ -591,7 +591,7 @@ SHA256Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *context) #else memcpy(digest, context->state.st32, SHA256_DIGEST_LENGTH); #endif - memset(context, 0, sizeof(*context)); + explicit_bzero(context, sizeof(*context)); } @@ -867,7 +867,7 @@ SHA512Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *context) #else memcpy(digest, context->state.st64, SHA512_DIGEST_LENGTH); #endif - memset(context, 0, sizeof(*context)); + explicit_bzero(context, sizeof(*context)); } #if !defined(SHA2_SMALL) @@ -901,6 +901,6 @@ SHA384Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *context) memcpy(digest, context->state.st64, SHA384_DIGEST_LENGTH); #endif /* Zero out state data */ - memset(context, 0, sizeof(*context)); + explicit_bzero(context, sizeof(*context)); } #endif /* !defined(SHA2_SMALL) */ |