summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-04-13 14:57:00 +0000
committertb <>2023-04-13 14:57:00 +0000
commit12f90f16f2ff4d8099a1b84bd50ecea1111e9486 (patch)
tree902934979ef0662dc7a5390885ec867617bc431b
parentd6c1827d02417863e7ba297ae8064ef4ffeb4597 (diff)
downloadopenbsd-12f90f16f2ff4d8099a1b84bd50ecea1111e9486.tar.gz
openbsd-12f90f16f2ff4d8099a1b84bd50ecea1111e9486.tar.bz2
openbsd-12f90f16f2ff4d8099a1b84bd50ecea1111e9486.zip
Move DH_generate_parameters() from dh_depr.c to dh_gen.c
discussed with jsing
-rw-r--r--src/lib/libcrypto/dh/dh_depr.c20
-rw-r--r--src/lib/libcrypto/dh/dh_gen.c21
2 files changed, 21 insertions, 20 deletions
diff --git a/src/lib/libcrypto/dh/dh_depr.c b/src/lib/libcrypto/dh/dh_depr.c
index b8a3dd2ff7..0bb02b5a95 100644
--- a/src/lib/libcrypto/dh/dh_depr.c
+++ b/src/lib/libcrypto/dh/dh_depr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_depr.c,v 1.9 2023/04/09 19:10:23 tb Exp $ */ 1/* $OpenBSD: dh_depr.c,v 1.10 2023/04/13 14:57:00 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -63,21 +63,3 @@
63#include <openssl/dh.h> 63#include <openssl/dh.h>
64 64
65#include "bn_local.h" 65#include "bn_local.h"
66
67DH *
68DH_generate_parameters(int prime_len, int generator,
69 void (*callback)(int, int, void *), void *cb_arg)
70{
71 BN_GENCB cb;
72 DH *ret = NULL;
73
74 if ((ret = DH_new()) == NULL)
75 return NULL;
76
77 BN_GENCB_set_old(&cb, callback, cb_arg);
78
79 if (DH_generate_parameters_ex(ret, prime_len, generator, &cb))
80 return ret;
81 DH_free(ret);
82 return NULL;
83}
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 @@
1/* $OpenBSD: dh_gen.c,v 1.17 2022/01/07 09:27:13 tb Exp $ */ 1/* $OpenBSD: dh_gen.c,v 1.18 2023/04/13 14:57:00 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -67,6 +67,7 @@
67#include <openssl/dh.h> 67#include <openssl/dh.h>
68#include <openssl/err.h> 68#include <openssl/err.h>
69 69
70#include "bn_local.h"
70#include "dh_local.h" 71#include "dh_local.h"
71 72
72static int dh_builtin_genparams(DH *ret, int prime_len, int generator, 73static int dh_builtin_genparams(DH *ret, int prime_len, int generator,
@@ -179,3 +180,21 @@ err:
179 } 180 }
180 return ok; 181 return ok;
181} 182}
183
184DH *
185DH_generate_parameters(int prime_len, int generator,
186 void (*callback)(int, int, void *), void *cb_arg)
187{
188 BN_GENCB cb;
189 DH *ret = NULL;
190
191 if ((ret = DH_new()) == NULL)
192 return NULL;
193
194 BN_GENCB_set_old(&cb, callback, cb_arg);
195
196 if (DH_generate_parameters_ex(ret, prime_len, generator, &cb))
197 return ret;
198 DH_free(ret);
199 return NULL;
200}