/* functions for EC_GROUP objects */
-EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const EC_METHOD *meth)
+EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq,
+ const EC_METHOD *meth)
{
EC_GROUP *ret;
if (meth == NULL) {
- ECerr(EC_F_EC_GROUP_NEW_EX, EC_R_SLOT_FULL);
+ ECerr(0, EC_R_SLOT_FULL);
return NULL;
}
if (meth->group_init == 0) {
- ECerr(EC_F_EC_GROUP_NEW_EX, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ ECerr(0, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return NULL;
}
ret = OPENSSL_zalloc(sizeof(*ret));
if (ret == NULL) {
- ECerr(EC_F_EC_GROUP_NEW_EX, ERR_R_MALLOC_FAILURE);
+ ECerr(0, ERR_R_MALLOC_FAILURE);
return NULL;
}
ret->libctx = libctx;
+ if (propq != NULL) {
+ ret->propq = OPENSSL_strdup(propq);
+ if (ret->propq == NULL) {
+ ECerr(0, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
ret->meth = meth;
if ((ret->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) {
ret->order = BN_new();
err:
BN_free(ret->order);
BN_free(ret->cofactor);
+ OPENSSL_free(ret->propq);
OPENSSL_free(ret);
return NULL;
}
# ifndef FIPS_MODULE
EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
{
- return ec_group_new_ex(NULL, meth);
+ return ec_group_new_with_libctx(NULL, NULL, meth);
}
# endif
#endif
BN_free(group->order);
BN_free(group->cofactor);
OPENSSL_free(group->seed);
+ OPENSSL_free(group->propq);
OPENSSL_free(group);
}
if (a == NULL)
return NULL;
- if ((t = ec_group_new_ex(a->libctx, a->meth)) == NULL)
+ if ((t = ec_group_new_with_libctx(a->libctx, a->propq, a->meth)) == NULL)
return NULL;
if (!EC_GROUP_copy(t, a))
goto err;