Remove hash type check not required for ECDSA deterministic k. Fix _HMAC_K devId.

This commit is contained in:
David Garske
2024-07-04 14:49:20 -07:00
parent 4335dac794
commit f91d0a2925

View File

@ -7482,7 +7482,7 @@ static int _HMAC_K(byte* K, word32 KSz, byte* V, word32 VSz,
Hmac hmac; Hmac hmac;
int ret, init; int ret, init;
ret = init = wc_HmacInit(&hmac, heap, 0); ret = init = wc_HmacInit(&hmac, heap, INVALID_DEVID);
if (ret == 0) if (ret == 0)
ret = wc_HmacSetKey(&hmac, hashType, K, KSz); 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) { if (mp_unsigned_bin_size(priv) > MAX_ECC_BYTES) {
WOLFSSL_MSG("private key larger than max expected!"); WOLFSSL_MSG("private key larger than max expected!");
return BAD_FUNC_ARG; return BAD_FUNC_ARG;