Skip to content

Commit 978c37f

Browse files
committed
Fix ML-DSA HashML-DSA verify (ZD 21412)
Add missing hashLen validation in dilithium_verify_ctx_hash() to match the check already present in the sign path. Without this, a caller could pass a hashLen larger than WC_MAX_DIGEST_SIZE.
1 parent 5b1d2d7 commit 978c37f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎wolfcrypt/src/dilithium.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9905,6 +9905,9 @@ static int dilithium_verify_ctx_hash(dilithium_key* key, const byte* ctx,
99059905
if (key == NULL) {
99069906
ret = BAD_FUNC_ARG;
99079907
}
9908+
if ((ret == 0) && (hashLen > WC_MAX_DIGEST_SIZE)) {
9909+
ret = BUFFER_E;
9910+
}
99089911

99099912
if (ret == 0) {
99109913
/* Step 6: Hash public key. */

0 commit comments

Comments
 (0)