Skip to content

Commit

Permalink
check the return value of BN_dup() in rsa_lib.c:1248
Browse files Browse the repository at this point in the history
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#17168)
  • Loading branch information
x2018 authored and t8m committed Dec 2, 2021
1 parent 07ba694 commit 9d1a270
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crypto/rsa/rsa_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,8 +1244,11 @@ int EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp)
* When we're dealing with a provider, there's no need to duplicate
* pubexp, as it gets copied when transforming to an OSSL_PARAM anyway.
*/
if (evp_pkey_ctx_is_legacy(ctx))
if (evp_pkey_ctx_is_legacy(ctx)) {
pubexp = BN_dup(pubexp);
if (pubexp == NULL)
return 0;
}
ret = EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN,
EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp);
if (evp_pkey_ctx_is_legacy(ctx) && ret <= 0)
Expand Down

0 comments on commit 9d1a270

Please sign in to comment.