From 12f90f16f2ff4d8099a1b84bd50ecea1111e9486 Mon Sep 17 00:00:00 2001 From: tb <> Date: Thu, 13 Apr 2023 14:57:00 +0000 Subject: Move DH_generate_parameters() from dh_depr.c to dh_gen.c discussed with jsing --- src/lib/libcrypto/dh/dh_gen.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/dh/dh_gen.c') diff --git a/src/lib/libcrypto/dh/dh_gen.c b/src/lib/libcrypto/dh/dh_gen.c index 6b49a2875a..b331b32dd1 100644 --- a/src/lib/libcrypto/dh/dh_gen.c +++ b/src/lib/libcrypto/dh/dh_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_gen.c,v 1.17 2022/01/07 09:27:13 tb Exp $ */ +/* $OpenBSD: dh_gen.c,v 1.18 2023/04/13 14:57:00 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -67,6 +67,7 @@ #include #include +#include "bn_local.h" #include "dh_local.h" static int dh_builtin_genparams(DH *ret, int prime_len, int generator, @@ -179,3 +180,21 @@ err: } return ok; } + +DH * +DH_generate_parameters(int prime_len, int generator, + void (*callback)(int, int, void *), void *cb_arg) +{ + BN_GENCB cb; + DH *ret = NULL; + + if ((ret = DH_new()) == NULL) + return NULL; + + BN_GENCB_set_old(&cb, callback, cb_arg); + + if (DH_generate_parameters_ex(ret, prime_len, generator, &cb)) + return ret; + DH_free(ret); + return NULL; +} -- cgit v1.2.3-55-g6feb