{ERR_FUNC(EC_F_NISTP224_PRE_COMP_NEW), "NISTP224_PRE_COMP_NEW"},
{ERR_FUNC(EC_F_NISTP256_PRE_COMP_NEW), "NISTP256_PRE_COMP_NEW"},
{ERR_FUNC(EC_F_NISTP521_PRE_COMP_NEW), "NISTP521_PRE_COMP_NEW"},
-{ERR_FUNC(EC_F_NISTZ256_GET_AFFINE_COORDINATES), "NISTZ256_GET_AFFINE_COORDINATES"},
-{ERR_FUNC(EC_F_NISTZ256_POINTS_MUL), "NISTZ256_POINTS_MUL"},
-{ERR_FUNC(EC_F_NISTZ256_POINTS_MUL_W), "NISTZ256_POINTS_MUL_W"},
-{ERR_FUNC(EC_F_NISTZ256_PRECOMPUTE_MULT), "NISTZ256_PRECOMPUTE_MULT"},
-{ERR_FUNC(EC_F_NISTZ256_PRE_COMP_NEW), "NISTZ256_PRE_COMP_NEW"},
+{ERR_FUNC(EC_F_ECP_NISTZ256_GET_AFFINE), "ecp_nistz256_get_affine"},
+{ERR_FUNC(EC_F_ECP_NISTZ256_POINTS_MUL), "ecp_nistz256_points_mul"},
+{ERR_FUNC(EC_F_ECP_NISTZ256_WINDOWED_MUL), "ecp_nistz256_windowed_mul"},
+{ERR_FUNC(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE), "ecp_nistz256_mult_precompute"},
+{ERR_FUNC(EC_F_ECP_NISTZ256_PRE_COMP_NEW), "ecp_nistz256_pre_comp_new"},
{ERR_FUNC(EC_F_O2I_ECPUBLICKEY), "o2i_ECPublicKey"},
{ERR_FUNC(EC_F_OLD_EC_PRIV_DECODE), "OLD_EC_PRIV_DECODE"},
{ERR_FUNC(EC_F_PKEY_EC_CTRL), "PKEY_EC_CTRL"},
TOBN(0xffffffff, 0xffffffff), TOBN(0x00000000, 0xfffffffe)
};
-static void *ec_pre_comp_dup(void *);
-static void ec_pre_comp_free(void *);
-static void ec_pre_comp_clear_free(void *);
-static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP * group);
+static void *ecp_nistz256_pre_comp_dup(void *);
+static void ecp_nistz256_pre_comp_free(void *);
+static void ecp_nistz256_pre_comp_clear_free(void *);
+static EC_PRE_COMP *ecp_nistz256_pre_comp_new(const EC_GROUP * group);
/* Precomputed tables for the default generator */
#include "ecp_nistz256_table.c"
|| (p_str =
OPENSSL_malloc(num * 33 * sizeof(unsigned char))) == NULL
|| (scalars = OPENSSL_malloc(num * sizeof(BIGNUM *))) == NULL) {
- ECerr(EC_F_NISTZ256_POINTS_MUL_W, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_ECP_NISTZ256_WINDOWED_MUL, ERR_R_MALLOC_FAILURE);
goto err;
} else {
table = (void *)ALIGNPTR(table_storage, 64);
if ((mod = BN_CTX_get(ctx)) == NULL)
goto err;
if (!BN_nnmod(mod, scalar[i], &group->order, ctx)) {
- ECerr(EC_F_NISTZ256_POINTS_MUL_W, ERR_R_BN_LIB);
+ ECerr(EC_F_ECP_NISTZ256_WINDOWED_MUL, ERR_R_BN_LIB);
goto err;
}
scalars[i] = mod;
if (!ecp_nistz256_bignum_to_field_elem(row[1 - 1].X, &point[i]->X)
|| !ecp_nistz256_bignum_to_field_elem(row[1 - 1].Y, &point[i]->Y)
|| !ecp_nistz256_bignum_to_field_elem(row[1 - 1].Z, &point[i]->Z)) {
- ECerr(EC_F_NISTZ256_POINTS_MUL_W, EC_R_COORDINATES_OUT_OF_RANGE);
+ ECerr(EC_F_ECP_NISTZ256_WINDOWED_MUL, EC_R_COORDINATES_OUT_OF_RANGE);
goto err;
}
unsigned char *precomp_storage = NULL;
/* if there is an old EC_PRE_COMP object, throw it away */
- EC_EX_DATA_free_data(&group->extra_data, ec_pre_comp_dup,
- ec_pre_comp_free, ec_pre_comp_clear_free);
+ EC_EX_DATA_free_data(&group->extra_data, ecp_nistz256_pre_comp_dup,
+ ecp_nistz256_pre_comp_free,
+ ecp_nistz256_pre_comp_clear_free);
generator = EC_GROUP_get0_generator(group);
if (generator == NULL) {
- ECerr(EC_F_NISTZ256_PRECOMPUTE_MULT, EC_R_UNDEFINED_GENERATOR);
+ ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE, EC_R_UNDEFINED_GENERATOR);
return 0;
}
return 1;
}
- if ((pre_comp = ec_pre_comp_new(group)) == NULL)
+ if ((pre_comp = ecp_nistz256_pre_comp_new(group)) == NULL)
return 0;
if (ctx == NULL) {
goto err;
if (BN_is_zero(order)) {
- ECerr(EC_F_NISTZ256_PRECOMPUTE_MULT, EC_R_UNKNOWN_ORDER);
+ ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE, EC_R_UNKNOWN_ORDER);
goto err;
}
if ((precomp_storage =
OPENSSL_malloc(37 * 64 * sizeof(P256_POINT_AFFINE) + 64)) == NULL) {
- ECerr(EC_F_NISTZ256_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE, ERR_R_MALLOC_FAILURE);
goto err;
} else {
preComputedTable = (void *)ALIGNPTR(precomp_storage, 64);
precomp_storage = NULL;
if (!EC_EX_DATA_set_data(&group->extra_data, pre_comp,
- ec_pre_comp_dup, ec_pre_comp_free,
- ec_pre_comp_clear_free)) {
+ ecp_nistz256_pre_comp_dup,
+ ecp_nistz256_pre_comp_free,
+ ecp_nistz256_pre_comp_clear_free)) {
goto err;
}
if (ctx != NULL)
BN_CTX_end(ctx);
if (pre_comp)
- ec_pre_comp_free(pre_comp);
+ ecp_nistz256_pre_comp_free(pre_comp);
if (precomp_storage)
OPENSSL_free(precomp_storage);
if (P)
BIGNUM *tmp_scalar;
if (group->meth != r->meth) {
- ECerr(EC_F_NISTZ256_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
if ((scalar == NULL) && (num == 0))
for (j = 0; j < num; j++) {
if (group->meth != points[j]->meth) {
- ECerr(EC_F_NISTZ256_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
}
if (scalar) {
generator = EC_GROUP_get0_generator(group);
if (generator == NULL) {
- ECerr(EC_F_NISTZ256_POINTS_MUL, EC_R_UNDEFINED_GENERATOR);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, EC_R_UNDEFINED_GENERATOR);
goto err;
}
/* look if we can use precomputed multiples of generator */
pre_comp =
- EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup,
- ec_pre_comp_free, ec_pre_comp_clear_free);
+ EC_EX_DATA_get_data(group->extra_data, ecp_nistz256_pre_comp_dup,
+ ecp_nistz256_pre_comp_free,
+ ecp_nistz256_pre_comp_clear_free);
if (pre_comp) {
/* If there is a precomputed table for the generator,
goto err;
if (!BN_nnmod(tmp_scalar, scalar, &group->order, ctx)) {
- ECerr(EC_F_NISTZ256_POINTS_MUL, ERR_R_BN_LIB);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, ERR_R_BN_LIB);
goto err;
}
scalar = tmp_scalar;
new_scalars = OPENSSL_malloc((num + 1) * sizeof(BIGNUM *));
if (!new_scalars) {
- ECerr(EC_F_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
return 0;
}
new_points = OPENSSL_malloc((num + 1) * sizeof(EC_POINT *));
if (!new_points) {
OPENSSL_free(new_scalars);
- ECerr(EC_F_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_ECP_NISTZ256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
return 0;
}
BN_ULONG point_x[P256_LIMBS], point_y[P256_LIMBS], point_z[P256_LIMBS];
if (EC_POINT_is_at_infinity(group, point)) {
- ECerr(EC_F_NISTZ256_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY);
+ ECerr(EC_F_ECP_NISTZ256_GET_AFFINE, EC_R_POINT_AT_INFINITY);
return 0;
}
if (!ecp_nistz256_bignum_to_field_elem(point_x, &point->X) ||
!ecp_nistz256_bignum_to_field_elem(point_y, &point->Y) ||
!ecp_nistz256_bignum_to_field_elem(point_z, &point->Z)) {
- ECerr(EC_F_NISTZ256_GET_AFFINE_COORDINATES,
- EC_R_COORDINATES_OUT_OF_RANGE);
+ ECerr(EC_F_ECP_NISTZ256_GET_AFFINE, EC_R_COORDINATES_OUT_OF_RANGE);
return 0;
}
return 1;
}
-static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP * group)
+static EC_PRE_COMP *ecp_nistz256_pre_comp_new(const EC_GROUP * group)
{
EC_PRE_COMP *ret = NULL;
ret = (EC_PRE_COMP *) OPENSSL_malloc(sizeof(EC_PRE_COMP));
if (!ret) {
- ECerr(EC_F_NISTZ256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
+ ECerr(EC_F_ECP_NISTZ256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
}
return ret;
}
-static void *ec_pre_comp_dup(void *src_)
+static void *ecp_nistz256_pre_comp_dup(void *src_)
{
EC_PRE_COMP *src = src_;
return src_;
}
-static void ec_pre_comp_free(void *pre_)
+static void ecp_nistz256_pre_comp_free(void *pre_)
{
int i;
EC_PRE_COMP *pre = pre_;
OPENSSL_free(pre);
}
-static void ec_pre_comp_clear_free(void *pre_)
+static void ecp_nistz256_pre_comp_clear_free(void *pre_)
{
int i;
EC_PRE_COMP *pre = pre_;
return 1;
}
- return EC_EX_DATA_get_data(group->extra_data, ec_pre_comp_dup,
- ec_pre_comp_free,
- ec_pre_comp_clear_free) != NULL;
+ return EC_EX_DATA_get_data(group->extra_data, ecp_nistz256_pre_comp_dup,
+ ecp_nistz256_pre_comp_free,
+ ecp_nistz256_pre_comp_clear_free) != NULL;
}
const EC_METHOD *EC_GFp_nistz256_method(void)