Skip to content

Commit

Permalink
Hash Type selection changes to ecc.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan garske committed Jul 16, 2024
1 parent f91d0a2 commit 96af77d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions wolfcrypt/src/ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7536,8 +7536,9 @@ int wc_ecc_gen_deterministic_k(const byte* hash, word32 hashSz,
byte *x = NULL;
mp_int *z1 = NULL;
#endif
word32 qbits = 0, xSz, VSz, KSz, h1len, qLen;
word32 xSz, VSz, KSz, h1len, qLen;
byte intOct;
word32 qbits = 0;

if (hash == NULL || k == NULL || order == NULL) {
return BAD_FUNC_ARG;
Expand All @@ -7550,15 +7551,18 @@ int wc_ecc_gen_deterministic_k(const byte* hash, word32 hashSz,

/* if none is provided then detect has type based on hash size */
if (hashType == WC_HASH_TYPE_NONE) {
if (hashSz >= 64) {
if (hashSz == 64) {
hashType = WC_HASH_TYPE_SHA512;
}
else if (hashSz >= 48) {
else if (hashSz == 48) {
hashType = WC_HASH_TYPE_SHA384;
}
else {
else if (hashSz ==32) {
hashType = WC_HASH_TYPE_SHA256;
}
else {
return BAD_FUNC_ARG;
}
}

if (mp_unsigned_bin_size(priv) > MAX_ECC_BYTES) {
Expand Down

0 comments on commit 96af77d

Please sign in to comment.