Fix external symbols related to ec & sm2 keys

Partial fix for #12964

This adds ossl_ names for the following symbols:

ec_*, ecx_*, ecdh_*, ecdsa_*, sm2_*

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14231)
master
Shane Lontis 2 years ago
parent 5af02212a5
commit 32ab57cbb4

@ -36,10 +36,10 @@
* the same method, but claim no priority date earlier than July 29, 1994
* (and additionally fail to cite the EUROCRYPT '92 publication as prior art).
*/
int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
EC_POINT *point,
const BIGNUM *x_, int y_bit,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
EC_POINT *point,
const BIGNUM *x_, int y_bit,
BN_CTX *ctx)
{
BIGNUM *tmp, *x, *y, *z;
int ret = 0, z0;
@ -122,9 +122,10 @@ int ec_GF2m_simple_set_compressed_coordinates(const EC_GROUP *group,
* length will be returned. If the length len of buf is smaller than required
* an error will be returned.
*/
size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *ctx)
size_t ossl_ec_GF2m_simple_point2oct(const EC_GROUP *group,
const EC_POINT *point,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *ctx)
{
size_t ret;
int used_ctx = 0;
@ -252,9 +253,9 @@ size_t ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,
* Converts an octet string representation to an EC_POINT. Note that the
* simple implementation only uses affine coordinates.
*/
int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
const unsigned char *buf, size_t len,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
const unsigned char *buf, size_t len,
BN_CTX *ctx)
{
point_conversion_form_t form;
int y_bit, m;

@ -25,7 +25,7 @@
* Initialize a GF(2^m)-based EC_GROUP structure. Note that all other members
* are handled by EC_GROUP_new.
*/
int ec_GF2m_simple_group_init(EC_GROUP *group)
int ossl_ec_GF2m_simple_group_init(EC_GROUP *group)
{
group->field = BN_new();
group->a = BN_new();
@ -44,7 +44,7 @@ int ec_GF2m_simple_group_init(EC_GROUP *group)
* Free a GF(2^m)-based EC_GROUP structure. Note that all other members are
* handled by EC_GROUP_free.
*/
void ec_GF2m_simple_group_finish(EC_GROUP *group)
void ossl_ec_GF2m_simple_group_finish(EC_GROUP *group)
{
BN_free(group->field);
BN_free(group->a);
@ -55,7 +55,7 @@ void ec_GF2m_simple_group_finish(EC_GROUP *group)
* Clear and free a GF(2^m)-based EC_GROUP structure. Note that all other
* members are handled by EC_GROUP_clear_free.
*/
void ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
void ossl_ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
{
BN_clear_free(group->field);
BN_clear_free(group->a);
@ -72,7 +72,7 @@ void ec_GF2m_simple_group_clear_finish(EC_GROUP *group)
* Copy a GF(2^m)-based EC_GROUP structure. Note that all other members are
* handled by EC_GROUP_copy.
*/
int ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
int ossl_ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
{
if (!BN_copy(dest->field, src->field))
return 0;
@ -98,9 +98,9 @@ int ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
}
/* Set the curve parameters of an EC_GROUP structure. */
int ec_GF2m_simple_group_set_curve(EC_GROUP *group,
const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_group_set_curve(EC_GROUP *group,
const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *ctx)
{
int ret = 0, i;
@ -138,8 +138,8 @@ int ec_GF2m_simple_group_set_curve(EC_GROUP *group,
* Get the curve parameters of an EC_GROUP structure. If p, a, or b are NULL
* then there values will not be set but the method will return with success.
*/
int ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p,
BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p,
BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
{
int ret = 0;
@ -168,7 +168,7 @@ int ec_GF2m_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p,
* Gets the degree of the field. For a curve over GF(2^m) this is the value
* m.
*/
int ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
int ossl_ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
{
return BN_num_bits(group->field) - 1;
}
@ -177,8 +177,8 @@ int ec_GF2m_simple_group_get_degree(const EC_GROUP *group)
* Checks the discriminant of the curve. y^2 + x*y = x^3 + a*x^2 + b is an
* elliptic curve <=> b != 0 (mod p)
*/
int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
BN_CTX *ctx)
{
int ret = 0;
BIGNUM *b;
@ -219,7 +219,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
}
/* Initializes an EC_POINT. */
int ec_GF2m_simple_point_init(EC_POINT *point)
int ossl_ec_GF2m_simple_point_init(EC_POINT *point)
{
point->X = BN_new();
point->Y = BN_new();
@ -235,7 +235,7 @@ int ec_GF2m_simple_point_init(EC_POINT *point)
}
/* Frees an EC_POINT. */
void ec_GF2m_simple_point_finish(EC_POINT *point)
void ossl_ec_GF2m_simple_point_finish(EC_POINT *point)
{
BN_free(point->X);
BN_free(point->Y);
@ -243,7 +243,7 @@ void ec_GF2m_simple_point_finish(EC_POINT *point)
}
/* Clears and frees an EC_POINT. */
void ec_GF2m_simple_point_clear_finish(EC_POINT *point)
void ossl_ec_GF2m_simple_point_clear_finish(EC_POINT *point)
{
BN_clear_free(point->X);
BN_clear_free(point->Y);
@ -255,7 +255,7 @@ void ec_GF2m_simple_point_clear_finish(EC_POINT *point)
* Copy the contents of one EC_POINT into another. Assumes dest is
* initialized.
*/
int ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
int ossl_ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
{
if (!BN_copy(dest->X, src->X))
return 0;
@ -273,8 +273,8 @@ int ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src)
* Set an EC_POINT to the point at infinity. A point at infinity is
* represented by having Z=0.
*/
int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group,
EC_POINT *point)
int ossl_ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group,
EC_POINT *point)
{
point->Z_is_one = 0;
BN_zero(point->Z);
@ -285,10 +285,11 @@ int ec_GF2m_simple_point_set_to_infinity(const EC_GROUP *group,
* Set the coordinates of an EC_POINT using affine coordinates. Note that
* the simple implementation only uses affine coordinates.
*/
int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group,
EC_POINT *point,
const BIGNUM *x,
const BIGNUM *y, BN_CTX *ctx)
int ossl_ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group,
EC_POINT *point,
const BIGNUM *x,
const BIGNUM *y,
BN_CTX *ctx)
{
int ret = 0;
if (x == NULL || y == NULL) {
@ -316,10 +317,10 @@ int ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group,
* Gets the affine coordinates of an EC_POINT. Note that the simple
* implementation only uses affine coordinates.
*/
int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group,
const EC_POINT *point,
BIGNUM *x, BIGNUM *y,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group,
const EC_POINT *point,
BIGNUM *x, BIGNUM *y,
BN_CTX *ctx)
{
int ret = 0;
@ -352,8 +353,8 @@ int ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group,
* Computes a + b and stores the result in r. r could be a or b, a could be
* b. Uses algorithm A.10.2 of IEEE P1363.
*/
int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r,
const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
{
BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t;
int ret = 0;
@ -473,13 +474,14 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
* Computes 2 * a and stores the result in r. r could be a. Uses algorithm
* A.10.2 of IEEE P1363.
*/
int ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r,
const EC_POINT *a, BN_CTX *ctx)
{
return ec_GF2m_simple_add(group, r, a, a, ctx);
return ossl_ec_GF2m_simple_add(group, r, a, a, ctx);
}
int ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
int ossl_ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point,
BN_CTX *ctx)
{
if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(point->Y))
/* point is its own inverse */
@ -492,8 +494,8 @@ int ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
}
/* Indicates whether the given point is the point at infinity. */
int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group,
const EC_POINT *point)
int ossl_ec_GF2m_simple_is_at_infinity(const EC_GROUP *group,
const EC_POINT *point)
{
return BN_is_zero(point->Z);
}
@ -503,8 +505,8 @@ int ec_GF2m_simple_is_at_infinity(const EC_GROUP *group,
* in the EC_GROUP. A point is valid if it satisfies the Weierstrass equation:
* y^2 + x*y = x^3 + a*x^2 + b.
*/
int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
BN_CTX *ctx)
{
int ret = -1;
BIGNUM *lh, *y2;
@ -576,8 +578,8 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
* 0 equal (in affine coordinates)
* 1 not equal
*/
int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx)
{
BIGNUM *aX, *aY, *bX, *bY;
int ret = -1;
@ -627,8 +629,8 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
}
/* Forces the given EC_POINT to internally use affine coordinates. */
int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
BN_CTX *ctx)
int ossl_ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
BN_CTX *ctx)
{
BIGNUM *x, *y;
int ret = 0;
@ -676,8 +678,8 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
/*
* Forces each of the EC_POINTs in the given array to use affine coordinates.
*/
int ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num,
EC_POINT *points[], BN_CTX *ctx)
int ossl_ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num,
EC_POINT *points[], BN_CTX *ctx)
{
size_t i;
@ -690,22 +692,22 @@ int ec_GF2m_simple_points_make_affine(const EC_GROUP *group, size_t num,
}
/* Wrapper to simple binary polynomial field multiplication implementation. */
int ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_field_mul(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
return BN_GF2m_mod_mul_arr(r, a, b, group->poly, ctx);
}
/* Wrapper to simple binary polynomial field squaring implementation. */
int ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, BN_CTX *ctx)
int ossl_ec_GF2m_simple_field_sqr(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, BN_CTX *ctx)
{
return BN_GF2m_mod_sqr_arr(r, a, group->poly, ctx);
}
/* Wrapper to simple binary polynomial field division implementation. */
int ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
int ossl_ec_GF2m_simple_field_div(const EC_GROUP *group, BIGNUM *r,
const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
return BN_GF2m_mod_div(r, a, b, group->field, ctx);
}
@ -887,15 +889,15 @@ int ec_GF2m_simple_points_mul(const EC_GROUP *group, EC_POINT *r,
* order or cofactor set to 0.
*/
if (num > 1 || BN_is_zero(group->order) || BN_is_zero(group->cofactor))
return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
return ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
if (scalar != NULL && num == 0)
/* Fixed point multiplication */
return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
return ossl_ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
if (scalar == NULL && num == 1)
/* Variable point multiplication */
return ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx);
return ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx);
/*-
* Double point multiplication:
@ -907,8 +909,8 @@ int ec_GF2m_simple_points_mul(const EC_GROUP *group, EC_POINT *r,
return 0;
}
if (!ec_scalar_mul_ladder(group, t, scalar, NULL, ctx)
|| !ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx)
if (!ossl_ec_scalar_mul_ladder(group, t, scalar, NULL, ctx)
|| !ossl_ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx)
|| !EC_POINT_add(group, r, t, r, ctx))
goto err;
@ -939,55 +941,55 @@ const EC_METHOD *EC_GF2m_simple_method(void)
static const EC_METHOD ret = {
EC_FLAGS_DEFAULT_OCT,
NID_X9_62_characteristic_two_field,
ec_GF2m_simple_group_init,
ec_GF2m_simple_group_finish,
ec_GF2m_simple_group_clear_finish,
ec_GF2m_simple_group_copy,
ec_GF2m_simple_group_set_curve,
ec_GF2m_simple_group_get_curve,
ec_GF2m_simple_group_get_degree,
ec_group_simple_order_bits,
ec_GF2m_simple_group_check_discriminant,
ec_GF2m_simple_point_init,
ec_GF2m_simple_point_finish,
ec_GF2m_simple_point_clear_finish,
ec_GF2m_simple_point_copy,
ec_GF2m_simple_point_set_to_infinity,
ec_GF2m_simple_point_set_affine_coordinates,
ec_GF2m_simple_point_get_affine_coordinates,
ossl_ec_GF2m_simple_group_init,
ossl_ec_GF2m_simple_group_finish,
ossl_ec_GF2m_simple_group_clear_finish,
ossl_ec_GF2m_simple_group_copy,
ossl_ec_GF2m_simple_group_set_curve,
ossl_ec_GF2m_simple_group_get_curve,
ossl_ec_GF2m_simple_group_get_degree,
ossl_ec_group_simple_order_bits,
ossl_ec_GF2m_simple_group_check_discriminant,
ossl_ec_GF2m_simple_point_init,
ossl_ec_GF2m_simple_point_finish,
ossl_ec_GF2m_simple_point_clear_finish,
ossl_ec_GF2m_simple_point_copy,
ossl_ec_GF2m_simple_point_set_to_infinity,
ossl_ec_GF2m_simple_point_set_affine_coordinates,
ossl_ec_GF2m_simple_point_get_affine_coordinates,
0, /* point_set_compressed_coordinates */
0, /* point2oct */
0, /* oct2point */
ec_GF2m_simple_add,
ec_GF2m_simple_dbl,
ec_GF2m_simple_invert,
ec_GF2m_simple_is_at_infinity,
ec_GF2m_simple_is_on_curve,
ec_GF2m_simple_cmp,
ec_GF2m_simple_make_affine,
ec_GF2m_simple_points_make_affine,
ossl_ec_GF2m_simple_add,
ossl_ec_GF2m_simple_dbl,
ossl_ec_GF2m_simple_invert,
ossl_ec_GF2m_simple_is_at_infinity,
ossl_ec_GF2m_simple_is_on_curve,
ossl_ec_GF2m_simple_cmp,
ossl_ec_GF2m_simple_make_affine,
ossl_ec_GF2m_simple_points_make_affine,
ec_GF2m_simple_points_mul,
0, /* precompute_mult */
0, /* have_precompute_mult */
ec_GF2m_simple_field_mul,
ec_GF2m_simple_field_sqr,
ec_GF2m_simple_field_div,
ossl_ec_GF2m_simple_field_mul,
ossl_ec_GF2m_simple_field_sqr,
ossl_ec_GF2m_simple_field_div,
ec_GF2m_simple_field_inv,
0, /* field_encode */
0, /* field_decode */
0, /* field_set_to_one */
ec_key_simple_priv2oct,
ec_key_simple_oct2priv,
ossl_ec_key_simple_priv2oct,
ossl_ec_key_simple_oct2priv,
0, /* set private */
ec_key_simple_generate_key,
ec_key_simple_check_key,
ec_key_simple_generate_public_key,
ossl_ec_key_simple_generate_key,
ossl_ec_key_simple_check_key,
ossl_ec_key_simple_generate_public_key,
0, /* keycopy */
0, /* keyfinish */
ecdh_simple_compute_key,
ecdsa_simple_sign_setup,
ecdsa_simple_sign_sig,
ecdsa_simple_verify_sig,
ossl_ecdh_simple_compute_key,
ossl_ecdsa_simple_sign_setup,
ossl_ecdsa_simple_sign_sig,
ossl_ecdsa_simple_verify_sig,
0, /* field_inverse_mod_ord */
0, /* blind_coordinates */
ec_GF2m_simple_ladder_pre,

@ -584,7 +584,7 @@ int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
BN_CTX_start(bnctx);
/* export the domain parameters */
if (!ec_group_todata(ecg, tmpl, NULL, libctx, propq, bnctx, &gen_buf))
if (!ossl_ec_group_todata(ecg, tmpl, NULL, libctx, propq, bnctx, &gen_buf))
goto err;
selection |= OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS;
@ -695,9 +695,9 @@ static int ec_pkey_import_from(const OSSL_PARAM params[], void *vpctx)
return 0;
}
if (!ec_group_fromdata(ec, params)
|| !ec_key_otherparams_fromdata(ec, params)
|| !ec_key_fromdata(ec, params, 1)
if (!ossl_ec_group_fromdata(ec, params)
|| !ossl_ec_key_otherparams_fromdata(ec, params)
|| !ossl_ec_key_fromdata(ec, params, 1)
|| !EVP_PKEY_assign_EC_KEY(pkey, ec)) {
EC_KEY_free(ec);
return 0;

@ -768,7 +768,7 @@ EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params)
ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
goto err;
}
if ((curve_name = ec_curve_nid_from_params(dup, ctx)) != NID_undef) {
if ((curve_name = ossl_ec_curve_nid_from_params(dup, ctx)) != NID_undef) {
/*
* The input explicit parameters successfully matched one of the
* built-in curves: often for built-in curves we have specialized

@ -41,7 +41,7 @@ static const OSSL_ITEM format_nameid_map[] = {
{ (int)POINT_CONVERSION_HYBRID, OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_HYBRID },
};
int ec_encoding_name2id(const char *name)
int ossl_ec_encoding_name2id(const char *name)
{
size_t i, sz;
@ -67,7 +67,7 @@ static char *ec_param_encoding_id2name(int id)
return NULL;
}
char *ec_check_group_type_id2name(int id)
char *ossl_ec_check_group_type_id2name(int id)
{
size_t i, sz;
@ -93,7 +93,7 @@ static int ec_check_group_type_name2id(const char *name)
return -1;
}
int ec_set_check_group_type_from_name(EC_KEY *ec, const char *name)
int ossl_ec_set_check_group_type_from_name(EC_KEY *ec, const char *name)
{
int flags = ec_check_group_type_name2id(name);
@ -119,11 +119,11 @@ static int ec_set_check_group_type_from_param(EC_KEY *ec, const OSSL_PARAM *p)
break;
}
if (status)
return ec_set_check_group_type_from_name(ec, name);
return ossl_ec_set_check_group_type_from_name(ec, name);
return 0;
}
int ec_pt_format_name2id(const char *name)
int ossl_ec_pt_format_name2id(const char *name)
{
size_t i, sz;
@ -138,7 +138,7 @@ int ec_pt_format_name2id(const char *name)
return -1;
}
char *ec_pt_format_id2name(int id)
char *ossl_ec_pt_format_id2name(int id)
{
size_t i, sz;
@ -149,10 +149,10 @@ char *ec_pt_format_id2name(int id)
return NULL;
}
int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
const char *propq,
BN_CTX *bnctx, unsigned char **genbuf)
int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
const char *propq,
BN_CTX *bnctx, unsigned char **genbuf)
{
int ret = 0, curve_nid, encoding_flag;
const char *field_type, *encoding_name, *pt_form_name;
@ -169,7 +169,7 @@ int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
}
genform = EC_GROUP_get_point_conversion_form(group);
pt_form_name = ec_pt_format_id2name(genform);
pt_form_name = ossl_ec_pt_format_id2name(genform);
if (pt_form_name == NULL
|| !ossl_param_build_set_utf8_string(
tmpl, params,
@ -271,7 +271,7 @@ int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
#endif
} else {
/* named curve */
const char *curve_name = ec_curve_nid2name(curve_nid);
const char *curve_name = ossl_ec_curve_nid2name(curve_nid);
if (curve_name == NULL
|| !ossl_param_build_set_utf8_string(tmpl, params,
@ -291,7 +291,7 @@ err:
* for legacy backends (EVP_PKEY_ASN1_METHOD and EVP_PKEY_METHOD) and provider
* implementations alike.
*/
int ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode)
int ossl_ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode)
{
const EC_GROUP *ecg = EC_KEY_get0_group(ec);
const BIGNUM *cofactor;
@ -321,14 +321,14 @@ int ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode)
}
/*
* Callers of ec_key_fromdata MUST make sure that ec_key_params_fromdata has
* Callers of ossl_ec_key_fromdata MUST make sure that ec_key_params_fromdata has
* been called before!
*
* This function only gets the bare keypair, domain parameters and other
* parameters are treated separately, and domain parameters are required to
* define a keypair.
*/
int ec_key_fromdata(EC_KEY *ec, const OSSL_PARAM params[], int include_private)
int ossl_ec_key_fromdata(EC_KEY *ec, const OSSL_PARAM params[], int include_private)
{
const OSSL_PARAM *param_priv_key = NULL, *param_pub_key = NULL;
BN_CTX *ctx = NULL;
@ -349,7 +349,7 @@ int ec_key_fromdata(EC_KEY *ec, const OSSL_PARAM params[], int include_private)
param_priv_key =
OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_PRIV_KEY);
ctx = BN_CTX_new_ex(ec_key_get_libctx(ec));
ctx = BN_CTX_new_ex(ossl_ec_key_get_libctx(ec));
if (ctx == NULL)
goto err;
@ -431,7 +431,7 @@ int ec_key_fromdata(EC_KEY *ec, const OSSL_PARAM params[], int include_private)
return ok;
}
int ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
int ossl_ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
{
int ok = 0;
EC_GROUP *group = NULL;
@ -439,8 +439,8 @@ int ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
if (ec == NULL)
return 0;
group = EC_GROUP_new_from_params(params, ec_key_get_libctx(ec),
ec_key_get0_propq(ec));
group = EC_GROUP_new_from_params(params, ossl_ec_key_get_libctx(ec),
ossl_ec_key_get0_propq(ec));
if (!EC_KEY_set_group(ec, group))
goto err;
@ -457,7 +457,7 @@ static int ec_key_point_format_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT);
if (p != NULL) {
if (!ec_pt_format_param2id(p, &format)) {
if (!ossl_ec_pt_format_param2id(p, &format)) {
ECerr(0, EC_R_INVALID_FORM);
return 0;
}
@ -488,7 +488,7 @@ static int ec_set_include_public(EC_KEY *ec, int include)
return 1;
}
int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
int ossl_ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
@ -500,7 +500,7 @@ int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
int mode;
if (!OSSL_PARAM_get_int(p, &mode)
|| !ec_set_ecdh_cofactor_mode(ec, mode))
|| !ossl_ec_set_ecdh_cofactor_mode(ec, mode))
return 0;
}
@ -519,7 +519,7 @@ int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
return 1;
}
int ec_encoding_param2id(const OSSL_PARAM *p, int *id)
int ossl_ec_encoding_param2id(const OSSL_PARAM *p, int *id)
{
const char *name = NULL;
int status = 0;
@ -535,7 +535,7 @@ int ec_encoding_param2id(const OSSL_PARAM *p, int *id)
break;
}
if (status) {
int i = ec_encoding_name2id(name);
int i = ossl_ec_encoding_name2id(name);
if (i >= 0) {
*id = i;
@ -545,7 +545,7 @@ int ec_encoding_param2id(const OSSL_PARAM *p, int *id)
return 0;
}
int ec_pt_format_param2id(const OSSL_PARAM *p, int *id)
int ossl_ec_pt_format_param2id(const OSSL_PARAM *p, int *id)
{
const char *name = NULL;
int status = 0;
@ -561,7 +561,7 @@ int ec_pt_format_param2id(const OSSL_PARAM *p, int *id)
break;
}
if (status) {
int i = ec_pt_format_name2id(name);
int i = ossl_ec_pt_format_name2id(name);
if (i >= 0) {
*id = i;

@ -35,7 +35,7 @@ int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only,
}
}
nid = ec_curve_nid_from_params(group, ctx);
nid = ossl_ec_curve_nid_from_params(group, ctx);
if (nid > 0 && nist_only && EC_curve_nid2nist(nid) == NULL)
nid = NID_undef;

@ -3147,8 +3147,8 @@ static EC_GROUP *ec_group_new_from_data(OSSL_LIB_CTX *libctx,
/* If no curve data curve method must handle everything */
if (curve.data == NULL)
return ec_group_new_ex(libctx, propq,
curve.meth != NULL ? curve.meth() : NULL);
return ossl_ec_group_new_ex(libctx, propq,
curve.meth != NULL ? curve.meth() : NULL);
if ((ctx = BN_CTX_new_ex(libctx)) == NULL) {
ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
@ -3170,7 +3170,7 @@ static EC_GROUP *ec_group_new_from_data(OSSL_LIB_CTX *libctx,
if (curve.meth != 0) {
meth = curve.meth();
if (((group = ec_group_new_ex(libctx, propq, meth)) == NULL) ||
if (((group = ossl_ec_group_new_ex(libctx, propq, meth)) == NULL) ||
(!(group->meth->group_set_curve(group, p, a, b, ctx)))) {
ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
goto err;
@ -3286,12 +3286,12 @@ size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)
const char *EC_curve_nid2nist(int nid)
{
return ec_curve_nid2nist_int(nid);
return ossl_ec_curve_nid2nist_int(nid);
}
int EC_curve_nist2nid(const char *name)
{
return ec_curve_nist2nid_int(name);
return ossl_ec_curve_nist2nid_int(name);
}
#define NUM_BN_FIELDS 6
@ -3303,7 +3303,7 @@ int EC_curve_nist2nid(const char *name)
* Returns: The nid associated with the found named curve, or NID_undef
* if not found. If there was an error it returns -1.
*/
int ec_curve_nid_from_params(const EC_GROUP *group, BN_CTX *ctx)
int ossl_ec_curve_nid_from_params(const EC_GROUP *group, BN_CTX *ctx)
{
int ret = -1, nid, len, field_type, param_len;
size_t i, seed_len;

@ -54,7 +54,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
meth = EC_GFp_mont_method();
#endif
ret = ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
ret = ossl_ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
if (ret == NULL)
return NULL;
@ -75,7 +75,7 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
meth = EC_GF2m_simple_method();
ret = ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
ret = ossl_ec_group_new_ex(ossl_bn_get_libctx(ctx), NULL, meth);
if (ret == NULL)
return NULL;

@ -30,13 +30,13 @@ static int ecdsa_keygen_pairwise_test(EC_KEY *eckey, OSSL_CALLBACK *cb,
#ifndef FIPS_MODULE
EC_KEY *EC_KEY_new(void)
{
return ec_key_new_method_int(NULL, NULL, NULL);
return ossl_ec_key_new_method_int(NULL, NULL, NULL);
}
#endif
EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq)
{
return ec_key_new_method_int(ctx, propq, NULL);
return ossl_ec_key_new_method_int(ctx, propq, NULL);
}
EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,
@ -122,7 +122,8 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
if (src->group != NULL) {
/* clear the old group */
EC_GROUP_free(dest->group);
dest->group = ec_group_new_ex(src->libctx, src->propq, src->group->meth);
dest->group = ossl_ec_group_new_ex(src->libctx, src->propq,
src->group->meth);
if (dest->group == NULL)
return NULL;
if (!EC_GROUP_copy(dest->group, src->group))
@ -183,8 +184,8 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
EC_KEY *EC_KEY_dup(const EC_KEY *ec_key)
{
EC_KEY *ret = ec_key_new_method_int(ec_key->libctx, ec_key->propq,
ec_key->engine);
EC_KEY *ret = ossl_ec_key_new_method_int(ec_key->libctx, ec_key->propq,
ec_key->engine);
if (ret == NULL)
return NULL;
@ -357,12 +358,12 @@ err:
return ok;
}
int ec_key_simple_generate_key(EC_KEY *eckey)
int ossl_ec_key_simple_generate_key(EC_KEY *eckey)
{
return ec_generate_key(eckey, 0);
}
int ec_key_simple_generate_public_key(EC_KEY *eckey)
int ossl_ec_key_simple_generate_public_key(EC_KEY *eckey)
{
int ret;
BN_CTX *ctx = BN_CTX_new_ex(eckey->libctx);
@ -445,7 +446,7 @@ err:
* ECC Partial Public-Key Validation as specified in SP800-56A R3
* Section 5.6.2.3.4 ECC Partial Public-Key Validation Routine.
*/
int ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
int ossl_ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
{
if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
@ -476,13 +477,13 @@ int ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
* ECC Key validation as specified in SP800-56A R3.
* Section 5.6.2.3.3 ECC Full Public-Key Validation Routine.
*/
int ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx)
int ossl_ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx)
{
int ret = 0;
EC_POINT *point = NULL;
const BIGNUM *order = NULL;
if (!ec_key_public_check_quick(eckey, ctx))
if (!ossl_ec_key_public_check_quick(eckey, ctx))
return 0;
point = EC_POINT_new(eckey->group);
@ -514,7 +515,7 @@ err:
* Section 5.6.2.1.2 Owner Assurance of Private-Key Validity
* The private key is in the range [1, order-1]
*/
int ec_key_private_check(const EC_KEY *eckey)
int ossl_ec_key_private_check(const EC_KEY *eckey)
{
if (eckey == NULL || eckey->group == NULL || eckey->priv_key == NULL) {
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
@ -533,7 +534,7 @@ int ec_key_private_check(const EC_KEY *eckey)
* Section 5.6.2.1.4 Owner Assurance of Pair-wise Consistency (b)
* Check if generator * priv_key = pub_key
*/
int ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx)
int ossl_ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx)
{
int ret = 0;
EC_POINT *point = NULL;
@ -576,7 +577,7 @@ err:
* an approved elliptic-curve group is used.
* Returns 1 if the key is valid, otherwise it returns 0.
*/
int ec_key_simple_check_key(const EC_KEY *eckey)
int ossl_ec_key_simple_check_key(const EC_KEY *eckey)
{
int ok = 0;
BN_CTX *ctx = NULL;
@ -588,12 +589,12 @@ int ec_key_simple_check_key(const EC_KEY *eckey)
if ((ctx = BN_CTX_new_ex(eckey->libctx)) == NULL)
return 0;
if (!ec_key_public_check(eckey, ctx))
if (!ossl_ec_key_public_check(eckey, ctx))
goto err;
if (eckey->priv_key != NULL) {
if (!ec_key_private_check(eckey)
|| !ec_key_pairwise_check(eckey, ctx))
if (!ossl_ec_key_private_check(eckey)
|| !ossl_ec_key_pairwise_check(eckey, ctx))
goto err;
}
ok = 1;
@ -660,17 +661,17 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
}
OSSL_LIB_CTX *ec_key_get_libctx(const EC_KEY *key)
OSSL_LIB_CTX *ossl_ec_key_get_libctx(const EC_KEY *key)
{
return key->libctx;
}
const char *ec_key_get0_propq(const EC_KEY *key)
const char *ossl_ec_key_get0_propq(const EC_KEY *key)
{
return key->propq;
}
void ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx)
void ossl_ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx)
{
key->libctx = libctx;
/* Do we need to propagate this to the group? */
@ -903,8 +904,8 @@ size_t EC_KEY_priv2oct(const EC_KEY *eckey,
return eckey->group->meth->priv2oct(eckey, buf, len);
}
size_t ec_key_simple_priv2oct(const EC_KEY *eckey,
unsigned char *buf, size_t len)
size_t ossl_ec_key_simple_priv2oct(const EC_KEY *eckey,
unsigned char *buf, size_t len)
{
size_t buf_len;
@ -942,7 +943,8 @@ int EC_KEY_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
return ret;
}
int ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
int ossl_ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf,
size_t len)
{
if (eckey->priv_key == NULL)
eckey->priv_key = BN_secure_new();

@ -76,8 +76,8 @@ int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
return 1;
}
EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
ENGINE *engine)
EC_KEY *ossl_ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
ENGINE *engine)
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
@ -145,7 +145,7 @@ EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
#ifndef FIPS_MODULE
EC_KEY *EC_KEY_new_method(ENGINE *engine)
{
return ec_key_new_method_int(NULL, NULL, engine);
return ossl_ec_key_new_method_int(NULL, NULL, engine);
}
#endif

@ -26,8 +26,8 @@
/* functions for EC_GROUP objects */
EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
const EC_METHOD *meth)
EC_GROUP *ossl_ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
const EC_METHOD *meth)
{
EC_GROUP *ret;
@ -81,7 +81,7 @@ EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
# ifndef FIPS_MODULE
EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
{
return ec_group_new_ex(NULL, NULL, meth);
return ossl_ec_group_new_ex(NULL, NULL, meth);
}
# endif
#endif
@ -271,7 +271,7 @@ EC_GROUP *EC_GROUP_dup(const EC_GROUP *a)
if (a == NULL)
return NULL;
if ((t = ec_group_new_ex(a->libctx, a->propq, a->meth)) == NULL)
if ((t = ossl_ec_group_new_ex(a->libctx, a->propq, a->meth)) == NULL)
return NULL;
if (!EC_GROUP_copy(t, a))
goto err;
@ -836,7 +836,8 @@ int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,
ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);
return ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(group, point,
x, y, z, ctx);
}
int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
@ -852,7 +853,8 @@ int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
ERR_raise(ERR_LIB_EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return ec_GFp_simple_get_Jprojective_coordinates_GFp(group, point, x, y, z, ctx);
return ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp(group, point,
x, y, z, ctx);
}
#endif
@ -1101,7 +1103,7 @@ int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
ret = group->meth->mul(group, r, scalar, num, points, scalars, ctx);
else
/* use default */
ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
ret = ossl_ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
#ifndef FIPS_MODULE
BN_CTX_free(new_ctx);
@ -1142,7 +1144,7 @@ int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
ret = group->meth->mul(group, r, g_scalar, num, &point, &p_scalar, ctx);
else
/* use default */
ret = ec_wNAF_mul(group, r, g_scalar, num, &point, &p_scalar, ctx);
ret = ossl_ec_wNAF_mul(group, r, g_scalar, num, &point, &p_scalar, ctx);
#ifndef FIPS_MODULE
BN_CTX_free(new_ctx);
@ -1155,7 +1157,7 @@ int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
{
if (group->meth->mul == 0)
/* use default */
return ec_wNAF_precompute_mult(group, ctx);
return ossl_ec_wNAF_precompute_mult(group, ctx);
if (group->meth->precompute_mult != 0)
return group->meth->precompute_mult(group, ctx);
@ -1167,7 +1169,7 @@ int EC_GROUP_have_precompute_mult(const EC_GROUP *group)
{
if (group->meth->mul == 0)
/* use default */
return ec_wNAF_have_precompute_mult(group);
return ossl_ec_wNAF_have_precompute_mult(group);
if (group->meth->have_precompute_mult != 0)
return group->meth->have_precompute_mult(group);
@ -1222,7 +1224,7 @@ void *EC_KEY_get_ex_data(const EC_KEY *key, int idx)
}
#endif
int ec_group_simple_order_bits(const EC_GROUP *group)
int ossl_ec_group_simple_order_bits(const EC_GROUP *group)
{
if (group->order == NULL)
return 0;
@ -1290,8 +1292,8 @@ static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
* EC_METHODs must implement their own field_inverse_mod_ord for
* other functionality.
*/
int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
const BIGNUM *x, BN_CTX *ctx)
int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
const BIGNUM *x, BN_CTX *ctx)
{
if (group->meth->field_inverse_mod_ord != NULL)
return group->meth->field_inverse_mod_ord(group, res, x, ctx);
@ -1309,7 +1311,8 @@ int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
* This wrapper returns 1 in case the underlying EC_METHOD does not
* support coordinate blinding.
*/
int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx)
int ossl_ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p,
BN_CTX *ctx)
{
if (group->meth->blind_coordinates == NULL)
return 1; /* ignore if not implemented */
@ -1411,7 +1414,7 @@ static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group,
|| EC_GROUP_set_seed(dup, NULL, 0) != 1
|| !EC_GROUP_set_generator(dup, point, order, NULL))
goto err;
if ((curve_name_nid = ec_curve_nid_from_params(dup, ctx)) != NID_undef) {
if ((curve_name_nid = ossl_ec_curve_nid_from_params(dup, ctx)) != NID_undef) {
/*
* The input explicit parameters successfully matched one of the
* built-in curves: often for built-in curves we have specialized
@ -1483,7 +1486,7 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
}
if (ok) {
nid = ec_curve_name2nid(curve_name);
nid = ossl_ec_curve_name2nid(curve_name);
if (nid == NID_undef) {
ERR_raise(ERR_LIB_EC, EC_R_INVALID_CURVE);
return NULL;
@ -1495,14 +1498,14 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
}
/* These parameters can be set directly into an EC_GROUP */
int ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[])
int ossl_ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[])
{
int encoding_flag = -1, format = -1;
const OSSL_PARAM *p;
p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT);
if (p != NULL) {
if (!ec_pt_format_param2id(p, &format)) {
if (!ossl_ec_pt_format_param2id(p, &format)) {
ECerr(0, EC_R_INVALID_FORM);
return 0;
}
@ -1511,7 +1514,7 @@ int ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[])
p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_ENCODING);
if (p != NULL) {
if (!ec_encoding_param2id(p, &encoding_flag)) {
if (!ossl_ec_encoding_param2id(p, &encoding_flag)) {
ECerr(0, EC_R_INVALID_FORM);
return 0;
}
@ -1549,7 +1552,7 @@ EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],
if (ptmp != NULL) {
group = group_new_from_name(ptmp, libctx, propq);
if (group != NULL) {
if (!ec_group_set_params(group, params)) {
if (!ossl_ec_group_set_params(group, params)) {
EC_GROUP_free(group);
group = NULL;
}
@ -1706,7 +1709,7 @@ EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],
*/
ptmp = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_EC_ENCODING);
if (ptmp != NULL
&& !ec_encoding_param2id(ptmp, &encoding_flag)) {
&& !ossl_ec_encoding_param2id(ptmp, &encoding_flag)) {
ECerr(0, EC_R_INVALID_ENCODING);
return 0;
}

@ -349,249 +349,249 @@ void EC_ec_pre_comp_free(EC_PRE_COMP *);
* method functions in ec_mult.c (ec_lib.c uses these as defaults if
* group->method->mul is 0)
*/
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
BN_CTX *);
int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *);
int ec_wNAF_have_precompute_mult(const EC_GROUP *group);
int ossl_ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
size_t num, const EC_POINT *points[],
const BIGNUM *scalars[], BN_CTX *);
int ossl_ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *);
int ossl_ec_wNAF_have_precompute_mult(const EC_GROUP *group);
/* method functions in ecp_smpl.c */
int ec_GFp_simple_group_init(EC_GROUP *);
void ec_GFp_simple_group_finish(EC_GROUP *);
void ec_GFp_simple_group_clear_finish(EC_GROUP *);
int ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *);
int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p,
const BIGNUM *a, const BIGNUM *b, BN_CTX *);
int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
BIGNUM *b, BN_CTX *);
int ec_GFp_simple_group_get_degree(const EC_GROUP *);
int ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *);
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 *, const BIGNUM *x,
const BIGNUM *y,
const BIGNUM *z, BN_CTX *);
int ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *,
const EC_POINT *, BIGNUM *x,
BIGNUM *y, BIGNUM *z,
int ossl_ec_GFp_simple_group_init(EC_GROUP *);
void ossl_ec_GFp_simple_group_finish(EC_GROUP *);
void ossl_ec_GFp_simple_group_clear_finish(EC_GROUP *);
int ossl_ec_GFp_simple_group_copy(EC_GROUP *, const EC_GROUP *);
int ossl_ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p,
const BIGNUM *a, const BIGNUM *b,
BN_CTX *);
int ossl_ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
BIGNUM *b, BN_CTX *);
int ossl_ec_GFp_simple_group_get_degree(const EC_GROUP *);
int ossl_ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *);
int ossl_ec_GFp_simple_point_init(EC_POINT *);
void ossl_ec_GFp_simple_point_finish(EC_POINT *);
void ossl_ec_GFp_simple_point_clear_finish(EC_POINT *);
int ossl_ec_GFp_simple_point_copy(EC_POINT *, const EC_POINT *);
int ossl_ec_GFp_simple_point_set_to_infinity(const EC_GROUP *, EC_POINT *);
int ossl_ec_GFp_simple_set_Jprojective_coordinates_GFp(const EC_GROUP *,
EC_POINT *,
const BIGNUM *x,
const BIGNUM *y,
const BIGNUM *z,
BN_CTX *);
int ossl_ec_GFp_simple_get_Jprojective_coordinates_GFp(const EC_GROUP *,
const EC_POINT *,
BIGNUM *x,
BIGNUM *y, BIGNUM *z,
BN_CTX *);
int ossl_ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *,
const BIGNUM *x,
const BIGNUM *y, BN_CTX *);
int ossl_ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *,
const EC_POINT *, BIGNUM *x,
BIGNUM *y, BN_CTX *);
int ossl_ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *, EC_POINT *,
const BIGNUM *x, int y_bit,
BN_CTX *);
int ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *, EC_POINT *,
const BIGNUM *x,
const BIGNUM *y, BN_CTX *);
int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *,
const EC_POINT *, BIGNUM *x,
BIGNUM *y, BN_CTX *);
int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *, EC_POINT *,
const BIGNUM *x, int y_bit,
BN_CTX *);
size_t ec_GFp_simple_point2oct(const EC_GROUP *, const EC_POINT *,
point_conversion_form_t form,
unsigned char *buf, size_t len, BN_CTX *);
int ec_GFp_simple_oct2point(const EC_GROUP *, EC_POINT *,
const unsigned char *buf, size_t len, BN_CTX *);
int ec_GFp_simple_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a,
const EC_POINT *b, BN_CTX *);
int ec_GFp_simple_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a,
BN_CTX *);
int ec_GFp_simple_invert(const EC_GROUP *, EC_POINT *, BN_CTX *);
int ec_GFp_simple_is_at_infinity(const EC_GROUP *, const EC_POINT *);
int ec_GFp_simple_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *);
int ec_GFp_simple_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b,
BN_CTX *);
int ec_GFp_simple_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
int ec_GFp_simple_points_make_affine(const EC_GROUP *, size_t num,