Skip to content

Commit

Permalink
Remove hash type check not required for ECDSA deterministic k. Fix `_…
Browse files Browse the repository at this point in the history
…HMAC_K` devId.
  • Loading branch information
dgarske committed Jul 4, 2024
1 parent 4335dac commit f91d0a2
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions wolfcrypt/src/ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f91d0a2

Please sign in to comment.