Skip to content

Commit

Permalink
Merge pull request #6580 from dgarske/sig_verify
Browse files Browse the repository at this point in the history
Fix for `wc_SignatureGenerate_ex` calling verify twice
  • Loading branch information
SparkiDev committed Jul 6, 2023
2 parents fb0c769 + 9ca53ac commit f3bae31
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions wolfcrypt/src/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,17 +525,12 @@ int wc_SignatureGenerate_ex(
#endif
}
if (ret == 0) {
/* Generate signature using hash */
ret = wc_SignatureGenerateHash(hash_type, sig_type,
hash_data, hash_enc_len, sig, sig_len, key, key_len, rng);
/* Generate signature using hash (also handles verify) */
ret = wc_SignatureGenerateHash_ex(hash_type, sig_type, hash_data,
hash_enc_len, sig, sig_len, key, key_len, rng, verify);
}
}

if (ret == 0 && verify) {
ret = wc_SignatureVerifyHash(hash_type, sig_type, hash_data,
hash_enc_len, sig, *sig_len, key, key_len);
}

#if defined(WOLFSSL_SMALL_STACK) || defined(NO_ASN)
XFREE(hash_data, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
Expand Down

0 comments on commit f3bae31

Please sign in to comment.