diff options
author | tb <> | 2024-05-09 20:40:42 +0000 |
---|---|---|
committer | tb <> | 2024-05-09 20:40:42 +0000 |
commit | d0813594aa688abaa37cdcaa84fdeb6b0634071d (patch) | |
tree | b48144110938dff9fdeb773903f879d3c2d31ab5 /src | |
parent | f6da9d414f707f3b58c36951d03d9984e8540bc6 (diff) | |
download | openbsd-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.c | 69 |
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 | ||
68 | static int generate_key(DH *dh); | ||
69 | static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); | ||
70 | static 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); | ||
72 | static int dh_init(DH *dh); | ||
73 | static int dh_finish(DH *dh); | ||
74 | |||
75 | int | ||
76 | DH_generate_key(DH *dh) | ||
77 | { | ||
78 | return dh->meth->generate_key(dh); | ||
79 | } | ||
80 | LCRYPTO_ALIAS(DH_generate_key); | ||
81 | |||
82 | int | ||
83 | DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | ||
84 | { | ||
85 | return dh->meth->compute_key(key, pub_key, dh); | ||
86 | } | ||
87 | LCRYPTO_ALIAS(DH_compute_key); | ||
88 | |||
89 | static 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 | |||
98 | const DH_METHOD * | ||
99 | DH_OpenSSL(void) | ||
100 | { | ||
101 | return &dh_ossl; | ||
102 | } | ||
103 | LCRYPTO_ALIAS(DH_OpenSSL); | ||
104 | |||
105 | static int | 68 | static int |
106 | generate_key(DH *dh) | 69 | generate_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 | |||
212 | int | ||
213 | DH_generate_key(DH *dh) | ||
214 | { | ||
215 | return dh->meth->generate_key(dh); | ||
216 | } | ||
217 | LCRYPTO_ALIAS(DH_generate_key); | ||
218 | |||
219 | int | ||
220 | DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | ||
221 | { | ||
222 | return dh->meth->compute_key(key, pub_key, dh); | ||
223 | } | ||
224 | LCRYPTO_ALIAS(DH_compute_key); | ||
225 | |||
226 | static 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 | |||
235 | const DH_METHOD * | ||
236 | DH_OpenSSL(void) | ||
237 | { | ||
238 | return &dh_ossl; | ||
239 | } | ||
240 | LCRYPTO_ALIAS(DH_OpenSSL); | ||