diff options
author | Matt Caswell <matt@openssl.org> | 2014-10-30 23:58:19 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2014-12-08 21:40:32 +0000 |
commit | 829ccf6ab6aab03a3f60f644027b43a5d2035bf8 (patch) | |
tree | 69acbd4f87f729876a1ffc069ff89d983dab5dad /crypto/dh/dh_pmeth.c | |
parent | 76b2a0227433af6c100aadf9a3df78ea4d52803a (diff) |
Implement internally opaque bn access from dh
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/dh/dh_pmeth.c')
-rw-r--r-- | crypto/dh/dh_pmeth.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 941801df46..85e743bfe1 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -363,7 +363,7 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { DH *dh = NULL; DH_PKEY_CTX *dctx = ctx->data; - BN_GENCB *pcb, cb; + BN_GENCB *pcb; int ret; if (dctx->rfc5114_param) { @@ -390,7 +390,7 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) if (ctx->pkey_gencb) { - pcb = &cb; + pcb = BN_GENCB_new(); evp_pkey_set_cb_translate(pcb, ctx); } else @@ -400,6 +400,7 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { DSA *dsa_dh; dsa_dh = dsa_dh_generate(dctx, pcb); + if(pcb) BN_GENCB_free(pcb); if (!dsa_dh) return 0; dh = DSA_dup_DH(dsa_dh); @@ -412,10 +413,13 @@ static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) #endif dh = DH_new(); if (!dh) + { + if(pcb) BN_GENCB_free(pcb); return 0; + } ret = DH_generate_parameters_ex(dh, dctx->prime_len, dctx->generator, pcb); - + if(pcb) BN_GENCB_free(pcb); if (ret) EVP_PKEY_assign_DH(pkey, dh); else |