Skip to content

Commit

Permalink
Use libctx when generating DH parameters
Browse files Browse the repository at this point in the history
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #19635)
  • Loading branch information
t8m committed Nov 11, 2022
1 parent 8aa82b3 commit 990d280
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/dh/dh_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
return 0;
}

ctx = BN_CTX_new();
ctx = BN_CTX_new_ex(ret->libctx);
if (ctx == NULL)
goto err;
BN_CTX_start(ctx);
Expand Down Expand Up @@ -214,7 +214,7 @@ static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
g = generator;
}

if (!BN_generate_prime_ex(ret->params.p, prime_len, 1, t1, t2, cb))
if (!BN_generate_prime_ex2(ret->params.p, prime_len, 1, t1, t2, cb, ctx))
goto err;
if (!BN_GENCB_call(cb, 3, 0))
goto err;
Expand Down

0 comments on commit 990d280

Please sign in to comment.