### Changes between 1.1.1 and 3.0 [xx XXX xxxx]
+ * Deprecated EC_METHOD_get_field_type(). Applications should switch to
+ EC_GROUP_get_field_type().
+
+ *Billy Bob Brumley*
+
+ * Deprecated EC_GFp_simple_method(), EC_GFp_mont_method(),
+ EC_GF2m_simple_method(), EC_GFp_nist_method(), EC_GFp_nistp224_method()
+ EC_GFp_nistp256_method(), and EC_GFp_nistp521_method().
+ Applications should rely on the library automatically assigning a suitable
+ EC_METHOD internally upon EC_GROUP construction.
+
+ *Billy Bob Brumley*
+
+ * Deprecated EC_GROUP_new(), EC_GROUP_method_of(), and EC_POINT_method_of().
+ EC_METHOD is now an internal-only concept and a suitable EC_METHOD is
+ assigned internally without application intervention.
+ Users of EC_GROUP_new() should switch to a different suitable constructor.
+
+ *Billy Bob Brumley*
+
* Add CAdES-BES signature verification support, mostly derived
from ESSCertIDv2 TS (RFC 5816) contribution by Marek Klein.
size_t buf_len = 0, tmp_len = 0;
const EC_POINT *point;
int is_prime, len = 0;
- const EC_METHOD *meth = EC_GROUP_method_of(group);
if ((ec_p = BN_new()) == NULL
|| (ec_a = BN_new()) == NULL
goto end;
}
- is_prime = (EC_METHOD_get_field_type(meth) == NID_X9_62_prime_field);
+ is_prime = (EC_GROUP_get_field_type(group) == NID_X9_62_prime_field);
if (!is_prime) {
BIO_printf(bio_err, "Can only handle X9.62 prime fields\n");
goto end;
{
int i;
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
- NID_X9_62_characteristic_two_field)
+ if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field)
/* everything else is currently not supported */
return 0;
if (group == NULL)
return 0;
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
- NID_X9_62_characteristic_two_field
+ if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field
|| !((group->poly[0] != 0) && (group->poly[1] != 0)
&& (group->poly[2] == 0))) {
ECerr(EC_F_EC_GROUP_GET_TRINOMIAL_BASIS,
if (group == NULL)
return 0;
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
- NID_X9_62_characteristic_two_field
+ if (EC_GROUP_get_field_type(group) != NID_X9_62_characteristic_two_field
|| !((group->poly[0] != 0) && (group->poly[1] != 0)
&& (group->poly[2] != 0) && (group->poly[3] != 0)
&& (group->poly[4] == 0))) {
ASN1_OBJECT_free(field->fieldType);
ASN1_TYPE_free(field->p.other);
- nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
+ nid = EC_GROUP_get_field_type(group);
/* set OID for the field */
if ((field->fieldType = OBJ_nid2obj(nid)) == NULL) {
ECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_OBJ_LIB);
/* If no curve data curve method must handle everything */
if (curve.data == NULL)
- return EC_GROUP_new_ex(libctx,
+ return ec_group_new_ex(libctx,
curve.meth != NULL ? curve.meth() : NULL);
if ((ctx = BN_CTX_new_ex(libctx)) == NULL) {
if (curve.meth != 0) {
meth = curve.meth();
- if (((group = EC_GROUP_new_ex(libctx, meth)) == NULL) ||
+ if (((group = ec_group_new_ex(libctx, meth)) == NULL) ||
(!(group->meth->group_set_curve(group, p, a, b, ctx)))) {
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
unsigned char *param_bytes = NULL;
const EC_CURVE_DATA *data;
const EC_POINT *generator = NULL;
- const EC_METHOD *meth;
const BIGNUM *cofactor = NULL;
/* An array of BIGNUMs for (p, a, b, x, y, order) */
BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL};
- meth = EC_GROUP_method_of(group);
- if (meth == NULL)
- return -1;
/* Use the optional named curve nid as a search field */
nid = EC_GROUP_get_curve_name(group);
- field_type = EC_METHOD_get_field_type(meth);
+ field_type = EC_GROUP_get_field_type(group);
seed_len = EC_GROUP_get_seed_len(group);
seed = EC_GROUP_get0_seed(group);
cofactor = EC_GROUP_get0_cofactor(group);
meth = EC_GFp_mont_method();
#endif
- ret = EC_GROUP_new_ex(bn_get_lib_ctx(ctx), meth);
+ ret = ec_group_new_ex(bn_get_lib_ctx(ctx), meth);
if (ret == NULL)
return NULL;
meth = EC_GF2m_simple_method();
- ret = EC_GROUP_new_ex(bn_get_lib_ctx(ctx), meth);
+ ret = ec_group_new_ex(bn_get_lib_ctx(ctx), meth);
if (ret == NULL)
return NULL;
dest->libctx = src->libctx;
/* copy the parameters */
if (src->group != NULL) {
- const EC_METHOD *meth = EC_GROUP_method_of(src->group);
/* clear the old group */
EC_GROUP_free(dest->group);
- dest->group = EC_GROUP_new_ex(src->libctx, meth);
+ dest->group = ec_group_new_ex(src->libctx, src->group->meth);
if (dest->group == NULL)
return NULL;
if (!EC_GROUP_copy(dest->group, src->group))
if (!EC_POINT_get_affine_coordinates(key->group, key->pub_key, x, y, ctx))
goto err;
- if (EC_METHOD_get_field_type(key->group->meth) == NID_X9_62_prime_field) {
+ if (EC_GROUP_get_field_type(key->group) == NID_X9_62_prime_field) {
if (BN_is_negative(x)
|| BN_cmp(x, key->group->field) >= 0
|| BN_is_negative(y)
/* functions for EC_GROUP objects */
-EC_GROUP *EC_GROUP_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth)
+EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth)
{
EC_GROUP *ret;
return NULL;
}
-#ifndef FIPS_MODULE
+#ifndef OPENSSL_NO_DEPRECATED_3_0
+# ifndef FIPS_MODULE
EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
{
- return EC_GROUP_new_ex(NULL, meth);
+ return ec_group_new_ex(NULL, meth);
}
+# endif
#endif
void EC_pre_comp_free(EC_GROUP *group)
if (a == NULL)
return NULL;
- if ((t = EC_GROUP_new_ex(a->libctx, a->meth)) == NULL)
+ if ((t = ec_group_new_ex(a->libctx, a->meth)) == NULL)
return NULL;
if (!EC_GROUP_copy(t, a))
goto err;
return t;
}
+#ifndef OPENSSL_NO_DEPRECATED_3_0
const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group)
{
return group->meth;
{
return meth->field_type;
}
+#endif
static int ec_precompute_mont_data(EC_GROUP *);
return group->field;
}
+int EC_GROUP_get_field_type(const EC_GROUP *group)
+{
+ return group->meth->field_type;
+}
+
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
{
group->asn1_flag = flag;
#endif
/* compare the field types */
- if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=
- EC_METHOD_get_field_type(EC_GROUP_method_of(b)))
+ if (EC_GROUP_get_field_type(a) != EC_GROUP_get_field_type(b))
return 1;
/* compare the curve name (if present in both) */
if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) &&
return t;
}
+#ifndef OPENSSL_NO_DEPRECATED_3_0
const EC_METHOD *EC_POINT_method_of(const EC_POINT *point)
{
return point->meth;
}
+#endif
int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
{
/* Curve does not support signing operations */
#define EC_FLAGS_NO_SIGN 0x4
+#ifdef OPENSSL_NO_DEPRECATED_3_0
+typedef struct ec_method_st EC_METHOD;
+#endif
+
/*
* Structure details are not part of the exported interface, so all this may
* change in future versions.
#endif
int ec_group_simple_order_bits(const EC_GROUP *group);
+/**
+ * Creates a new EC_GROUP object
+ * \param libctx The associated library context or NULL for the default
+ * library context
+ * \param meth EC_METHOD to use
+ * \return newly created EC_GROUP object or NULL in case of an error.
+ */
+EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth);
+
#ifdef ECP_NISTZ256_ASM
/** Returns GFp methods using montgomery multiplication, with x86-64 optimized
* P256. See http://eprint.iacr.org/2013/816.
/* explicit parameters */
int is_char_two = 0;
point_conversion_form_t form;
- int tmp_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(x));
+ int tmp_nid = EC_GROUP_get_field_type(x);
if (tmp_nid == NID_X9_62_characteristic_two_field)
is_char_two = 1;
* https://www.openssl.org/source/license.html
*/
+/*
+ * EC_METHOD low level APIs are deprecated for public use, but still ok for
+ * internal use.
+ */
+#include "internal/deprecated.h"
+
#include <stdlib.h>
#include <string.h>
#include <openssl/err.h>
#include <openssl/ec.h>
+Deprecated since OpenSSL 3.0:
+
const EC_METHOD *EC_GFp_simple_method(void);
const EC_METHOD *EC_GFp_mont_method(void);
const EC_METHOD *EC_GFp_nist_method(void);
=head1 DESCRIPTION
+
+All const EC_METHOD *EC_GF* functions were deprecated in OpenSSL 3.0, since
+EC_METHOD is no longer a public concept.
+
The Elliptic Curve library provides a number of different implementations through a single common interface.
When constructing a curve using EC_GROUP_new (see L<EC_GROUP_new(3)>) an
implementation method must be provided. The functions described here all return a const pointer to an
optimised implementations for the NIST P224, P256 and P521 curves respectively. Note, however, that these
implementations are not available on all platforms.
-EC_METHOD_get_field_type identifies what type of field the EC_METHOD structure supports, which will be either
-F2^m or Fp. If the field type is Fp then the value B<NID_X9_62_prime_field> is returned. If the field type is
-F2^m then the value B<NID_X9_62_characteristic_two_field> is returned. These values are defined in the
-obj_mac.h header file.
+EC_METHOD_get_field_type() was deprecated in OpenSSL 3.0.
+Applications should use EC_GROUP_get_field_type() as a replacement (see L<EC_GROUP_copy(3)>).
=head1 RETURN VALUES
L<d2i_ECPKParameters(3)>,
L<BN_mod_mul_montgomery(3)>
+=head1 HISTORY
+
+EC_GFp_simple_method(), EC_GFp_mont_method(void),
+EC_GFp_nist_method(), EC_GFp_nistp224_method(),
+EC_GFp_nistp256_method(), EC_GFp_nistp521_method(),
+EC_GF2m_simple_method(), and EC_METHOD_get_field_type()
+were deprecated in OpenSSL 3.0.
+
=head1 COPYRIGHT
Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
- const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
-
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
const BIGNUM *order, const BIGNUM *cofactor);
const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
unsigned int *k2, unsigned int *k3);
+Deprecated since OpenSSL 3.0:
+
+ const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
+
=head1 DESCRIPTION
EC_GROUP_copy() copies the curve B<src> into B<dst>. Both B<src> and B<dst> must use the same EC_METHOD.
EC_GROUP object.
EC_GROUP_method_of() obtains the EC_METHOD of B<group>.
+This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.
EC_GROUP_set_generator() sets curve parameters that must be agreed by all participants using the curve. These
parameters include the B<generator>, the B<order> and the B<cofactor>. The B<generator> is a well defined point on the
EC_GROUP_set_seed() and passing a pointer to a memory block, along with the length of the seed. Again, the EC library will not use
this seed value, although it will be preserved in any ASN1 based communications.
-EC_GROUP_get_degree() gets the degree of the field. For Fp fields this will be the number of bits in p. For F2^m fields this will be
-the value m.
+EC_GROUP_get_degree() gets the degree of the field.
+For Fp fields this will be the number of bits in p.
+For F2^m fields this will be the value m.
+
+EC_GROUP_get_field_type() identifies what type of field the EC_GROUP structure supports,
+which will be either F2^m or Fp.
The function EC_GROUP_check_discriminant() calculates the discriminant for the curve and verifies that it is valid.
For a curve defined over Fp the discriminant is given by the formula 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is
EC_GROUP_get_degree() returns the degree for B<group> or 0 if the operation is not supported by the underlying group implementation.
+EC_GROUP_get_field_type() returns either B<NID_X9_62_prime_field> for prime curves
+or B<NID_X9_62_characteristic_two_field> for binary curves;
+these values are defined in the obj_mac.h header file.
+
EC_GROUP_check_named_curve() returns the nid of the matching named curve, otherwise it returns 0 for no match, or -1 on error.
EC_GROUP_get0_order() returns an internal pointer to the group order.
=head1 HISTORY
-The EC_GROUP_check_named_curve() function was added in OpenSSL 3.0.
+EC_GROUP_method_of() was deprecated in OpenSSL 3.0.
+
+EC_GROUP_check_named_curve() and EC_GROUP_get_field_type() were added in OpenSSL 3.0.
=head1 COPYRIGHT
EC_GROUP_get_ecparameters,
EC_GROUP_get_ecpkparameters,
-EC_GROUP_new_ex,
EC_GROUP_new,
EC_GROUP_new_from_ecparameters,
EC_GROUP_new_from_ecpkparameters,
#include <openssl/ec.h>
- EC_GROUP *EC_GROUP_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth);
- EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params)
EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params)
void EC_GROUP_free(EC_GROUP *group);
B<OPENSSL_API_COMPAT> with a suitable version value, see
L<openssl_user_macros(7)>:
+ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
void EC_GROUP_clear_free(EC_GROUP *group);
=head1 DESCRIPTION
B<irreducible polynomial>. All such curves with OpenSSL use a trinomial or a
pentanomial for this parameter.
-A new curve can be constructed by calling EC_GROUP_new_ex(), using the
+Although deprecated since OpenSSL 3.0 and should no longer be used,
+a new curve can be constructed by calling EC_GROUP_new(), using the
implementation provided by B<meth> (see L<EC_GFp_simple_method(3)>) and
associated with the library context B<ctx> (see L<OPENSSL_CTX(3)>).
The B<ctx> parameter may be NULL in which case the default library context is
used.
It is then necessary to call EC_GROUP_set_curve() to set the curve parameters.
+Applications should instead use one of the other EC_GROUP_new_* constructors.
+
EC_GROUP_new_from_ecparameters() will create a group from the
specified B<params> and
EC_GROUP_new_from_ecpkparameters() will create a group from the specific PK
B<params>.
-EC_GROUP_new() is the same as EC_GROUP_new_ex() except that the library context
-used is always the default library context.
-
EC_GROUP_set_curve() sets the curve parameters B<p>, B<a> and B<b>. For a curve
over Fp B<p> is the prime for the field. For a curve over F2^m B<p> represents
the irreducible polynomial - each bit represents a term in the polynomial.
=item *
-EC_GROUP_new_ex() and EC_GROUP_new_by_curve_name_ex() were added in OpenSSL 3.0.
+EC_GROUP_new() was deprecated in OpenSSL 3.0.
+
+EC_GROUP_new_by_curve_name_ex() was added in OpenSSL 3.0.
=item *
void EC_POINT_clear_free(EC_POINT *point);
int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
- const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,
const BIGNUM *x, const BIGNUM *y,
Deprecated since OpenSSL 3.0:
+ const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
EC_POINT *p,
const BIGNUM *x, const BIGNUM *y,
B<src> to the newly created B<EC_POINT> object.
EC_POINT_method_of() obtains the B<EC_METHOD> associated with B<point>.
+This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a
+public concept.
A valid point on a curve is the special point at infinity. A point is set to
be at infinity by calling EC_POINT_set_to_infinity().
=head1 HISTORY
+EC_POINT_method_of(),
EC_POINT_set_Jprojective_coordinates_GFp(),
EC_POINT_get_Jprojective_coordinates_GFp(),
EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(),
POINT_CONVERSION_HYBRID = 6
} point_conversion_form_t;
+# ifndef OPENSSL_NO_DEPRECATED_3_0
typedef struct ec_method_st EC_METHOD;
+# endif
typedef struct ec_group_st EC_GROUP;
typedef struct ec_point_st EC_POINT;
typedef struct ecpk_parameters_st ECPKPARAMETERS;
* optimized methods.
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_simple_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_simple_method(void))
/** Returns GFp methods using montgomery multiplication.
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_mont_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_mont_method(void))
/** Returns GFp methods using optimized methods for NIST recommended curves
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_nist_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_nist_method(void))
# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
/** Returns 64-bit optimized methods for nistp224
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_nistp224_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_nistp224_method(void))
/** Returns 64-bit optimized methods for nistp256
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_nistp256_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_nistp256_method(void))
/** Returns 64-bit optimized methods for nistp521
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GFp_nistp521_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GFp_nistp521_method(void))
# endif
# ifndef OPENSSL_NO_EC2M
/** Returns the basic GF2m ec method
* \return EC_METHOD object
*/
-const EC_METHOD *EC_GF2m_simple_method(void);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GF2m_simple_method(void))
# endif
/**
* Creates a new EC_GROUP object
- * \param libctx The associated library context or NULL for the default
- * library context
* \param meth EC_METHOD to use
* \return newly created EC_GROUP object or NULL in case of an error.
*/
-EC_GROUP *EC_GROUP_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth);
-
-/**
- * Creates a new EC_GROUP object. Same as EC_GROUP_new_ex with NULL for the
- * library context.
- * \param meth EC_METHOD to use
- * \return newly created EC_GROUP object or NULL in case of an error.
- */
-EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
+DEPRECATEDIN_3_0(EC_GROUP *EC_GROUP_new(const EC_METHOD *meth))
/** Frees a EC_GROUP object
* \param group EC_GROUP object to be freed.
* \param group EC_GROUP object
* \return EC_METHOD used in this EC_GROUP object.
*/
-const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group))
/** Returns the field type of the EC_METHOD.
* \param meth EC_METHOD object
* \return NID of the underlying field type OID.
*/
-int EC_METHOD_get_field_type(const EC_METHOD *meth);
+DEPRECATEDIN_3_0(int EC_METHOD_get_field_type(const EC_METHOD *meth))
/** Sets the generator and its order/cofactor of a EC_GROUP object.
* \param group EC_GROUP object
*/
const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group);
+/** Returns the field type of the EC_GROUP.
+ * \param group EC_GROUP object
+ * \return NID of the underlying field type OID.
+ */
+int EC_GROUP_get_field_type(const EC_GROUP *group);
+
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
* \param point EC_POINT object
* \return the EC_METHOD used
*/
-const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
+DEPRECATEDIN_3_0(const EC_METHOD *EC_POINT_method_of(const EC_POINT *point))
/** Sets a point to infinity (neutral element)
* \param group underlying EC_GROUP object
*/
return 1;
} else {
- int field_type = EC_METHOD_get_field_type(EC_GROUP_method_of(grp));
+ int field_type = EC_GROUP_get_field_type(grp);
if (field_type == NID_X9_62_prime_field)
comp_id = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
{
BN_CTX *ctx = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL, *scalar3 = NULL;
- EC_GROUP *group = NULL, *tmp = NULL;
- EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL,
- *P_256 = NULL, *P_384 = NULL, *P_521 = NULL;
+ EC_GROUP *group = NULL;
EC_POINT *P = NULL, *Q = NULL, *R = NULL;
BIGNUM *x = NULL, *y = NULL, *z = NULL, *yplusone = NULL;
# ifndef OPENSSL_NO_DEPRECATED_3_0
|| !TEST_true(BN_hex2bn(&p, "17"))
|| !TEST_true(BN_hex2bn(&a, "1"))
|| !TEST_true(BN_hex2bn(&b, "1"))
- /*
- * applications should use EC_GROUP_new_curve_GFp so
- * that the library gets to choose the EC_METHOD
- */
- || !TEST_ptr(group = EC_GROUP_new(EC_GFp_mont_method()))
- || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
- || !TEST_ptr(tmp = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(tmp, group)))
- goto err;
- EC_GROUP_free(group);
- group = tmp;
- tmp = NULL;
-
- if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
+ || !TEST_ptr(group = EC_GROUP_new_curve_GFp(p, a, b, ctx))
+ || !TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
goto err;
TEST_info("Curve defined by Weierstrass equation");
|| !TEST_BN_eq(y, z)
|| !TEST_int_eq(EC_GROUP_get_degree(group), 160)
|| !group_order_tests(group)
- || !TEST_ptr(P_160 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_160, group))
/* Curve P-192 (FIPS PUB 186-2, App. 6) */
ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 192)
|| !group_order_tests(group)
- || !TEST_ptr(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_192, group))
/* Curve P-224 (FIPS PUB 186-2, App. 6) */
ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 224)
|| !group_order_tests(group)
- || !TEST_ptr(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_224, group))
/* Curve P-256 (FIPS PUB 186-2, App. 6) */
ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 256)
|| !group_order_tests(group)
- || !TEST_ptr(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_256, group))
/* Curve P-384 (FIPS PUB 186-2, App. 6) */
ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 384)
|| !group_order_tests(group)
- || !TEST_ptr(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_384, group))
/* Curve P-521 (FIPS PUB 186-2, App. 6) */
|| !TEST_true(BN_hex2bn(&p, "1FF"
ctx))
|| !TEST_int_eq(EC_GROUP_get_degree(group), 521)
|| !group_order_tests(group)
- || !TEST_ptr(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(P_521, group))
/* more tests using the last curve */
BN_free(a);
BN_free(b);
EC_GROUP_free(group);
- EC_GROUP_free(tmp);
EC_POINT_free(P);
EC_POINT_free(Q);
EC_POINT_free(R);
BN_free(z);
BN_free(yplusone);
BN_free(scalar3);
-
- EC_GROUP_free(P_160);
- EC_GROUP_free(P_192);
- EC_GROUP_free(P_224);
- EC_GROUP_free(P_256);
- EC_GROUP_free(P_384);
- EC_GROUP_free(P_521);
return r;
}
BN_CTX *ctx = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL;
BIGNUM *x = NULL, *y = NULL, *z = NULL, *cof = NULL, *yplusone = NULL;
- EC_GROUP *group = NULL, *variable = NULL;
+ EC_GROUP *group = NULL;
EC_POINT *P = NULL, *Q = NULL, *R = NULL;
# ifndef OPENSSL_NO_DEPRECATED_3_0
const EC_POINT *points[3];
|| !TEST_true(BN_hex2bn(&p, test->p))
|| !TEST_true(BN_hex2bn(&a, test->a))
|| !TEST_true(BN_hex2bn(&b, test->b))
- || !TEST_true(group = EC_GROUP_new(EC_GF2m_simple_method()))
- || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
+ || !TEST_true(group = EC_GROUP_new_curve_GF2m(p, a, b, ctx))
|| !TEST_ptr(P = EC_POINT_new(group))
|| !TEST_ptr(Q = EC_POINT_new(group))
|| !TEST_ptr(R = EC_POINT_new(group))
# endif
if (!TEST_int_eq(EC_GROUP_get_degree(group), test->degree)
- || !group_order_tests(group)
- || !TEST_ptr(variable = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(variable, group)))
+ || !group_order_tests(group))
goto err;
/* more tests using the last curve */
EC_POINT_free(Q);
EC_POINT_free(R);
EC_GROUP_free(group);
- EC_GROUP_free(variable);
return r;
}
{
BN_CTX *ctx = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL;
- EC_GROUP *group = NULL, *tmp = NULL;
+ EC_GROUP *group = NULL;
EC_POINT *P = NULL, *Q = NULL, *R = NULL;
BIGNUM *x = NULL, *y = NULL, *z = NULL, *cof = NULL, *yplusone = NULL;
unsigned char buf[100];
|| !TEST_true(BN_hex2bn(&b, "1")))
goto err;
- group = EC_GROUP_new(EC_GF2m_simple_method()); /* applications should use
- * EC_GROUP_new_curve_GF2m
- * so that the library gets
- * to choose the EC_METHOD */
- if (!TEST_ptr(group)
- || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx))
- || !TEST_ptr(tmp = EC_GROUP_new(EC_GROUP_method_of(group)))
- || !TEST_true(EC_GROUP_copy(tmp, group)))
- goto err;
- EC_GROUP_free(group);
- group = tmp;
- tmp = NULL;
-
- if (!TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
+ if (!TEST_ptr(group = EC_GROUP_new_curve_GF2m(p, a, b, ctx))
+ || !TEST_true(EC_GROUP_get_curve(group, p, a, b, ctx)))
goto err;
TEST_info("Curve defined by Weierstrass equation");
BN_free(a);
BN_free(b);
EC_GROUP_free(group);
- EC_GROUP_free(tmp);
EC_POINT_free(P);
EC_POINT_free(Q);
EC_POINT_free(R);
return r;
}
-# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
/*
- * nistp_test_params contains magic numbers for testing our optimized
- * implementations of several NIST curves with characteristic > 3.
+ * nistp_test_params contains magic numbers for testing
+ * several NIST curves with characteristic > 3.
*/
struct nistp_test_params {
- const EC_METHOD *(*meth) (void);
+ const int nid;
int degree;
/*
* Qx, Qy and D are taken from
static const struct nistp_test_params nistp_tests_params[] = {
{
/* P-224 */
- EC_GFp_nistp224_method,
+ NID_secp224r1,
224,
/* p */
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001",
},
{
/* P-256 */
- EC_GFp_nistp256_method,
+ NID_X9_62_prime256v1,
256,
/* p */
"ffffffff00000001000000000000000000000000ffffffffffffffffffffffff",
},
{
/* P-521 */
- EC_GFp_nistp521_method,
+ NID_secp521r1,
521,
/* p */
"1ff"
|| !TEST_ptr(order = BN_new())
|| !TEST_ptr(yplusone = BN_new())
- || !TEST_ptr(NISTP = EC_GROUP_new(test->meth()))
+ || !TEST_ptr(NISTP = EC_GROUP_new_by_curve_name(test->nid))
|| !TEST_true(BN_hex2bn(&p, test->p))
|| !TEST_int_eq(1, BN_check_prime(p, ctx, NULL))
|| !TEST_true(BN_hex2bn(&a, test->a))
|| !TEST_false(EC_GROUP_have_precompute_mult(NISTP))
/* now repeat all tests with precomputation */
|| !TEST_true(EC_GROUP_precompute_mult(NISTP, ctx))
- || !TEST_true(EC_GROUP_have_precompute_mult(NISTP))
# endif
)
goto err;
|| !TEST_int_eq(0, EC_POINT_cmp(NISTP, Q, G, ctx)))
goto err;
- r = group_order_tests(NISTP);
+ r = 1;
err:
EC_GROUP_free(NISTP);
EC_POINT_free(G);
BN_CTX_free(ctx);
return r;
}
-# endif
static const unsigned char p521_named[] = {
0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x23,
/* Determine if the built-in curve has a seed field set */
has_seed = (EC_GROUP_get_seed_len(group) > 0);
- field_nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));
+ field_nid = EC_GROUP_get_field_type(group);
if (field_nid == NID_X9_62_characteristic_two_field) {
if (!TEST_ptr(other_p = BN_dup(group_p))
|| !TEST_true(BN_lshift1(other_p, other_p)))
*/
static int cardinality_test(int n)
{
- int ret = 0;
+ int ret = 0, is_binary = 0;
int nid = curves[n].nid;
BN_CTX *ctx = NULL;
EC_GROUP *g1 = NULL, *g2 = NULL;
TEST_info("Curve %s cardinality test", OBJ_nid2sn(nid));
if (!TEST_ptr(ctx = BN_CTX_new())
- || !TEST_ptr(g1 = EC_GROUP_new_by_curve_name(nid))
- || !TEST_ptr(g2 = EC_GROUP_new(EC_GROUP_method_of(g1)))) {
- EC_GROUP_free(g1);
- EC_GROUP_free(g2);
+ || !TEST_ptr(g1 = EC_GROUP_new_by_curve_name(nid))) {
BN_CTX_free(ctx);
return 0;
}
+ is_binary = (EC_GROUP_get_field_type(g1) == NID_X9_62_characteristic_two_field);
+
BN_CTX_start(ctx);
g1_p = BN_CTX_get(ctx);
g1_a = BN_CTX_get(ctx);
|| !TEST_true(BN_copy(g1_order, EC_GROUP_get0_order(g1)))
|| !TEST_true(EC_GROUP_get_cofactor(g1, g1_cf, ctx))
/* construct g2 manually with g1 parameters */
- || !TEST_true(EC_GROUP_set_curve(g2, g1_p, g1_a, g1_b, ctx))
+# ifndef OPENSSL_NO_EC2M
+ || !TEST_ptr(g2 = (is_binary) ?
+ EC_GROUP_new_curve_GF2m(g1_p, g1_a, g1_b, ctx) :
+ EC_GROUP_new_curve_GFp(g1_p, g1_a, g1_b, ctx))
+# else
+ || !TEST_int_eq(0, is_binary)
+ || !TEST_ptr(g2 = EC_GROUP_new_curve_GFp(g1_p, g1_a, g1_b, ctx))
+# endif
|| !TEST_ptr(g2_gen = EC_POINT_new(g2))
|| !TEST_true(EC_POINT_set_affine_coordinates(g2, g2_gen, g1_x, g1_y, ctx))
/* pass NULL cofactor: lib should compute it */
int ret = 0, type = 0;
const EC_POINT *pub = NULL;
const EC_GROUP *group = NULL;
- const EC_METHOD *meth = NULL;
const BIGNUM *field = NULL;
BIGNUM *x = NULL, *y = NULL;
EC_KEY *key = NULL;
|| !TEST_ptr(y = BN_new())
|| !TEST_ptr(key = EC_KEY_new_by_curve_name(curves[id].nid))
|| !TEST_ptr(group = EC_KEY_get0_group(key))
- || !TEST_ptr(meth = EC_GROUP_method_of(group))
|| !TEST_ptr(field = EC_GROUP_get0_field(group))
|| !TEST_int_gt(EC_KEY_generate_key(key), 0)
|| !TEST_int_gt(EC_KEY_check_key(key), 0)
* Make the public point out of range by adding the field (which will still
* be the same point on the curve). The add is different for char2 fields.
*/
- type = EC_METHOD_get_field_type(meth);
+ type = EC_GROUP_get_field_type(group);
#ifndef OPENSSL_NO_EC2M
if (type == NID_X9_62_characteristic_two_field) {
/* test for binary curves */
ADD_TEST(char2_field_tests);
ADD_ALL_TESTS(char2_curve_test, OSSL_NELEM(char2_curve_tests));
# endif
-# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
ADD_ALL_TESTS(nistp_single_test, OSSL_NELEM(nistp_tests_params));
-# endif
ADD_ALL_TESTS(internal_curve_test, crv_len);
ADD_ALL_TESTS(internal_curve_test_method, crv_len);
ADD_TEST(group_field_test);
EVP_PKEY_meth_set_verify_recover 41 3_0_0 EXIST::FUNCTION:
UI_set_method 42 3_0_0 EXIST::FUNCTION:
PKCS7_ISSUER_AND_SERIAL_it 43 3_0_0 EXIST::FUNCTION:
-EC_GROUP_method_of 44 3_0_0 EXIST::FUNCTION:EC
+EC_GROUP_method_of 44 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
RSA_blinding_on 45 3_0_0 EXIST::FUNCTION:RSA
X509_get0_signature 47 3_0_0 EXIST::FUNCTION:
X509_REVOKED_get0_extensions 48 3_0_0 EXIST::FUNCTION:
ENGINE_register_DSA 1208 3_0_0 EXIST::FUNCTION:ENGINE
OPENSSL_LH_node_stats 1209 3_0_0 EXIST::FUNCTION:STDIO
X509_policy_tree_free 1210 3_0_0 EXIST::FUNCTION:
-EC_GFp_simple_method 1211 3_0_0 EXIST::FUNCTION:EC
+EC_GFp_simple_method 1211 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
X509_it 1212 3_0_0 EXIST::FUNCTION:
d2i_PROXY_POLICY 1213 3_0_0 EXIST::FUNCTION:
MDC2_Update 1214 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,MDC2
EVP_PKEY_asn1_find_str 1224 3_0_0 EXIST::FUNCTION:
X509_VERIFY_PARAM_get_flags 1225 3_0_0 EXIST::FUNCTION:
OPENSSL_DIR_end 1226 3_0_0 EXIST::FUNCTION:
-EC_GROUP_new 1227 3_0_0 EXIST::FUNCTION:EC
+EC_GROUP_new 1227 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
CMS_SignerInfo_get0_pkey_ctx 1228 3_0_0 EXIST::FUNCTION:CMS
d2i_ASN1_PRINTABLESTRING 1229 3_0_0 EXIST::FUNCTION:
CMS_RecipientInfo_ktri_cert_cmp 1230 3_0_0 EXIST::FUNCTION:CMS
OPENSSL_sk_set 2162 3_0_0 EXIST::FUNCTION:
OCSP_request_sign 2163 3_0_0 EXIST::FUNCTION:OCSP
BN_GF2m_mod_solve_quad 2164 3_0_0 EXIST::FUNCTION:EC2M
-EC_POINT_method_of 2165 3_0_0 EXIST::FUNCTION:EC
+EC_POINT_method_of 2165 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
PKCS7_ENCRYPT_it 2166 3_0_0 EXIST::FUNCTION:
AUTHORITY_INFO_ACCESS_it 2167 3_0_0 EXIST::FUNCTION:
X509_EXTENSION_create_by_NID 2168 3_0_0 EXIST::FUNCTION:
OTHERNAME_new 2231 3_0_0 EXIST::FUNCTION:
BN_rshift 2232 3_0_0 EXIST::FUNCTION:
i2d_GENERAL_NAMES 2233 3_0_0 EXIST::FUNCTION:
-EC_METHOD_get_field_type 2234 3_0_0 EXIST::FUNCTION:EC
+EC_METHOD_get_field_type 2234 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
ENGINE_set_name 2235 3_0_0 EXIST::FUNCTION:ENGINE
TS_TST_INFO_get_policy_id 2236 3_0_0 EXIST::FUNCTION:TS
PKCS7_SIGNER_INFO_set 2237 3_0_0 EXIST::FUNCTION:
EVP_aes_128_ofb 2663 3_0_0 EXIST::FUNCTION:
CMS_data 2664 3_0_0 EXIST::FUNCTION:CMS
X509_load_cert_file 2665 3_0_0 EXIST::FUNCTION:
-EC_GFp_nistp521_method 2667 3_0_0 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
+EC_GFp_nistp521_method 2667 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC,EC_NISTP_64_GCC_128
ECDSA_SIG_free 2668 3_0_0 EXIST::FUNCTION:EC
d2i_PKCS12_BAGS 2669 3_0_0 EXIST::FUNCTION:
RSA_public_encrypt 2670 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,RSA
ASN1_TIME_it 2803 3_0_0 EXIST::FUNCTION:
ENGINE_get_static_state 2804 3_0_0 EXIST::FUNCTION:ENGINE
EC_KEY_set_asn1_flag 2805 3_0_0 EXIST::FUNCTION:EC
-EC_GFp_mont_method 2806 3_0_0 EXIST::FUNCTION:EC
+EC_GFp_mont_method 2806 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
OPENSSL_asc2uni 2807 3_0_0 EXIST::FUNCTION:
TS_REQ_new 2808 3_0_0 EXIST::FUNCTION:TS
ENGINE_register_all_DH 2809 3_0_0 EXIST::FUNCTION:ENGINE
d2i_X509_CRL_INFO 2820 3_0_0 EXIST::FUNCTION:
X509_CRL_get_issuer 2821 3_0_0 EXIST::FUNCTION:
d2i_SCT_LIST 2822 3_0_0 EXIST::FUNCTION:CT
-EC_GFp_nist_method 2823 3_0_0 EXIST::FUNCTION:EC
+EC_GFp_nist_method 2823 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
SCT_free 2824 3_0_0 EXIST::FUNCTION:CT
TS_TST_INFO_get_msg_imprint 2825 3_0_0 EXIST::FUNCTION:TS
X509v3_addr_add_range 2826 3_0_0 EXIST::FUNCTION:RFC3779
EVP_PKEY_asn1_new 2862 3_0_0 EXIST::FUNCTION:
BIO_socket_nbio 2863 3_0_0 EXIST::FUNCTION:SOCK
EVP_CIPHER_set_asn1_iv 2864 3_0_0 EXIST::FUNCTION:
-EC_GFp_nistp224_method 2865 3_0_0 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
+EC_GFp_nistp224_method 2865 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC,EC_NISTP_64_GCC_128
BN_swap 2866 3_0_0 EXIST::FUNCTION:
d2i_ECParameters 2867 3_0_0 EXIST::FUNCTION:EC
X509_NAME_add_entry_by_OBJ 2868 3_0_0 EXIST::FUNCTION:
ENGINE_load_private_key 3078 3_0_0 EXIST::FUNCTION:ENGINE
GENERAL_NAMES_new 3079 3_0_0 EXIST::FUNCTION:
i2d_POLICYQUALINFO 3080 3_0_0 EXIST::FUNCTION:
-EC_GF2m_simple_method 3081 3_0_0 EXIST::FUNCTION:EC,EC2M
+EC_GF2m_simple_method 3081 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC,EC2M
RSA_get_method 3082 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,RSA
d2i_ASRange 3083 3_0_0 EXIST::FUNCTION:RFC3779
CMS_ContentInfo_new 3084 3_0_0 EXIST::FUNCTION:CMS
OCSP_RESPONSE_print 3447 3_0_0 EXIST::FUNCTION:OCSP
BN_get_rfc3526_prime_2048 3448 3_0_0 EXIST::FUNCTION:DH
BIO_new_bio_pair 3449 3_0_0 EXIST::FUNCTION:
-EC_GFp_nistp256_method 3450 3_0_0 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
+EC_GFp_nistp256_method 3450 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,EC,EC_NISTP_64_GCC_128
BIO_method_type 3451 3_0_0 EXIST::FUNCTION:
ECPKParameters_print 3452 3_0_0 EXIST::FUNCTION:EC
EVP_rc4 3453 3_0_0 EXIST::FUNCTION:RC4
ERR_vset_error ? 3_0_0 EXIST::FUNCTION:
X509_get0_authority_issuer ? 3_0_0 EXIST::FUNCTION:
X509_get0_authority_serial ? 3_0_0 EXIST::FUNCTION:
-EC_GROUP_new_ex ? 3_0_0 EXIST::FUNCTION:EC
EC_GROUP_new_by_curve_name_ex ? 3_0_0 EXIST::FUNCTION:EC
EC_KEY_new_ex ? 3_0_0 EXIST::FUNCTION:EC
EC_KEY_new_by_curve_name_ex ? 3_0_0 EXIST::FUNCTION:EC
EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md ? 3_0_0 EXIST::FUNCTION:RSA
EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name ? 3_0_0 EXIST::FUNCTION:RSA
OSSL_PROVIDER_do_all ? 3_0_0 EXIST::FUNCTION:
+EC_GROUP_get_field_type ? 3_0_0 EXIST::FUNCTION:EC
X509_PUBKEY_eq ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_eq ? 3_0_0 EXIST::FUNCTION:
EVP_PKEY_parameters_eq ? 3_0_0 EXIST::FUNCTION: