From b86ac7d703294069b372c3e8c1cc0c2add015370 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 25 Jun 2023 19:04:35 +0000 Subject: [PATCH] Move ECDH_OpenSSL() ECDSA_OpenSSL() to *_lib.c Now that they no longer use static methods, they can move where they belong. Also make the static method const, as it should have been all along. --- lib/libcrypto/ecdh/ech_key.c | 13 +------------ lib/libcrypto/ecdh/ech_lib.c | 13 ++++++++++++- lib/libcrypto/ecdsa/ecs_lib.c | 15 ++++++++++++++- lib/libcrypto/ecdsa/ecs_ossl.c | 15 +-------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/libcrypto/ecdh/ech_key.c b/lib/libcrypto/ecdh/ech_key.c index 108a5ff8f67..5f68b018603 100644 --- a/lib/libcrypto/ecdh/ech_key.c +++ b/lib/libcrypto/ecdh/ech_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ech_key.c,v 1.15 2023/06/25 18:41:36 tb Exp $ */ +/* $OpenBSD: ech_key.c,v 1.16 2023/06/25 19:04:35 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -189,17 +189,6 @@ err: return (ret); } -static ECDH_METHOD openssl_ecdh_meth = { - .name = "OpenSSL ECDH method", - .compute_key = ossl_ecdh_compute_key, -}; - -const ECDH_METHOD * -ECDH_OpenSSL(void) -{ - return &openssl_ecdh_meth; -} - int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *eckey, diff --git a/lib/libcrypto/ecdh/ech_lib.c b/lib/libcrypto/ecdh/ech_lib.c index f062ec3fdc8..d9687932081 100644 --- a/lib/libcrypto/ecdh/ech_lib.c +++ b/lib/libcrypto/ecdh/ech_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ech_lib.c,v 1.19 2023/06/25 18:45:56 tb Exp $ */ +/* $OpenBSD: ech_lib.c,v 1.20 2023/06/25 19:04:35 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -81,6 +81,17 @@ static const ECDH_METHOD *default_ECDH_method = NULL; +static const ECDH_METHOD openssl_ecdh_meth = { + .name = "OpenSSL ECDH method", + .compute_key = ossl_ecdh_compute_key, +}; + +const ECDH_METHOD * +ECDH_OpenSSL(void) +{ + return &openssl_ecdh_meth; +} + void ECDH_set_default_method(const ECDH_METHOD *meth) { diff --git a/lib/libcrypto/ecdsa/ecs_lib.c b/lib/libcrypto/ecdsa/ecs_lib.c index 11e707dd55b..477f49a6c2a 100644 --- a/lib/libcrypto/ecdsa/ecs_lib.c +++ b/lib/libcrypto/ecdsa/ecs_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_lib.c,v 1.20 2023/06/25 18:45:56 tb Exp $ */ +/* $OpenBSD: ecs_lib.c,v 1.21 2023/06/25 19:04:35 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * @@ -68,6 +68,19 @@ static const ECDSA_METHOD *default_ECDSA_method = NULL; +static const ECDSA_METHOD openssl_ecdsa_meth = { + .name = "OpenSSL ECDSA method", + .ecdsa_do_sign = ossl_ecdsa_sign_sig, + .ecdsa_sign_setup = ossl_ecdsa_sign_setup, + .ecdsa_do_verify = ossl_ecdsa_verify_sig, +}; + +const ECDSA_METHOD * +ECDSA_OpenSSL(void) +{ + return &openssl_ecdsa_meth; +} + void ECDSA_set_default_method(const ECDSA_METHOD *meth) { diff --git a/lib/libcrypto/ecdsa/ecs_ossl.c b/lib/libcrypto/ecdsa/ecs_ossl.c index 5df87f224b2..547d3b59e10 100644 --- a/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/lib/libcrypto/ecdsa/ecs_ossl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_ossl.c,v 1.35 2023/06/25 18:41:36 tb Exp $ */ +/* $OpenBSD: ecs_ossl.c,v 1.36 2023/06/25 19:04:35 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project */ @@ -72,19 +72,6 @@ static int ecdsa_prepare_digest(const unsigned char *dgst, int dgst_len, BIGNUM *order, BIGNUM *ret); -static ECDSA_METHOD openssl_ecdsa_meth = { - .name = "OpenSSL ECDSA method", - .ecdsa_do_sign = ossl_ecdsa_sign_sig, - .ecdsa_sign_setup = ossl_ecdsa_sign_setup, - .ecdsa_do_verify = ossl_ecdsa_verify_sig, -}; - -const ECDSA_METHOD * -ECDSA_OpenSSL(void) -{ - return &openssl_ecdsa_meth; -} - static int ecdsa_prepare_digest(const unsigned char *dgst, int dgst_len, BIGNUM *order, BIGNUM *ret) -- 2.20.1