diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-13 14:57:01 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-13 14:57:01 +0000 |
commit | 742e16533d2cd78c0a4871d24a48e909153279b2 (patch) | |
tree | 1d449d09e0c5297889517b307a502f0d82520544 /lib | |
parent | 22200c01b1fc1182561e6c58c407e54928093dfa (diff) |
Move DH_generate_parameters() from dh_depr.c to dh_gen.c
discussed with jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/dh/dh_depr.c | 20 | ||||
-rw-r--r-- | lib/libcrypto/dh/dh_gen.c | 21 |
2 files changed, 21 insertions, 20 deletions
diff --git a/lib/libcrypto/dh/dh_depr.c b/lib/libcrypto/dh/dh_depr.c index b8a3dd2ff7e..0bb02b5a952 100644 --- a/lib/libcrypto/dh/dh_depr.c +++ b/lib/libcrypto/dh/dh_depr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_depr.c,v 1.9 2023/04/09 19:10:23 tb Exp $ */ +/* $OpenBSD: dh_depr.c,v 1.10 2023/04/13 14:57:00 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. * @@ -63,21 +63,3 @@ #include <openssl/dh.h> #include "bn_local.h" - -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; -} diff --git a/lib/libcrypto/dh/dh_gen.c b/lib/libcrypto/dh/dh_gen.c index 6b49a2875a0..b331b32dd14 100644 --- a/lib/libcrypto/dh/dh_gen.c +++ b/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 <openssl/dh.h> #include <openssl/err.h> +#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; +} |