Remove EC_GROUP_new_arbitrary. The Conscrypt revert cycled in long ago. Change-Id: If3cdb211d7347dca88bd70bdc643f80b19a7e528 Reviewed-on: https://boringssl-review.googlesource.com/8306 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/ec/ec.c b/crypto/ec/ec.c index 8f3fa6e..1d1ebb6 100644 --- a/crypto/ec/ec.c +++ b/crypto/ec/ec.c
@@ -404,39 +404,6 @@ BN_copy(&group->cofactor, cofactor); } -EC_GROUP *EC_GROUP_new_arbitrary(const BIGNUM *p, const BIGNUM *a, - const BIGNUM *b, const BIGNUM *gx, - const BIGNUM *gy, const BIGNUM *order, - const BIGNUM *cofactor) { - BN_CTX *ctx = BN_CTX_new(); - if (ctx == NULL) { - return NULL; - } - - EC_POINT *generator = NULL; - EC_GROUP *ret = EC_GROUP_new_curve_GFp(p, a, b, ctx); - if (ret == NULL) { - goto err; - } - - generator = EC_POINT_new(ret); - if (generator == NULL || - !EC_POINT_set_affine_coordinates_GFp(ret, generator, gx, gy, ctx) || - !EC_GROUP_set_generator(ret, generator, order, cofactor)) { - goto err; - } - - EC_POINT_free(generator); - BN_CTX_free(ctx); - return ret; - -err: - EC_POINT_free(generator); - EC_GROUP_free(ret); - BN_CTX_free(ctx); - return NULL; -} - static EC_GROUP *ec_group_new_from_data(unsigned built_in_index) { const struct built_in_curve *curve = &OPENSSL_built_in_curves[built_in_index]; EC_GROUP *group = NULL;
diff --git a/crypto/ec/ec_test.cc b/crypto/ec/ec_test.cc index ce9d99f..23befeb 100644 --- a/crypto/ec/ec_test.cc +++ b/crypto/ec/ec_test.cc
@@ -404,37 +404,6 @@ return false; } - // Repeat the process for |EC_GROUP_new_arbitrary|. - group.reset(EC_GROUP_new_arbitrary(p.get(), a.get(), b.get(), gx.get(), - gy.get(), order.get(), cofactor.get())); - if (!group) { - return false; - } - - // |group| should not have a curve name. - if (EC_GROUP_get_curve_name(group.get()) != NID_undef) { - return false; - } - - // Copy |key| to |key2| using |group|. - key2.reset(EC_KEY_new()); - point.reset(EC_POINT_new(group.get())); - if (!key2 || !point || - !EC_KEY_set_group(key2.get(), group.get()) || - !EC_KEY_set_private_key(key2.get(), EC_KEY_get0_private_key(key.get())) || - !EC_POINT_set_affine_coordinates_GFp(group.get(), point.get(), x.get(), - y.get(), nullptr) || - !EC_KEY_set_public_key(key2.get(), point.get())) { - fprintf(stderr, "Could not copy key.\n"); - return false; - } - - // The key must be valid according to the new group too. - if (!EC_KEY_check_key(key2.get())) { - fprintf(stderr, "Copied key is not valid.\n"); - return false; - } - return true; }
diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 143aa96..05218f3 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h
@@ -315,15 +315,6 @@ const BIGNUM *order, const BIGNUM *cofactor); -/* EC_GROUP_new_arbitrary calls |EC_GROUP_new_curve_GFp| and - * |EC_GROUP_set_generator|. - * - * TODO(davidben): Remove this once - * https://android-review.googlesource.com/#/c/207990/ has cycled in. */ -OPENSSL_EXPORT EC_GROUP *EC_GROUP_new_arbitrary( - const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, const BIGNUM *gx, - const BIGNUM *gy, const BIGNUM *order, const BIGNUM *cofactor); - /* EC_GROUP_get_order sets |*order| to the order of |group|, if it's not * NULL. It returns one on success and zero otherwise. |ctx| is ignored. Use * |EC_GROUP_get0_order| instead. */