diff options
author | jsing <> | 2023-04-15 19:27:54 +0000 |
---|---|---|
committer | jsing <> | 2023-04-15 19:27:54 +0000 |
commit | a866975c1f7d904a6cab7d3f16fe3af292d7cf1a (patch) | |
tree | c762576167c168ce48df760ae381df547556826f /src | |
parent | 0dee22a3582ea2bb10215653602f36c1bc62182b (diff) | |
download | openbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.tar.gz openbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.tar.bz2 openbsd-a866975c1f7d904a6cab7d3f16fe3af292d7cf1a.zip |
Use memset() to zero the context, instead of zeroing manually.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/sha/sha3.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c index 7b70d90c87..d246d53ce4 100644 --- a/src/lib/libcrypto/sha/sha3.c +++ b/src/lib/libcrypto/sha/sha3.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha3.c,v 1.10 2023/04/15 19:15:53 jsing Exp $ */ | 1 | /* $OpenBSD: sha3.c,v 1.11 2023/04/15 19:27:54 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
4 | * | 4 | * |
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <endian.h> | 26 | #include <endian.h> |
27 | #include <string.h> | ||
27 | 28 | ||
28 | #include "sha3_internal.h" | 29 | #include "sha3_internal.h" |
29 | 30 | ||
@@ -120,13 +121,10 @@ sha3_keccakf(uint64_t st[25]) | |||
120 | int | 121 | int |
121 | sha3_init(sha3_ctx *c, int mdlen) | 122 | sha3_init(sha3_ctx *c, int mdlen) |
122 | { | 123 | { |
123 | int i; | 124 | memset(c, 0, sizeof(*c)); |
124 | 125 | ||
125 | for (i = 0; i < 25; i++) | ||
126 | c->state.q[i] = 0; | ||
127 | c->mdlen = mdlen; | 126 | c->mdlen = mdlen; |
128 | c->rsiz = 200 - 2 * mdlen; | 127 | c->rsiz = 200 - 2 * mdlen; |
129 | c->pt = 0; | ||
130 | 128 | ||
131 | return 1; | 129 | return 1; |
132 | } | 130 | } |