diff options
author | Matt Caswell <matt@openssl.org> | 2014-10-28 23:00:29 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-12-08 21:40:57 +0000 |
commit | 18125f7f554034d95c64851bee23fb058a23bfd9 (patch) | |
tree | 2079d890f829b34910893d9c96a1f96670a5a3fe /crypto/rsa/rsa_pmeth.c | |
parent | 68c29f61a404db3d620278878d77ca90ad853b8d (diff) |
Implement internally opaque bn access from rsa
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/rsa/rsa_pmeth.c')
-rw-r--r-- | crypto/rsa/rsa_pmeth.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 651127846e..868be91c6c 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -716,7 +716,7 @@ static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { RSA *rsa = NULL; RSA_PKEY_CTX *rctx = ctx->data; - BN_GENCB *pcb, cb; + BN_GENCB *pcb; int ret; if (!rctx->pub_exp) { @@ -729,12 +729,18 @@ static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) return 0; if (ctx->pkey_gencb) { - pcb = &cb; + pcb = BN_GENCB_new(); + if(!pcb) + { + RSA_free(rsa); + return 0; + } evp_pkey_set_cb_translate(pcb, ctx); } else pcb = NULL; ret = RSA_generate_key_ex(rsa, rctx->nbits, rctx->pub_exp, pcb); + BN_GENCB_free(pcb); if (ret > 0) EVP_PKEY_assign_RSA(pkey, rsa); else |