diff options
-rw-r--r-- | src/lib/libcrypto/sha/sha3.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libcrypto/sha/sha3.c b/src/lib/libcrypto/sha/sha3.c index d406241f8a..b070d715ca 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.14 2023/04/15 20:00:24 jsing Exp $ */ | 1 | /* $OpenBSD: sha3.c,v 1.15 2023/04/16 15:32:16 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * The MIT License (MIT) | 3 | * The MIT License (MIT) |
4 | * | 4 | * |
@@ -121,10 +121,13 @@ sha3_keccakf(uint64_t st[25]) | |||
121 | int | 121 | int |
122 | sha3_init(sha3_ctx *c, int mdlen) | 122 | sha3_init(sha3_ctx *c, int mdlen) |
123 | { | 123 | { |
124 | if (mdlen < 0 || mdlen >= KECCAK_BYTE_WIDTH / 2) | ||
125 | return 0; | ||
126 | |||
124 | memset(c, 0, sizeof(*c)); | 127 | memset(c, 0, sizeof(*c)); |
125 | 128 | ||
126 | c->mdlen = mdlen; | 129 | c->mdlen = mdlen; |
127 | c->rsize = 200 - 2 * mdlen; | 130 | c->rsize = KECCAK_BYTE_WIDTH - 2 * mdlen; |
128 | 131 | ||
129 | return 1; | 132 | return 1; |
130 | } | 133 | } |