summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_asn1.c
diff options
context:
space:
mode:
authorjsing <>2023-03-08 05:45:31 +0000
committerjsing <>2023-03-08 05:45:31 +0000
commitf59a5e932baaa204327818534b8c93267c20bed0 (patch)
tree96a3d2dbc6ef11df6851b53d3d2e1c46dd7f2328 /src/lib/libcrypto/ec/ec_asn1.c
parent49f24f2af100d1cc94534c31f0db0ac8072ee4ac (diff)
downloadopenbsd-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/ec_asn1.c')
-rw-r--r--src/lib/libcrypto/ec/ec_asn1.c10
1 files changed, 5 insertions, 5 deletions
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);