Fold EC_POINT_clear_free into EC_POINT_free.

All frees zero memory now.

Change-Id: I5b04a0d14f38d5a7422e148d077fcba85a593594
Reviewed-on: https://boringssl-review.googlesource.com/22225
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2017-10-26 21:13:16 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent ed84291188
commit d24fd47ff4
5 changed files with 5 additions and 21 deletions

View File

@ -628,15 +628,7 @@ void EC_POINT_free(EC_POINT *point) {
OPENSSL_free(point);
}
void EC_POINT_clear_free(EC_POINT *point) {
if (!point) {
return;
}
ec_GFp_simple_point_clear_finish(point);
OPENSSL_free(point);
}
void EC_POINT_clear_free(EC_POINT *point) { EC_POINT_free(point); }
int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) {
if (dest->meth != src->meth) {

View File

@ -166,7 +166,6 @@ int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
unsigned ec_GFp_simple_group_get_degree(const EC_GROUP *);
int ec_GFp_simple_point_init(EC_POINT *);
void ec_GFp_simple_point_finish(EC_POINT *);
void ec_GFp_simple_point_clear_finish(EC_POINT *);
int ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *);
int ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *);
int ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,

View File

@ -249,12 +249,6 @@ void ec_GFp_simple_point_finish(EC_POINT *point) {
BN_free(&point->Z);
}
void ec_GFp_simple_point_clear_finish(EC_POINT *point) {
BN_clear_free(&point->X);
BN_clear_free(&point->Y);
BN_clear_free(&point->Z);
}
int ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) {
if (!BN_copy(&dest->X, &src->X) ||
!BN_copy(&dest->Y, &src->Y) ||

View File

@ -446,7 +446,7 @@ err:
}
if (val != NULL) {
for (i = 0; i < num_val; i++) {
EC_POINT_clear_free(val[i]);
EC_POINT_free(val[i]);
}
OPENSSL_free(val);

View File

@ -162,10 +162,6 @@ OPENSSL_EXPORT EC_POINT *EC_POINT_new(const EC_GROUP *group);
// EC_POINT_free frees |point| and the data that it points to.
OPENSSL_EXPORT void EC_POINT_free(EC_POINT *point);
// EC_POINT_clear_free clears the data that |point| points to, frees it and
// then frees |point| itself.
OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point);
// EC_POINT_copy sets |*dest| equal to |*src|. It returns one on success and
// zero otherwise.
OPENSSL_EXPORT int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src);
@ -350,6 +346,9 @@ typedef struct {
OPENSSL_EXPORT size_t EC_get_builtin_curves(EC_builtin_curve *out_curves,
size_t max_num_curves);
// EC_POINT_clear_free calls |EC_POINT_free|.
OPENSSL_EXPORT void EC_POINT_clear_free(EC_POINT *point);
// Old code expects to get EC_KEY from ec.h.
#include <openssl/ec_key.h>