give EC_GROUP_new_by_nid a more meanigful name:
EC_GROUP_new_by_nid -> EC_GROUP_new_by_curve_name
This commit is contained in:
parent
3afa6cf866
commit
8b15c74018
4
CHANGES
4
CHANGES
@ -774,14 +774,14 @@
|
|||||||
*) Include some named elliptic curves, and add OIDs from X9.62,
|
*) Include some named elliptic curves, and add OIDs from X9.62,
|
||||||
SECG, and WAP/WTLS. Each curve can be obtained from the new
|
SECG, and WAP/WTLS. Each curve can be obtained from the new
|
||||||
function
|
function
|
||||||
EC_GROUP_new_by_nid(),
|
EC_GROUP_new_by_curve_name(),
|
||||||
and the list of available named curves can be obtained with
|
and the list of available named curves can be obtained with
|
||||||
EC_get_builtin_curves().
|
EC_get_builtin_curves().
|
||||||
Also add a 'curve_name' member to EC_GROUP objects, which can be
|
Also add a 'curve_name' member to EC_GROUP objects, which can be
|
||||||
accessed via
|
accessed via
|
||||||
EC_GROUP_set_curve_name()
|
EC_GROUP_set_curve_name()
|
||||||
EC_GROUP_get_curve_name()
|
EC_GROUP_get_curve_name()
|
||||||
[Nils Larsch <nla@trustcenter.de, Bodo Moeller]
|
[Nils Larsch <larsch@trustcenter.de, Bodo Moeller]
|
||||||
|
|
||||||
*) Remove a few calls to bn_wexpand() in BN_sqr() (the one in there
|
*) Remove a few calls to bn_wexpand() in BN_sqr() (the one in there
|
||||||
was actually never needed) and in BN_mul(). The removal in BN_mul()
|
was actually never needed) and in BN_mul(). The removal in BN_mul()
|
||||||
|
@ -411,7 +411,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
group = EC_GROUP_new_by_nid(nid);
|
group = EC_GROUP_new_by_curve_name(nid);
|
||||||
if (group == NULL)
|
if (group == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
||||||
|
@ -999,7 +999,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecdh->group = EC_GROUP_new_by_nid(nid);
|
ecdh->group = EC_GROUP_new_by_curve_name(nid);
|
||||||
if (ecdh->group == NULL)
|
if (ecdh->group == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
BIO_printf(bio_err, "unable to create curve (%s)\n",
|
||||||
@ -1015,7 +1015,7 @@ bad:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
|
BIO_printf(bio_s_out,"Using default temp ECDH parameters\n");
|
||||||
ecdh->group=EC_GROUP_new_by_nid(NID_sect163r2);
|
ecdh->group=EC_GROUP_new_by_curve_name(NID_sect163r2);
|
||||||
if (ecdh->group == NULL)
|
if (ecdh->group == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
|
BIO_printf(bio_err, "unable to create curve (sect163r2)\n");
|
||||||
|
@ -2049,7 +2049,7 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ecdsa[j]->group = EC_GROUP_new_by_nid(test_curves[j]);
|
ecdsa[j]->group = EC_GROUP_new_by_curve_name(test_curves[j]);
|
||||||
/* Could not obtain group information */
|
/* Could not obtain group information */
|
||||||
if (ecdsa[j]->group == NULL)
|
if (ecdsa[j]->group == NULL)
|
||||||
{
|
{
|
||||||
@ -2168,7 +2168,7 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ecdh_a[j]->group = EC_GROUP_new_by_nid(test_curves[j]);
|
ecdh_a[j]->group = EC_GROUP_new_by_curve_name(test_curves[j]);
|
||||||
if (ecdh_a[j]->group == NULL)
|
if (ecdh_a[j]->group == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"ECDH failure.\n");
|
BIO_printf(bio_err,"ECDH failure.\n");
|
||||||
|
@ -338,7 +338,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
|
|||||||
eckey = ret->pkey.eckey;
|
eckey = ret->pkey.eckey;
|
||||||
if (eckey->group)
|
if (eckey->group)
|
||||||
EC_GROUP_free(eckey->group);
|
EC_GROUP_free(eckey->group);
|
||||||
if ((eckey->group = EC_GROUP_new_by_nid(
|
if ((eckey->group = EC_GROUP_new_by_curve_name(
|
||||||
OBJ_obj2nid(a->parameter->value.object))) == NULL)
|
OBJ_obj2nid(a->parameter->value.object))) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
EC_GROUP_set_asn1_flag(eckey->group,
|
EC_GROUP_set_asn1_flag(eckey->group,
|
||||||
|
@ -178,8 +178,9 @@ int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *);
|
|||||||
EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
|
EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
|
||||||
EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
|
EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
|
||||||
|
|
||||||
/* EC_GROUP_new_by_nid() creates a EC_GROUP structure specified by a NID */
|
/* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure
|
||||||
EC_GROUP *EC_GROUP_new_by_nid(int nid);
|
* specified by a curve name (in form of a NID) */
|
||||||
|
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
|
||||||
/* handling of internal curves */
|
/* handling of internal curves */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int nid;
|
int nid;
|
||||||
@ -428,7 +429,7 @@ void ERR_load_EC_strings(void);
|
|||||||
#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
|
#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
|
||||||
#define EC_F_EC_GROUP_GROUP2NID 147
|
#define EC_F_EC_GROUP_GROUP2NID 147
|
||||||
#define EC_F_EC_GROUP_NEW 108
|
#define EC_F_EC_GROUP_NEW 108
|
||||||
#define EC_F_EC_GROUP_NEW_BY_NID 174
|
#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174
|
||||||
#define EC_F_EC_GROUP_NEW_FROM_DATA 175
|
#define EC_F_EC_GROUP_NEW_FROM_DATA 175
|
||||||
#define EC_F_EC_GROUP_PRECOMPUTE_MULT 142
|
#define EC_F_EC_GROUP_PRECOMPUTE_MULT 142
|
||||||
#define EC_F_EC_GROUP_SET_CURVE_GF2M 176
|
#define EC_F_EC_GROUP_SET_CURVE_GF2M 176
|
||||||
|
@ -967,7 +967,7 @@ EC_GROUP *ec_asn1_pkparameters2group(const ECPKPARAMETERS *params)
|
|||||||
if (params->type == 0)
|
if (params->type == 0)
|
||||||
{ /* the curve is given by an OID */
|
{ /* the curve is given by an OID */
|
||||||
tmp = OBJ_obj2nid(params->value.named_curve);
|
tmp = OBJ_obj2nid(params->value.named_curve);
|
||||||
if ((ret = EC_GROUP_new_by_nid(tmp)) == NULL)
|
if ((ret = EC_GROUP_new_by_curve_name(tmp)) == NULL)
|
||||||
{
|
{
|
||||||
ECerr(EC_F_EC_ASN1_PKPARAMETERS2GROUP,
|
ECerr(EC_F_EC_ASN1_PKPARAMETERS2GROUP,
|
||||||
EC_R_EC_GROUP_NEW_BY_NAME_FAILURE);
|
EC_R_EC_GROUP_NEW_BY_NAME_FAILURE);
|
||||||
|
@ -1224,7 +1224,7 @@ err:
|
|||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
EC_GROUP *EC_GROUP_new_by_nid(int nid)
|
EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
EC_GROUP *ret = NULL;
|
EC_GROUP *ret = NULL;
|
||||||
@ -1241,7 +1241,7 @@ EC_GROUP *EC_GROUP_new_by_nid(int nid)
|
|||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
ECerr(EC_F_EC_GROUP_NEW_BY_NID, EC_R_UNKNOWN_GROUP);
|
ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static ERR_STRING_DATA EC_str_functs[]=
|
|||||||
{ERR_FUNC(EC_F_EC_GROUP_GET_TRINOMIAL_BASIS), "EC_GROUP_get_trinomial_basis"},
|
{ERR_FUNC(EC_F_EC_GROUP_GET_TRINOMIAL_BASIS), "EC_GROUP_get_trinomial_basis"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_GROUP2NID), "EC_GROUP_GROUP2NID"},
|
{ERR_FUNC(EC_F_EC_GROUP_GROUP2NID), "EC_GROUP_GROUP2NID"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_NEW), "EC_GROUP_new"},
|
{ERR_FUNC(EC_F_EC_GROUP_NEW), "EC_GROUP_new"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_NEW_BY_NID), "EC_GROUP_new_by_nid"},
|
{ERR_FUNC(EC_F_EC_GROUP_NEW_BY_CURVE_NAME), "EC_GROUP_new_by_curve_name"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_NEW_FROM_DATA), "EC_GROUP_NEW_FROM_DATA"},
|
{ERR_FUNC(EC_F_EC_GROUP_NEW_FROM_DATA), "EC_GROUP_NEW_FROM_DATA"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_PRECOMPUTE_MULT), "EC_GROUP_precompute_mult"},
|
{ERR_FUNC(EC_F_EC_GROUP_PRECOMPUTE_MULT), "EC_GROUP_precompute_mult"},
|
||||||
{ERR_FUNC(EC_F_EC_GROUP_SET_CURVE_GF2M), "EC_GROUP_set_curve_GF2m"},
|
{ERR_FUNC(EC_F_EC_GROUP_SET_CURVE_GF2M), "EC_GROUP_set_curve_GF2m"},
|
||||||
|
@ -1252,10 +1252,10 @@ void internal_curve_test(void)
|
|||||||
{
|
{
|
||||||
EC_GROUP *group = NULL;
|
EC_GROUP *group = NULL;
|
||||||
int nid = curves[n].nid;
|
int nid = curves[n].nid;
|
||||||
if ((group = EC_GROUP_new_by_nid(nid)) == NULL)
|
if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL)
|
||||||
{
|
{
|
||||||
ok = 0;
|
ok = 0;
|
||||||
fprintf(stdout, "\nEC_GROUP_new_by_nid() failed with"
|
fprintf(stdout, "\nEC_GROUP_new_curve_name() failed with"
|
||||||
" curve %s\n", OBJ_nid2sn(nid));
|
" curve %s\n", OBJ_nid2sn(nid));
|
||||||
/* try next curve */
|
/* try next curve */
|
||||||
continue;
|
continue;
|
||||||
|
@ -132,7 +132,7 @@ int test_ecdh_curve(int nid, char *text, BN_CTX *ctx, BIO *out)
|
|||||||
int i,alen,blen,aout,bout,ret=0;
|
int i,alen,blen,aout,bout,ret=0;
|
||||||
|
|
||||||
if ((a=EC_KEY_new()) == NULL) goto err;
|
if ((a=EC_KEY_new()) == NULL) goto err;
|
||||||
if ((a->group=EC_GROUP_new_by_nid(nid)) == NULL) goto err;
|
if ((a->group=EC_GROUP_new_by_curve_name(nid)) == NULL) goto err;
|
||||||
|
|
||||||
if ((b=EC_KEY_new()) == NULL) goto err;
|
if ((b=EC_KEY_new()) == NULL) goto err;
|
||||||
b->group = a->group;
|
b->group = a->group;
|
||||||
|
@ -203,7 +203,7 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
|
|||||||
/* create the key */
|
/* create the key */
|
||||||
if ((key = EC_KEY_new()) == NULL)
|
if ((key = EC_KEY_new()) == NULL)
|
||||||
goto x962_int_err;
|
goto x962_int_err;
|
||||||
if ((key->group = EC_GROUP_new_by_nid(nid)) == NULL)
|
if ((key->group = EC_GROUP_new_by_curve_name(nid)) == NULL)
|
||||||
goto x962_int_err;
|
goto x962_int_err;
|
||||||
if (!EC_KEY_generate_key(key))
|
if (!EC_KEY_generate_key(key))
|
||||||
goto x962_int_err;
|
goto x962_int_err;
|
||||||
@ -337,7 +337,7 @@ int test_builtin(BIO *out)
|
|||||||
/* create new ecdsa key (== EC_KEY) */
|
/* create new ecdsa key (== EC_KEY) */
|
||||||
if ((eckey = EC_KEY_new()) == NULL)
|
if ((eckey = EC_KEY_new()) == NULL)
|
||||||
goto builtin_err;
|
goto builtin_err;
|
||||||
if ((eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)
|
if ((eckey->group = EC_GROUP_new_by_curve_name(nid)) == NULL)
|
||||||
goto builtin_err;
|
goto builtin_err;
|
||||||
if (EC_GROUP_get_degree(eckey->group) < 160)
|
if (EC_GROUP_get_degree(eckey->group) < 160)
|
||||||
/* drop the curve */
|
/* drop the curve */
|
||||||
@ -356,7 +356,7 @@ int test_builtin(BIO *out)
|
|||||||
/* create second key */
|
/* create second key */
|
||||||
if ((wrong_eckey = EC_KEY_new()) == NULL)
|
if ((wrong_eckey = EC_KEY_new()) == NULL)
|
||||||
goto builtin_err;
|
goto builtin_err;
|
||||||
if ((wrong_eckey->group = EC_GROUP_new_by_nid(nid)) == NULL)
|
if ((wrong_eckey->group = EC_GROUP_new_by_curve_name(nid)) == NULL)
|
||||||
goto builtin_err;
|
goto builtin_err;
|
||||||
if (!EC_KEY_generate_key(wrong_eckey))
|
if (!EC_KEY_generate_key(wrong_eckey))
|
||||||
{
|
{
|
||||||
|
@ -262,7 +262,7 @@ EVP_PKEY *EVP_PKCS82PKEY (PKCS8_PRIV_KEY_INFO *p8)
|
|||||||
ERR_R_MALLOC_FAILURE);
|
ERR_R_MALLOC_FAILURE);
|
||||||
goto ecerr;
|
goto ecerr;
|
||||||
}
|
}
|
||||||
if ((eckey->group = EC_GROUP_new_by_nid(
|
if ((eckey->group = EC_GROUP_new_by_curve_name(
|
||||||
OBJ_obj2nid(a->parameter->value.object))) == NULL)
|
OBJ_obj2nid(a->parameter->value.object))) == NULL)
|
||||||
goto ecerr;
|
goto ecerr;
|
||||||
EC_GROUP_set_asn1_flag(eckey->group,
|
EC_GROUP_set_asn1_flag(eckey->group,
|
||||||
|
@ -1214,7 +1214,7 @@ int ssl3_get_key_exchange(SSL *s)
|
|||||||
goto f_err;
|
goto f_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ecdh->group=EC_GROUP_new_by_nid(curve_nid)))
|
if (!(ecdh->group=EC_GROUP_new_by_curve_name(curve_nid)))
|
||||||
{
|
{
|
||||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_EC_LIB);
|
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_EC_LIB);
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -734,7 +734,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecdh->group = EC_GROUP_new_by_nid(nid);
|
ecdh->group = EC_GROUP_new_by_curve_name(nid);
|
||||||
if (ecdh->group == NULL)
|
if (ecdh->group == NULL)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err, "unable to create curve (%s)\n", named_curve);
|
BIO_printf(bio_err, "unable to create curve (%s)\n", named_curve);
|
||||||
@ -744,7 +744,7 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ecdh->group == NULL)
|
if (ecdh->group == NULL)
|
||||||
ecdh->group=EC_GROUP_new_by_nid(NID_sect163r2);
|
ecdh->group=EC_GROUP_new_by_curve_name(NID_sect163r2);
|
||||||
|
|
||||||
SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
|
SSL_CTX_set_tmp_ecdh(s_ctx, ecdh);
|
||||||
SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
|
SSL_CTX_set_options(s_ctx, SSL_OP_SINGLE_ECDH_USE);
|
||||||
|
@ -2906,7 +2906,7 @@ EC_POINT_set_affine_coords_GF2m 3340 EXIST:VMS:FUNCTION:EC
|
|||||||
BN_GF2m_mod_exp_arr 3341 EXIST::FUNCTION:
|
BN_GF2m_mod_exp_arr 3341 EXIST::FUNCTION:
|
||||||
STORE_ATTR_INFO_modify_number 3342 EXIST::FUNCTION:
|
STORE_ATTR_INFO_modify_number 3342 EXIST::FUNCTION:
|
||||||
X509_keyid_get0 3343 EXIST::FUNCTION:
|
X509_keyid_get0 3343 EXIST::FUNCTION:
|
||||||
EC_GROUP_new_by_nid 3344 EXIST::FUNCTION:EC
|
EC_GROUP_new_by_curve_name 3344 EXIST::FUNCTION:EC
|
||||||
ENGINE_load_gmp 3345 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE
|
ENGINE_load_gmp 3345 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE
|
||||||
pitem_new 3346 EXIST::FUNCTION:
|
pitem_new 3346 EXIST::FUNCTION:
|
||||||
BN_GF2m_mod_mul_arr 3347 EXIST::FUNCTION:
|
BN_GF2m_mod_mul_arr 3347 EXIST::FUNCTION:
|
||||||
|
Loading…
Reference in New Issue
Block a user