NISTZ256_PRE_COMP *EC_nistz256_pre_comp_dup(NISTZ256_PRE_COMP *);
NISTP256_PRE_COMP *EC_nistp256_pre_comp_dup(NISTP256_PRE_COMP *);
EC_PRE_COMP *EC_ec_pre_comp_dup(EC_PRE_COMP *);
+
+void EC_pre_comp_free(EC_GROUP *group);
void EC_nistp224_pre_comp_free(NISTP224_PRE_COMP *);
void EC_nistp256_pre_comp_free(NISTP256_PRE_COMP *);
void EC_nistp521_pre_comp_free(NISTP521_PRE_COMP *);
return NULL;
}
-static void ec_group_free_precomp(EC_GROUP *group)
+void EC_pre_comp_free(EC_GROUP *group)
{
switch (group->pre_comp_type) {
default:
if (group->meth->group_finish != 0)
group->meth->group_finish(group);
- ec_group_free_precomp(group);
+ EC_pre_comp_free(group);
BN_MONT_CTX_free(group->mont_data);
EC_POINT_free(group->generator);
BN_free(group->order);
else if (group->meth->group_finish != 0)
group->meth->group_finish(group);
- ec_group_free_precomp(group);
+ EC_pre_comp_free(group);
BN_MONT_CTX_free(group->mont_data);
EC_POINT_clear_free(group->generator);
BN_clear_free(group->order);
int ret = 0;
/* if there is an old EC_PRE_COMP object, throw it away */
- EC_ec_pre_comp_free(group->pre_comp.ec);
+ EC_pre_comp_free(group);
if ((pre_comp = ec_pre_comp_new(group)) == NULL)
return 0;
felem tmp_felems[32];
/* throw away old precomputation */
- EC_nistp224_pre_comp_free(group->pre_comp.nistp224);
- group->pre_comp.nistp224 = NULL;
+ EC_pre_comp_free(group);
if (ctx == NULL)
if ((ctx = new_ctx = BN_CTX_new()) == NULL)
return 0;
felem x_tmp, y_tmp, z_tmp;
/* throw away old precomputation */
- EC_nistp256_pre_comp_free(group->pre_comp.nistp256);
- group->pre_comp.nistp256 = NULL;
+ EC_pre_comp_free(group);
if (ctx == NULL)
if ((ctx = new_ctx = BN_CTX_new()) == NULL)
return 0;
felem tmp_felems[16];
/* throw away old precomputation */
- EC_nistp521_pre_comp_free(group->pre_comp.nistp521);
- group->pre_comp.nistp521 = NULL;
+ EC_pre_comp_free(group);
if (ctx == NULL)
if ((ctx = new_ctx = BN_CTX_new()) == NULL)
return 0;
unsigned char *precomp_storage = NULL;
/* if there is an old NISTZ256_PRE_COMP object, throw it away */
- EC_nistz256_pre_comp_free(group->pre_comp.nistz256);
- group->pre_comp.nistz256 = NULL;
+ EC_pre_comp_free(group);
generator = EC_GROUP_get0_generator(group);
if (generator == NULL) {
ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE, EC_R_UNDEFINED_GENERATOR);