From 2b332d0eeb79960979cc8d7e9322139480369b94 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 25 Jun 2023 19:33:39 +0000 Subject: [PATCH] Move ECDSA_size() to ecs_ossl.c to match what was done in ecdh --- lib/libcrypto/ecdsa/ecs_lib.c | 34 +--------------------------------- lib/libcrypto/ecdsa/ecs_ossl.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/libcrypto/ecdsa/ecs_lib.c b/lib/libcrypto/ecdsa/ecs_lib.c index 477f49a6c2a..743d5171657 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.21 2023/06/25 19:04:35 tb Exp $ */ +/* $OpenBSD: ecs_lib.c,v 1.22 2023/06/25 19:33:39 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. * @@ -102,38 +102,6 @@ ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth) return 0; } -int -ECDSA_size(const EC_KEY *r) -{ - BIGNUM *order = NULL; - const EC_GROUP *group; - ECDSA_SIG signature; - int ret = 0; - - if (r == NULL) - goto err; - - if ((group = EC_KEY_get0_group(r)) == NULL) - goto err; - - if ((order = BN_new()) == NULL) - goto err; - - if (!EC_GROUP_get_order(group, order, NULL)) - goto err; - - signature.r = order; - signature.s = order; - - if ((ret = i2d_ECDSA_SIG(&signature, NULL)) < 0) - ret = 0; - - err: - BN_free(order); - - return ret; -} - int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) diff --git a/lib/libcrypto/ecdsa/ecs_ossl.c b/lib/libcrypto/ecdsa/ecs_ossl.c index 547d3b59e10..251a938e2df 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.36 2023/06/25 19:04:35 tb Exp $ */ +/* $OpenBSD: ecs_ossl.c,v 1.37 2023/06/25 19:33:39 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project */ @@ -580,3 +580,35 @@ ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); return 0; } + +int +ECDSA_size(const EC_KEY *r) +{ + BIGNUM *order = NULL; + const EC_GROUP *group; + ECDSA_SIG signature; + int ret = 0; + + if (r == NULL) + goto err; + + if ((group = EC_KEY_get0_group(r)) == NULL) + goto err; + + if ((order = BN_new()) == NULL) + goto err; + + if (!EC_GROUP_get_order(group, order, NULL)) + goto err; + + signature.r = order; + signature.s = order; + + if ((ret = i2d_ECDSA_SIG(&signature, NULL)) < 0) + ret = 0; + + err: + BN_free(order); + + return ret; +} -- 2.20.1