diff --git a/wolfcrypt/src/signature.c b/wolfcrypt/src/signature.c index f9c71926be..efcbd88782 100644 --- a/wolfcrypt/src/signature.c +++ b/wolfcrypt/src/signature.c @@ -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