From f91d0a2925145e7754eb398ce47514f47b7e5be4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 4 Jul 2024 14:49:20 -0700 Subject: [PATCH] Remove hash type check not required for ECDSA deterministic k. Fix `_HMAC_K` devId. --- wolfcrypt/src/ecc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index b4e8913349..4bf97bd095 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -7482,7 +7482,7 @@ static int _HMAC_K(byte* K, word32 KSz, byte* V, word32 VSz, Hmac hmac; int ret, init; - ret = init = wc_HmacInit(&hmac, heap, 0); + ret = init = wc_HmacInit(&hmac, heap, INVALID_DEVID); if (ret == 0) ret = wc_HmacSetKey(&hmac, hashType, K, KSz); @@ -7561,14 +7561,6 @@ int wc_ecc_gen_deterministic_k(const byte* hash, word32 hashSz, } } - /* For deterministic k only SHA2-256, SHA2-384 and SHA2-512 are supported */ - if ( hashType != WC_HASH_TYPE_SHA256 && - hashType != WC_HASH_TYPE_SHA384 && - hashType != WC_HASH_TYPE_SHA512) { - WOLFSSL_MSG("Invalid deterministic hash type"); - return BAD_FUNC_ARG; - } - if (mp_unsigned_bin_size(priv) > MAX_ECC_BYTES) { WOLFSSL_MSG("private key larger than max expected!"); return BAD_FUNC_ARG;