From f59a5e932baaa204327818534b8c93267c20bed0 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 8 Mar 2023 05:45:31 +0000 Subject: Always clear EC groups and points on free. Rather than sometimes clearing, turn the free functions into ones that always clear (as we've done elsewhere). Turn the EC_GROUP_clear_free() and EC_POINT_clear_free() functions into wrappers that call the *_free() version. Do similar for the EC_METHOD implementations, removing the group_clear_finish() and point_clear_finish() hooks in the process. ok tb@ --- src/lib/libcrypto/ec/ecp_smpl.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/lib/libcrypto/ec/ecp_smpl.c') diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index c33347ad85..9af6034601 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_smpl.c,v 1.41 2023/03/08 04:50:27 jsing Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.42 2023/03/08 05:45:31 jsing Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -99,14 +99,6 @@ ec_GFp_simple_group_finish(EC_GROUP *group) BN_free(&group->b); } -void -ec_GFp_simple_group_clear_finish(EC_GROUP *group) -{ - BN_free(&group->field); - BN_free(&group->a); - BN_free(&group->b); -} - int ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) { @@ -315,14 +307,6 @@ ec_GFp_simple_point_init(EC_POINT * point) void ec_GFp_simple_point_finish(EC_POINT *point) -{ - BN_free(&point->X); - BN_free(&point->Y); - BN_free(&point->Z); -} - -void -ec_GFp_simple_point_clear_finish(EC_POINT *point) { BN_free(&point->X); BN_free(&point->Y); @@ -1657,7 +1641,6 @@ static const EC_METHOD ec_GFp_simple_method = { .field_type = NID_X9_62_prime_field, .group_init = ec_GFp_simple_group_init, .group_finish = ec_GFp_simple_group_finish, - .group_clear_finish = ec_GFp_simple_group_clear_finish, .group_copy = ec_GFp_simple_group_copy, .group_set_curve = ec_GFp_simple_group_set_curve, .group_get_curve = ec_GFp_simple_group_get_curve, @@ -1666,7 +1649,6 @@ static const EC_METHOD ec_GFp_simple_method = { .group_check_discriminant = ec_GFp_simple_group_check_discriminant, .point_init = ec_GFp_simple_point_init, .point_finish = ec_GFp_simple_point_finish, - .point_clear_finish = ec_GFp_simple_point_clear_finish, .point_copy = ec_GFp_simple_point_copy, .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, .point_set_Jprojective_coordinates = -- cgit v1.2.3-55-g6feb