diff options
author | jsing <> | 2023-03-08 05:45:31 +0000 |
---|---|---|
committer | jsing <> | 2023-03-08 05:45:31 +0000 |
commit | f59a5e932baaa204327818534b8c93267c20bed0 (patch) | |
tree | 96a3d2dbc6ef11df6851b53d3d2e1c46dd7f2328 /src/lib/libcrypto/ec/ecp_smpl.c | |
parent | 49f24f2af100d1cc94534c31f0db0ac8072ee4ac (diff) | |
download | openbsd-f59a5e932baaa204327818534b8c93267c20bed0.tar.gz openbsd-f59a5e932baaa204327818534b8c93267c20bed0.tar.bz2 openbsd-f59a5e932baaa204327818534b8c93267c20bed0.zip |
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@
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_smpl.c')
-rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 20 |
1 files changed, 1 insertions, 19 deletions
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 @@ | |||
1 | /* $OpenBSD: ecp_smpl.c,v 1.41 2023/03/08 04:50:27 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.42 2023/03/08 05:45:31 jsing Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -99,14 +99,6 @@ ec_GFp_simple_group_finish(EC_GROUP *group) | |||
99 | BN_free(&group->b); | 99 | BN_free(&group->b); |
100 | } | 100 | } |
101 | 101 | ||
102 | void | ||
103 | ec_GFp_simple_group_clear_finish(EC_GROUP *group) | ||
104 | { | ||
105 | BN_free(&group->field); | ||
106 | BN_free(&group->a); | ||
107 | BN_free(&group->b); | ||
108 | } | ||
109 | |||
110 | int | 102 | int |
111 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 103 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
112 | { | 104 | { |
@@ -319,14 +311,6 @@ ec_GFp_simple_point_finish(EC_POINT *point) | |||
319 | BN_free(&point->X); | 311 | BN_free(&point->X); |
320 | BN_free(&point->Y); | 312 | BN_free(&point->Y); |
321 | BN_free(&point->Z); | 313 | BN_free(&point->Z); |
322 | } | ||
323 | |||
324 | void | ||
325 | ec_GFp_simple_point_clear_finish(EC_POINT *point) | ||
326 | { | ||
327 | BN_free(&point->X); | ||
328 | BN_free(&point->Y); | ||
329 | BN_free(&point->Z); | ||
330 | point->Z_is_one = 0; | 314 | point->Z_is_one = 0; |
331 | } | 315 | } |
332 | 316 | ||
@@ -1657,7 +1641,6 @@ static const EC_METHOD ec_GFp_simple_method = { | |||
1657 | .field_type = NID_X9_62_prime_field, | 1641 | .field_type = NID_X9_62_prime_field, |
1658 | .group_init = ec_GFp_simple_group_init, | 1642 | .group_init = ec_GFp_simple_group_init, |
1659 | .group_finish = ec_GFp_simple_group_finish, | 1643 | .group_finish = ec_GFp_simple_group_finish, |
1660 | .group_clear_finish = ec_GFp_simple_group_clear_finish, | ||
1661 | .group_copy = ec_GFp_simple_group_copy, | 1644 | .group_copy = ec_GFp_simple_group_copy, |
1662 | .group_set_curve = ec_GFp_simple_group_set_curve, | 1645 | .group_set_curve = ec_GFp_simple_group_set_curve, |
1663 | .group_get_curve = ec_GFp_simple_group_get_curve, | 1646 | .group_get_curve = ec_GFp_simple_group_get_curve, |
@@ -1666,7 +1649,6 @@ static const EC_METHOD ec_GFp_simple_method = { | |||
1666 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, | 1649 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, |
1667 | .point_init = ec_GFp_simple_point_init, | 1650 | .point_init = ec_GFp_simple_point_init, |
1668 | .point_finish = ec_GFp_simple_point_finish, | 1651 | .point_finish = ec_GFp_simple_point_finish, |
1669 | .point_clear_finish = ec_GFp_simple_point_clear_finish, | ||
1670 | .point_copy = ec_GFp_simple_point_copy, | 1652 | .point_copy = ec_GFp_simple_point_copy, |
1671 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, | 1653 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
1672 | .point_set_Jprojective_coordinates = | 1654 | .point_set_Jprojective_coordinates = |