summaryrefslogtreecommitdiffstats
path: root/crypto/siphash/siphash.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-04-21 17:07:40 +0200
committerTomas Mraz <tomas@openssl.org>2022-04-27 10:05:52 +0200
commitb2015891c4edd99284a4b9ec97ee4ac61e57c310 (patch)
treed87e787d35eeee7923520c51e4050f14b61ec74d /crypto/siphash/siphash.c
parent92bab433d77e8900d148e62ceb2df2abd62571c6 (diff)
siphash: Fail finalization on uninitialized siphash context
Fixes #18140 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18142) (cherry picked from commit 650b142c2e4c1d57868bdbbe1f7f4549ee77f8eb)
Diffstat (limited to 'crypto/siphash/siphash.c')
-rw-r--r--crypto/siphash/siphash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/siphash/siphash.c b/crypto/siphash/siphash.c
index 7584255709..bb4c3925af 100644
--- a/crypto/siphash/siphash.c
+++ b/crypto/siphash/siphash.c
@@ -204,7 +204,7 @@ int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen)
uint64_t v2 = ctx->v2;
uint64_t v3 = ctx->v3;
- if (outlen != (size_t)ctx->hash_size)
+ if (ctx->crounds == 0 || outlen == 0 || outlen != (size_t)ctx->hash_size)
return 0;
switch (ctx->len) {