From: tb Date: Thu, 9 May 2024 20:40:42 +0000 (+0000) Subject: Move public API and DH_METHOD to the bottom of the file X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f5e89b37d5f2b261452fbfa40c9afd8ec93773e2;p=openbsd Move public API and DH_METHOD to the bottom of the file no functional change --- diff --git a/lib/libcrypto/dh/dh_key.c b/lib/libcrypto/dh/dh_key.c index 050d1143f8f..ea17f549892 100644 --- a/lib/libcrypto/dh/dh_key.c +++ b/lib/libcrypto/dh/dh_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_key.c,v 1.40 2023/08/03 18:53:55 tb Exp $ */ +/* $OpenBSD: dh_key.c,v 1.41 2024/05/09 20:40:42 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -65,43 +65,6 @@ #include "bn_local.h" #include "dh_local.h" -static int generate_key(DH *dh); -static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); -static int dh_bn_mod_exp(const DH *dh, BIGNUM *r, const BIGNUM *a, - const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); -static int dh_init(DH *dh); -static int dh_finish(DH *dh); - -int -DH_generate_key(DH *dh) -{ - return dh->meth->generate_key(dh); -} -LCRYPTO_ALIAS(DH_generate_key); - -int -DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) -{ - return dh->meth->compute_key(key, pub_key, dh); -} -LCRYPTO_ALIAS(DH_compute_key); - -static DH_METHOD dh_ossl = { - .name = "OpenSSL DH Method", - .generate_key = generate_key, - .compute_key = compute_key, - .bn_mod_exp = dh_bn_mod_exp, - .init = dh_init, - .finish = dh_finish, -}; - -const DH_METHOD * -DH_OpenSSL(void) -{ - return &dh_ossl; -} -LCRYPTO_ALIAS(DH_OpenSSL); - static int generate_key(DH *dh) { @@ -245,3 +208,33 @@ dh_finish(DH *dh) BN_MONT_CTX_free(dh->method_mont_p); return 1; } + +int +DH_generate_key(DH *dh) +{ + return dh->meth->generate_key(dh); +} +LCRYPTO_ALIAS(DH_generate_key); + +int +DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) +{ + return dh->meth->compute_key(key, pub_key, dh); +} +LCRYPTO_ALIAS(DH_compute_key); + +static DH_METHOD dh_ossl = { + .name = "OpenSSL DH Method", + .generate_key = generate_key, + .compute_key = compute_key, + .bn_mod_exp = dh_bn_mod_exp, + .init = dh_init, + .finish = dh_finish, +}; + +const DH_METHOD * +DH_OpenSSL(void) +{ + return &dh_ossl; +} +LCRYPTO_ALIAS(DH_OpenSSL);