From 114ddebbf62601aaf6ed09bf87aec8b72402afcb Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 25 Feb 2015 14:49:46 -0500 Subject: [PATCH] Unexport EC_GROUP_copy. EC_GROUP_copy is an rather unfriendly function; it doesn't work if the groups have different[*] underlying EC_METHODs, but this notion is not exposed through the API. I found no callers of EC_GROUP_copy in external code. This leaves the precompute_mult functions as the remaining mutable API exposed through EC_GROUP. [*] Though, of the two EC_METHODs right now, simple.c is entirely unused. Change-Id: Iabb52518005250fb970e12b3b0ea78b4f6eff4a0 Reviewed-on: https://boringssl-review.googlesource.com/3631 Reviewed-by: Adam Langley --- crypto/ec/ec.c | 4 ++-- crypto/ec/internal.h | 1 + include/openssl/ec.h | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crypto/ec/ec.c b/crypto/ec/ec.c index ad47bb55..9a4a8388 100644 --- a/crypto/ec/ec.c +++ b/crypto/ec/ec.c @@ -426,7 +426,7 @@ void EC_GROUP_free(EC_GROUP *group) { OPENSSL_free(group); } -int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) { +int ec_group_copy(EC_GROUP *dest, const EC_GROUP *src) { if (dest->meth->group_copy == 0) { OPENSSL_PUT_ERROR(EC, EC_GROUP_copy, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; @@ -482,7 +482,7 @@ EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) { if (t == NULL) { return NULL; } - if (!EC_GROUP_copy(t, a)) { + if (!ec_group_copy(t, a)) { goto err; } diff --git a/crypto/ec/internal.h b/crypto/ec/internal.h index da116c4c..17f63ae2 100644 --- a/crypto/ec/internal.h +++ b/crypto/ec/internal.h @@ -250,6 +250,7 @@ struct ec_point_st { } /* EC_POINT */; EC_GROUP *ec_group_new(const EC_METHOD *meth); +int ec_group_copy(EC_GROUP *dest, const EC_GROUP *src); int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 318ce0f0..511cb2df 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -107,10 +107,6 @@ OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_by_curve_name(int nid); /* EC_GROUP_free frees |group| and the data that it points to. */ OPENSSL_EXPORT void EC_GROUP_free(EC_GROUP *group); -/* EC_GROUP_copy sets |*dest| equal to |*src|. It returns one on success and - * zero otherwise. */ -OPENSSL_EXPORT int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src); - /* EC_GROUP_dup returns a fresh |EC_GROUP| which is equal to |a| or NULL on * error. */ OPENSSL_EXPORT EC_GROUP *EC_GROUP_dup(const EC_GROUP *a);