summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-05-09 20:40:42 +0000
committertb <>2024-05-09 20:40:42 +0000
commitd0813594aa688abaa37cdcaa84fdeb6b0634071d (patch)
treeb48144110938dff9fdeb773903f879d3c2d31ab5 /src
parentf6da9d414f707f3b58c36951d03d9984e8540bc6 (diff)
downloadopenbsd-d0813594aa688abaa37cdcaa84fdeb6b0634071d.tar.gz
openbsd-d0813594aa688abaa37cdcaa84fdeb6b0634071d.tar.bz2
openbsd-d0813594aa688abaa37cdcaa84fdeb6b0634071d.zip
Move public API and DH_METHOD to the bottom of the file
no functional change
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/dh/dh_key.c69
1 files changed, 31 insertions, 38 deletions
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c
index 050d1143f8..ea17f54989 100644
--- a/src/lib/libcrypto/dh/dh_key.c
+++ b/src/lib/libcrypto/dh/dh_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_key.c,v 1.40 2023/08/03 18:53:55 tb Exp $ */ 1/* $OpenBSD: dh_key.c,v 1.41 2024/05/09 20:40:42 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 *
@@ -65,43 +65,6 @@
65#include "bn_local.h" 65#include "bn_local.h"
66#include "dh_local.h" 66#include "dh_local.h"
67 67
68static int generate_key(DH *dh);
69static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
70static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a,
71 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
72static int dh_init(DH *dh);
73static int dh_finish(DH *dh);
74
75int
76DH_generate_key(DH *dh)
77{
78 return dh->meth->generate_key(dh);
79}
80LCRYPTO_ALIAS(DH_generate_key);
81
82int
83DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
84{
85 return dh->meth->compute_key(key, pub_key, dh);
86}
87LCRYPTO_ALIAS(DH_compute_key);
88
89static DH_METHOD dh_ossl = {
90 .name = "OpenSSL DH Method",
91 .generate_key = generate_key,
92 .compute_key = compute_key,
93 .bn_mod_exp = dh_bn_mod_exp,
94 .init = dh_init,
95 .finish = dh_finish,
96};
97
98const DH_METHOD *
99DH_OpenSSL(void)
100{
101 return &dh_ossl;
102}
103LCRYPTO_ALIAS(DH_OpenSSL);
104
105static int 68static int
106generate_key(DH *dh) 69generate_key(DH *dh)
107{ 70{
@@ -245,3 +208,33 @@ dh_finish(DH *dh)
245 BN_MONT_CTX_free(dh->method_mont_p); 208 BN_MONT_CTX_free(dh->method_mont_p);
246 return 1; 209 return 1;
247} 210}
211
212int
213DH_generate_key(DH *dh)
214{
215 return dh->meth->generate_key(dh);
216}
217LCRYPTO_ALIAS(DH_generate_key);
218
219int
220DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
221{
222 return dh->meth->compute_key(key, pub_key, dh);
223}
224LCRYPTO_ALIAS(DH_compute_key);
225
226static DH_METHOD dh_ossl = {
227 .name = "OpenSSL DH Method",
228 .generate_key = generate_key,
229 .compute_key = compute_key,
230 .bn_mod_exp = dh_bn_mod_exp,
231 .init = dh_init,
232 .finish = dh_finish,
233};
234
235const DH_METHOD *
236DH_OpenSSL(void)
237{
238 return &dh_ossl;
239}
240LCRYPTO_ALIAS(DH_OpenSSL);