diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ec/ec.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 29 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_asn1.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 53 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_local.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_mult.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_print.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_mont.c | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nist.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 20 |
10 files changed, 35 insertions, 114 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index 8cafc5522f..8ba62c8784 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec.h,v 1.30 2022/12/26 07:18:51 jmc Exp $ */ | 1 | /* $OpenBSD: ec.h,v 1.31 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -198,7 +198,9 @@ void EC_GROUP_free(EC_GROUP *group); | |||
| 198 | /** Clears and frees a EC_GROUP object | 198 | /** Clears and frees a EC_GROUP object |
| 199 | * \param group EC_GROUP object to be cleared and freed. | 199 | * \param group EC_GROUP object to be cleared and freed. |
| 200 | */ | 200 | */ |
| 201 | #ifndef LIBRESSL_INTERNAL | ||
| 201 | void EC_GROUP_clear_free(EC_GROUP *group); | 202 | void EC_GROUP_clear_free(EC_GROUP *group); |
| 203 | #endif | ||
| 202 | 204 | ||
| 203 | /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. | 205 | /** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. |
| 204 | * \param dst destination EC_GROUP object | 206 | * \param dst destination EC_GROUP object |
| @@ -425,7 +427,9 @@ void EC_POINT_free(EC_POINT *point); | |||
| 425 | /** Clears and frees a EC_POINT object | 427 | /** Clears and frees a EC_POINT object |
| 426 | * \param point EC_POINT object to be cleared and freed | 428 | * \param point EC_POINT object to be cleared and freed |
| 427 | */ | 429 | */ |
| 430 | #ifndef LIBRESSL_INTERNAL | ||
| 428 | void EC_POINT_clear_free(EC_POINT *point); | 431 | void EC_POINT_clear_free(EC_POINT *point); |
| 432 | #endif | ||
| 429 | 433 | ||
| 430 | /** Copies EC_POINT object | 434 | /** Copies EC_POINT object |
| 431 | * \param dst destination EC_POINT object | 435 | * \param dst destination EC_POINT object |
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index f995ff8718..84cba1b83b 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec2_smpl.c,v 1.32 2023/03/08 04:50:27 jsing Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.33 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -89,7 +89,7 @@ ec_GF2m_simple_group_init(EC_GROUP *group) | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | /* | 91 | /* |
| 92 | * Free a GF(2^m)-based EC_GROUP structure. | 92 | * Clear and free a GF(2^m)-based EC_GROUP structure. |
| 93 | * Note that all other members are handled by EC_GROUP_free. | 93 | * Note that all other members are handled by EC_GROUP_free. |
| 94 | */ | 94 | */ |
| 95 | static void | 95 | static void |
| @@ -98,18 +98,6 @@ ec_GF2m_simple_group_finish(EC_GROUP *group) | |||
| 98 | BN_free(&group->field); | 98 | BN_free(&group->field); |
| 99 | BN_free(&group->a); | 99 | BN_free(&group->a); |
| 100 | BN_free(&group->b); | 100 | BN_free(&group->b); |
| 101 | } | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Clear and free a GF(2^m)-based EC_GROUP structure. | ||
| 105 | * Note that all other members are handled by EC_GROUP_clear_free. | ||
| 106 | */ | ||
| 107 | static void | ||
| 108 | ec_GF2m_simple_group_clear_finish(EC_GROUP *group) | ||
| 109 | { | ||
| 110 | BN_free(&group->field); | ||
| 111 | BN_free(&group->a); | ||
| 112 | BN_free(&group->b); | ||
| 113 | group->poly[0] = 0; | 101 | group->poly[0] = 0; |
| 114 | group->poly[1] = 0; | 102 | group->poly[1] = 0; |
| 115 | group->poly[2] = 0; | 103 | group->poly[2] = 0; |
| @@ -272,18 +260,9 @@ ec_GF2m_simple_point_init(EC_POINT *point) | |||
| 272 | return 1; | 260 | return 1; |
| 273 | } | 261 | } |
| 274 | 262 | ||
| 275 | /* Frees an EC_POINT. */ | ||
| 276 | static void | ||
| 277 | ec_GF2m_simple_point_finish(EC_POINT *point) | ||
| 278 | { | ||
| 279 | BN_free(&point->X); | ||
| 280 | BN_free(&point->Y); | ||
| 281 | BN_free(&point->Z); | ||
| 282 | } | ||
| 283 | |||
| 284 | /* Clears and frees an EC_POINT. */ | 263 | /* Clears and frees an EC_POINT. */ |
| 285 | static void | 264 | static void |
| 286 | ec_GF2m_simple_point_clear_finish(EC_POINT *point) | 265 | ec_GF2m_simple_point_finish(EC_POINT *point) |
| 287 | { | 266 | { |
| 288 | BN_free(&point->X); | 267 | BN_free(&point->X); |
| 289 | BN_free(&point->Y); | 268 | BN_free(&point->Y); |
| @@ -727,7 +706,6 @@ static const EC_METHOD ec_GF2m_simple_method = { | |||
| 727 | .field_type = NID_X9_62_characteristic_two_field, | 706 | .field_type = NID_X9_62_characteristic_two_field, |
| 728 | .group_init = ec_GF2m_simple_group_init, | 707 | .group_init = ec_GF2m_simple_group_init, |
| 729 | .group_finish = ec_GF2m_simple_group_finish, | 708 | .group_finish = ec_GF2m_simple_group_finish, |
| 730 | .group_clear_finish = ec_GF2m_simple_group_clear_finish, | ||
| 731 | .group_copy = ec_GF2m_simple_group_copy, | 709 | .group_copy = ec_GF2m_simple_group_copy, |
| 732 | .group_set_curve = ec_GF2m_simple_group_set_curve, | 710 | .group_set_curve = ec_GF2m_simple_group_set_curve, |
| 733 | .group_get_curve = ec_GF2m_simple_group_get_curve, | 711 | .group_get_curve = ec_GF2m_simple_group_get_curve, |
| @@ -736,7 +714,6 @@ static const EC_METHOD ec_GF2m_simple_method = { | |||
| 736 | .group_check_discriminant = ec_GF2m_simple_group_check_discriminant, | 714 | .group_check_discriminant = ec_GF2m_simple_group_check_discriminant, |
| 737 | .point_init = ec_GF2m_simple_point_init, | 715 | .point_init = ec_GF2m_simple_point_init, |
| 738 | .point_finish = ec_GF2m_simple_point_finish, | 716 | .point_finish = ec_GF2m_simple_point_finish, |
| 739 | .point_clear_finish = ec_GF2m_simple_point_clear_finish, | ||
| 740 | .point_copy = ec_GF2m_simple_point_copy, | 717 | .point_copy = ec_GF2m_simple_point_copy, |
| 741 | .point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity, | 718 | .point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity, |
| 742 | .point_set_affine_coordinates = | 719 | .point_set_affine_coordinates = |
diff --git a/src/lib/libcrypto/ec/ec_asn1.c b/src/lib/libcrypto/ec/ec_asn1.c index 2d7a1d4c3b..fb6a8e84c1 100644 --- a/src/lib/libcrypto/ec/ec_asn1.c +++ b/src/lib/libcrypto/ec/ec_asn1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_asn1.c,v 1.40 2022/11/26 16:08:52 tb Exp $ */ | 1 | /* $OpenBSD: ec_asn1.c,v 1.41 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -1236,7 +1236,7 @@ ec_asn1_parameters2group(const ECPARAMETERS *params) | |||
| 1236 | 1236 | ||
| 1237 | err: | 1237 | err: |
| 1238 | if (!ok) { | 1238 | if (!ok) { |
| 1239 | EC_GROUP_clear_free(ret); | 1239 | EC_GROUP_free(ret); |
| 1240 | ret = NULL; | 1240 | ret = NULL; |
| 1241 | } | 1241 | } |
| 1242 | BN_free(p); | 1242 | BN_free(p); |
| @@ -1299,7 +1299,7 @@ d2i_ECPKParameters(EC_GROUP ** a, const unsigned char **in, long len) | |||
| 1299 | } | 1299 | } |
| 1300 | 1300 | ||
| 1301 | if (a != NULL) { | 1301 | if (a != NULL) { |
| 1302 | EC_GROUP_clear_free(*a); | 1302 | EC_GROUP_free(*a); |
| 1303 | *a = group; | 1303 | *a = group; |
| 1304 | } | 1304 | } |
| 1305 | 1305 | ||
| @@ -1347,7 +1347,7 @@ d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len) | |||
| 1347 | ret = *a; | 1347 | ret = *a; |
| 1348 | 1348 | ||
| 1349 | if (priv_key->parameters) { | 1349 | if (priv_key->parameters) { |
| 1350 | EC_GROUP_clear_free(ret->group); | 1350 | EC_GROUP_free(ret->group); |
| 1351 | ret->group = ec_asn1_pkparameters2group(priv_key->parameters); | 1351 | ret->group = ec_asn1_pkparameters2group(priv_key->parameters); |
| 1352 | } | 1352 | } |
| 1353 | if (ret->group == NULL) { | 1353 | if (ret->group == NULL) { |
| @@ -1371,7 +1371,7 @@ d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len) | |||
| 1371 | } | 1371 | } |
| 1372 | 1372 | ||
| 1373 | if (ret->pub_key) | 1373 | if (ret->pub_key) |
| 1374 | EC_POINT_clear_free(ret->pub_key); | 1374 | EC_POINT_free(ret->pub_key); |
| 1375 | ret->pub_key = EC_POINT_new(ret->group); | 1375 | ret->pub_key = EC_POINT_new(ret->group); |
| 1376 | if (ret->pub_key == NULL) { | 1376 | if (ret->pub_key == NULL) { |
| 1377 | ECerror(ERR_R_EC_LIB); | 1377 | ECerror(ERR_R_EC_LIB); |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 0e863ddfef..8eb0253a1f 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lib.c,v 1.49 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.50 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -117,46 +117,28 @@ EC_GROUP_new(const EC_METHOD *meth) | |||
| 117 | void | 117 | void |
| 118 | EC_GROUP_free(EC_GROUP *group) | 118 | EC_GROUP_free(EC_GROUP *group) |
| 119 | { | 119 | { |
| 120 | if (!group) | 120 | if (group != NULL) |
| 121 | return; | 121 | return; |
| 122 | 122 | ||
| 123 | if (group->meth->group_finish != 0) | 123 | if (group->meth->group_finish != NULL) |
| 124 | group->meth->group_finish(group); | 124 | group->meth->group_finish(group); |
| 125 | 125 | ||
| 126 | EC_EX_DATA_free_all_data(&group->extra_data); | 126 | EC_EX_DATA_clear_free_all_data(&group->extra_data); |
| 127 | 127 | ||
| 128 | EC_POINT_free(group->generator); | 128 | EC_POINT_free(group->generator); |
| 129 | BN_free(&group->order); | 129 | BN_free(&group->order); |
| 130 | BN_free(&group->cofactor); | 130 | BN_free(&group->cofactor); |
| 131 | 131 | ||
| 132 | free(group->seed); | 132 | freezero(group->seed, group->seed_len); |
| 133 | 133 | freezero(group, sizeof *group); | |
| 134 | free(group); | ||
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | |||
| 138 | void | 136 | void |
| 139 | EC_GROUP_clear_free(EC_GROUP *group) | 137 | EC_GROUP_clear_free(EC_GROUP *group) |
| 140 | { | 138 | { |
| 141 | if (!group) | 139 | return EC_GROUP_free(group); |
| 142 | return; | ||
| 143 | |||
| 144 | if (group->meth->group_clear_finish != 0) | ||
| 145 | group->meth->group_clear_finish(group); | ||
| 146 | else if (group->meth->group_finish != 0) | ||
| 147 | group->meth->group_finish(group); | ||
| 148 | |||
| 149 | EC_EX_DATA_clear_free_all_data(&group->extra_data); | ||
| 150 | |||
| 151 | EC_POINT_clear_free(group->generator); | ||
| 152 | BN_free(&group->order); | ||
| 153 | BN_free(&group->cofactor); | ||
| 154 | |||
| 155 | freezero(group->seed, group->seed_len); | ||
| 156 | freezero(group, sizeof *group); | ||
| 157 | } | 140 | } |
| 158 | 141 | ||
| 159 | |||
| 160 | int | 142 | int |
| 161 | EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | 143 | EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) |
| 162 | { | 144 | { |
| @@ -195,7 +177,7 @@ EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
| 195 | return 0; | 177 | return 0; |
| 196 | } else { | 178 | } else { |
| 197 | /* src->generator == NULL */ | 179 | /* src->generator == NULL */ |
| 198 | EC_POINT_clear_free(dest->generator); | 180 | EC_POINT_free(dest->generator); |
| 199 | dest->generator = NULL; | 181 | dest->generator = NULL; |
| 200 | } | 182 | } |
| 201 | 183 | ||
| @@ -851,33 +833,24 @@ EC_POINT_new(const EC_GROUP *group) | |||
| 851 | return ret; | 833 | return ret; |
| 852 | } | 834 | } |
| 853 | 835 | ||
| 854 | |||
| 855 | void | 836 | void |
| 856 | EC_POINT_free(EC_POINT *point) | 837 | EC_POINT_free(EC_POINT *point) |
| 857 | { | 838 | { |
| 858 | if (!point) | 839 | if (point != NULL) |
| 859 | return; | 840 | return; |
| 860 | 841 | ||
| 861 | if (point->meth->point_finish != 0) | 842 | if (point->meth->point_finish != NULL) |
| 862 | point->meth->point_finish(point); | 843 | point->meth->point_finish(point); |
| 863 | free(point); | ||
| 864 | } | ||
| 865 | 844 | ||
| 845 | freezero(point, sizeof *point); | ||
| 846 | } | ||
| 866 | 847 | ||
| 867 | void | 848 | void |
| 868 | EC_POINT_clear_free(EC_POINT *point) | 849 | EC_POINT_clear_free(EC_POINT *point) |
| 869 | { | 850 | { |
| 870 | if (!point) | 851 | return EC_POINT_free(point); |
| 871 | return; | ||
| 872 | |||
| 873 | if (point->meth->point_clear_finish != 0) | ||
| 874 | point->meth->point_clear_finish(point); | ||
| 875 | else if (point->meth->point_finish != 0) | ||
| 876 | point->meth->point_finish(point); | ||
| 877 | freezero(point, sizeof *point); | ||
| 878 | } | 852 | } |
| 879 | 853 | ||
| 880 | |||
| 881 | int | 854 | int |
| 882 | EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) | 855 | EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) |
| 883 | { | 856 | { |
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index d4cb777c83..d26ec47a24 100644 --- a/src/lib/libcrypto/ec/ec_local.h +++ b/src/lib/libcrypto/ec/ec_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_local.h,v 1.10 2023/03/08 04:50:27 jsing Exp $ */ | 1 | /* $OpenBSD: ec_local.h,v 1.11 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -91,7 +91,6 @@ struct ec_method_st { | |||
| 91 | 91 | ||
| 92 | int (*group_init)(EC_GROUP *); | 92 | int (*group_init)(EC_GROUP *); |
| 93 | void (*group_finish)(EC_GROUP *); | 93 | void (*group_finish)(EC_GROUP *); |
| 94 | void (*group_clear_finish)(EC_GROUP *); | ||
| 95 | int (*group_copy)(EC_GROUP *, const EC_GROUP *); | 94 | int (*group_copy)(EC_GROUP *, const EC_GROUP *); |
| 96 | 95 | ||
| 97 | int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, | 96 | int (*group_set_curve)(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, |
| @@ -105,7 +104,6 @@ struct ec_method_st { | |||
| 105 | 104 | ||
| 106 | int (*point_init)(EC_POINT *); | 105 | int (*point_init)(EC_POINT *); |
| 107 | void (*point_finish)(EC_POINT *); | 106 | void (*point_finish)(EC_POINT *); |
| 108 | void (*point_clear_finish)(EC_POINT *); | ||
| 109 | int (*point_copy)(EC_POINT *, const EC_POINT *); | 107 | int (*point_copy)(EC_POINT *, const EC_POINT *); |
| 110 | 108 | ||
| 111 | int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); | 109 | int (*point_set_to_infinity)(const EC_GROUP *, EC_POINT *); |
| @@ -317,7 +315,6 @@ int ec_wNAF_have_precompute_mult(const EC_GROUP *group); | |||
| 317 | /* method functions in ecp_smpl.c */ | 315 | /* method functions in ecp_smpl.c */ |
| 318 | int ec_GFp_simple_group_init(EC_GROUP *); | 316 | int ec_GFp_simple_group_init(EC_GROUP *); |
| 319 | void ec_GFp_simple_group_finish(EC_GROUP *); | 317 | void ec_GFp_simple_group_finish(EC_GROUP *); |
| 320 | void ec_GFp_simple_group_clear_finish(EC_GROUP *); | ||
| 321 | int ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *); | 318 | int ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *); |
| 322 | int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); | 319 | int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *); |
| 323 | int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); | 320 | int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); |
| @@ -325,7 +322,6 @@ int ec_GFp_simple_group_get_degree(const EC_GROUP *); | |||
| 325 | int ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *); | 322 | int ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *); |
| 326 | int ec_GFp_simple_point_init(EC_POINT *); | 323 | int ec_GFp_simple_point_init(EC_POINT *); |
| 327 | void ec_GFp_simple_point_finish(EC_POINT *); | 324 | void ec_GFp_simple_point_finish(EC_POINT *); |
| 328 | void ec_GFp_simple_point_clear_finish(EC_POINT *); | ||
| 329 | int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *); | 325 | int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *); |
| 330 | int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *); | 326 | int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *); |
| 331 | int ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *, EC_POINT *, | 327 | int ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *, EC_POINT *, |
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 4b50184ff6..c792725661 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_mult.c,v 1.27 2022/11/26 16:08:52 tb Exp $ */ | 1 | /* $OpenBSD: ec_mult.c,v 1.28 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. | 3 | * Originally written by Bodo Moeller and Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -172,7 +172,7 @@ ec_pre_comp_clear_free(void *pre_) | |||
| 172 | EC_POINT **p; | 172 | EC_POINT **p; |
| 173 | 173 | ||
| 174 | for (p = pre->points; *p != NULL; p++) { | 174 | for (p = pre->points; *p != NULL; p++) { |
| 175 | EC_POINT_clear_free(*p); | 175 | EC_POINT_free(*p); |
| 176 | explicit_bzero(p, sizeof *p); | 176 | explicit_bzero(p, sizeof *p); |
| 177 | } | 177 | } |
| 178 | free(pre->points); | 178 | free(pre->points); |
| @@ -694,7 +694,7 @@ ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 694 | } | 694 | } |
| 695 | if (val != NULL) { | 695 | if (val != NULL) { |
| 696 | for (v = val; *v != NULL; v++) | 696 | for (v = val; *v != NULL; v++) |
| 697 | EC_POINT_clear_free(*v); | 697 | EC_POINT_free(*v); |
| 698 | free(val); | 698 | free(val); |
| 699 | } | 699 | } |
| 700 | free(val_sub); | 700 | free(val_sub); |
diff --git a/src/lib/libcrypto/ec/ec_print.c b/src/lib/libcrypto/ec/ec_print.c index faa212f502..2aa0aa66a9 100644 --- a/src/lib/libcrypto/ec/ec_print.c +++ b/src/lib/libcrypto/ec/ec_print.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_print.c,v 1.10 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: ec_print.c,v 1.11 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -110,7 +110,7 @@ EC_POINT_bn2point(const EC_GROUP *group, | |||
| 110 | 110 | ||
| 111 | if (!EC_POINT_oct2point(group, ret, buf, buf_len, ctx)) { | 111 | if (!EC_POINT_oct2point(group, ret, buf, buf_len, ctx)) { |
| 112 | if (point == NULL) | 112 | if (point == NULL) |
| 113 | EC_POINT_clear_free(ret); | 113 | EC_POINT_free(ret); |
| 114 | free(buf); | 114 | free(buf); |
| 115 | return NULL; | 115 | return NULL; |
| 116 | } | 116 | } |
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c index d0d497b011..8b85bf32fa 100644 --- a/src/lib/libcrypto/ec/ecp_mont.c +++ b/src/lib/libcrypto/ec/ecp_mont.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_mont.c,v 1.26 2023/03/08 04:50:27 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_mont.c,v 1.27 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -93,13 +93,6 @@ ec_GFp_mont_group_finish(EC_GROUP *group) | |||
| 93 | ec_GFp_simple_group_finish(group); | 93 | ec_GFp_simple_group_finish(group); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static void | ||
| 97 | ec_GFp_mont_group_clear_finish(EC_GROUP *group) | ||
| 98 | { | ||
| 99 | ec_GFp_mont_group_clear(group); | ||
| 100 | ec_GFp_simple_group_clear_finish(group); | ||
| 101 | } | ||
| 102 | |||
| 103 | static int | 96 | static int |
| 104 | ec_GFp_mont_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 97 | ec_GFp_mont_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
| 105 | { | 98 | { |
| @@ -236,7 +229,6 @@ static const EC_METHOD ec_GFp_mont_method = { | |||
| 236 | .field_type = NID_X9_62_prime_field, | 229 | .field_type = NID_X9_62_prime_field, |
| 237 | .group_init = ec_GFp_mont_group_init, | 230 | .group_init = ec_GFp_mont_group_init, |
| 238 | .group_finish = ec_GFp_mont_group_finish, | 231 | .group_finish = ec_GFp_mont_group_finish, |
| 239 | .group_clear_finish = ec_GFp_mont_group_clear_finish, | ||
| 240 | .group_copy = ec_GFp_mont_group_copy, | 232 | .group_copy = ec_GFp_mont_group_copy, |
| 241 | .group_set_curve = ec_GFp_mont_group_set_curve, | 233 | .group_set_curve = ec_GFp_mont_group_set_curve, |
| 242 | .group_get_curve = ec_GFp_simple_group_get_curve, | 234 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| @@ -245,7 +237,6 @@ static const EC_METHOD ec_GFp_mont_method = { | |||
| 245 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, | 237 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, |
| 246 | .point_init = ec_GFp_simple_point_init, | 238 | .point_init = ec_GFp_simple_point_init, |
| 247 | .point_finish = ec_GFp_simple_point_finish, | 239 | .point_finish = ec_GFp_simple_point_finish, |
| 248 | .point_clear_finish = ec_GFp_simple_point_clear_finish, | ||
| 249 | .point_copy = ec_GFp_simple_point_copy, | 240 | .point_copy = ec_GFp_simple_point_copy, |
| 250 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, | 241 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 251 | .point_set_Jprojective_coordinates = | 242 | .point_set_Jprojective_coordinates = |
diff --git a/src/lib/libcrypto/ec/ecp_nist.c b/src/lib/libcrypto/ec/ecp_nist.c index e3c13f7c65..b8fb5dc90f 100644 --- a/src/lib/libcrypto/ec/ecp_nist.c +++ b/src/lib/libcrypto/ec/ecp_nist.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_nist.c,v 1.23 2023/03/08 04:50:27 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_nist.c,v 1.24 2023/03/08 05:45:31 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -171,7 +171,6 @@ static const EC_METHOD ec_GFp_nist_method = { | |||
| 171 | .field_type = NID_X9_62_prime_field, | 171 | .field_type = NID_X9_62_prime_field, |
| 172 | .group_init = ec_GFp_simple_group_init, | 172 | .group_init = ec_GFp_simple_group_init, |
| 173 | .group_finish = ec_GFp_simple_group_finish, | 173 | .group_finish = ec_GFp_simple_group_finish, |
| 174 | .group_clear_finish = ec_GFp_simple_group_clear_finish, | ||
| 175 | .group_copy = ec_GFp_nist_group_copy, | 174 | .group_copy = ec_GFp_nist_group_copy, |
| 176 | .group_set_curve = ec_GFp_nist_group_set_curve, | 175 | .group_set_curve = ec_GFp_nist_group_set_curve, |
| 177 | .group_get_curve = ec_GFp_simple_group_get_curve, | 176 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| @@ -180,7 +179,6 @@ static const EC_METHOD ec_GFp_nist_method = { | |||
| 180 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, | 179 | .group_check_discriminant = ec_GFp_simple_group_check_discriminant, |
| 181 | .point_init = ec_GFp_simple_point_init, | 180 | .point_init = ec_GFp_simple_point_init, |
| 182 | .point_finish = ec_GFp_simple_point_finish, | 181 | .point_finish = ec_GFp_simple_point_finish, |
| 183 | .point_clear_finish = ec_GFp_simple_point_clear_finish, | ||
| 184 | .point_copy = ec_GFp_simple_point_copy, | 182 | .point_copy = ec_GFp_simple_point_copy, |
| 185 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, | 183 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 186 | .point_set_Jprojective_coordinates = | 184 | .point_set_Jprojective_coordinates = |
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 = |
