summaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-09-24 10:42:23 +0100
committerMatt Caswell <matt@openssl.org>2020-10-01 09:25:20 +0100
commitd8652be06e2778e8898453a391deb7253e1a35a2 (patch)
treefe40e22edb39642aa7ae633320c1900388f2e7ee /crypto/ec
parentaedac96c1172ca9a9efe72e027e935504b599e2f (diff)
Run the withlibctx.pl script
Automatically rename all instances of _with_libctx() to _ex() as per our coding style. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12970)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_ameth.c15
-rw-r--r--crypto/ec/ec_curve.c12
-rw-r--r--crypto/ec/ec_cvt.c4
-rw-r--r--crypto/ec/ec_key.c15
-rw-r--r--crypto/ec/ec_lib.c13
-rw-r--r--crypto/ec/ec_local.h4
-rw-r--r--crypto/ec/ecx_meth.c13
7 files changed, 35 insertions, 41 deletions
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index 3312faa336..4bbbabff07 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -112,7 +112,7 @@ static EC_KEY *eckey_type2param(int ptype, const void *pval,
EC_KEY *eckey = NULL;
EC_GROUP *group = NULL;
- if ((eckey = EC_KEY_new_with_libctx(libctx, propq)) == NULL) {
+ if ((eckey = EC_KEY_new_ex(libctx, propq)) == NULL) {
ECerr(EC_F_ECKEY_TYPE2PARAM, ERR_R_MALLOC_FAILURE);
goto ecerr;
}
@@ -134,8 +134,7 @@ static EC_KEY *eckey_type2param(int ptype, const void *pval,
* type == V_ASN1_OBJECT => the parameters are given by an asn1 OID
*/
- group = EC_GROUP_new_by_curve_name_with_libctx(libctx, propq,
- OBJ_obj2nid(poid));
+ group = EC_GROUP_new_by_curve_name_ex(libctx, propq, OBJ_obj2nid(poid));
if (group == NULL)
goto ecerr;
EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
@@ -206,10 +205,8 @@ static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
return -2;
}
-static int eckey_priv_decode_with_libctx(EVP_PKEY *pkey,
- const PKCS8_PRIV_KEY_INFO *p8,
- OPENSSL_CTX *libctx,
- const char *propq)
+static int eckey_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
+ OPENSSL_CTX *libctx, const char *propq)
{
const unsigned char *p = NULL;
const void *pval;
@@ -744,7 +741,7 @@ static int ec_pkey_import_from(const OSSL_PARAM params[], void *vpctx)
{
EVP_PKEY_CTX *pctx = vpctx;
EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx);
- EC_KEY *ec = EC_KEY_new_with_libctx(pctx->libctx, pctx->propquery);
+ EC_KEY *ec = EC_KEY_new_ex(pctx->libctx, pctx->propquery);
if (ec == NULL) {
ERR_raise(ERR_LIB_DH, ERR_R_MALLOC_FAILURE);
@@ -808,7 +805,7 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
ec_pkey_dirty_cnt,
ec_pkey_export_to,
ec_pkey_import_from,
- eckey_priv_decode_with_libctx
+ eckey_priv_decode_ex
};
#if !defined(OPENSSL_NO_SM2)
diff --git a/crypto/ec/ec_curve.c b/crypto/ec/ec_curve.c
index a63a8535c3..d8f46f4849 100644
--- a/crypto/ec/ec_curve.c
+++ b/crypto/ec/ec_curve.c
@@ -3197,8 +3197,8 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
/* If no curve data curve method must handle everything */
if (curve.data == NULL)
- return ec_group_new_with_libctx(libctx, propq,
- curve.meth != NULL ? curve.meth() : NULL);
+ return ec_group_new_ex(libctx, propq,
+ curve.meth != NULL ? curve.meth() : NULL);
if ((ctx = BN_CTX_new_ex(libctx)) == NULL) {
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_MALLOC_FAILURE);
@@ -3220,7 +3220,7 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
if (curve.meth != 0) {
meth = curve.meth();
- if (((group = ec_group_new_with_libctx(libctx, propq, meth)) == NULL) ||
+ if (((group = ec_group_new_ex(libctx, propq, meth)) == NULL) ||
(!(group->meth->group_set_curve(group, p, a, b, ctx)))) {
ECerr(EC_F_EC_GROUP_NEW_FROM_DATA, ERR_R_EC_LIB);
goto err;
@@ -3290,8 +3290,8 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
return group;
}
-EC_GROUP *EC_GROUP_new_by_curve_name_with_libctx(OPENSSL_CTX *libctx,
- const char *propq, int nid)
+EC_GROUP *EC_GROUP_new_by_curve_name_ex(OPENSSL_CTX *libctx, const char *propq,
+ int nid)
{
EC_GROUP *ret = NULL;
const ec_list_element *curve;
@@ -3311,7 +3311,7 @@ EC_GROUP *EC_GROUP_new_by_curve_name_with_libctx(OPENSSL_CTX *libctx,
#ifndef FIPS_MODULE
EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
{
- return EC_GROUP_new_by_curve_name_with_libctx(NULL, NULL, nid);
+ return EC_GROUP_new_by_curve_name_ex(NULL, NULL, nid);
}
#endif
diff --git a/crypto/ec/ec_cvt.c b/crypto/ec/ec_cvt.c
index e5e6f10ce4..57e53d752e 100644
--- a/crypto/ec/ec_cvt.c
+++ b/crypto/ec/ec_cvt.c
@@ -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_with_libctx(bn_get_lib_ctx(ctx), NULL, meth);
+ ret = ec_group_new_ex(bn_get_lib_ctx(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_with_libctx(bn_get_lib_ctx(ctx), NULL, meth);
+ ret = ec_group_new_ex(bn_get_lib_ctx(ctx), NULL, meth);
if (ret == NULL)
return NULL;
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 89a28622bb..807b5e670a 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -34,18 +34,18 @@ EC_KEY *EC_KEY_new(void)
}
#endif
-EC_KEY *EC_KEY_new_with_libctx(OPENSSL_CTX *ctx, const char *propq)
+EC_KEY *EC_KEY_new_ex(OPENSSL_CTX *ctx, const char *propq)
{
return ec_key_new_method_int(ctx, propq, NULL);
}
-EC_KEY *EC_KEY_new_by_curve_name_with_libctx(OPENSSL_CTX *ctx,
- const char *propq, int nid)
+EC_KEY *EC_KEY_new_by_curve_name_ex(OPENSSL_CTX *ctx, const char *propq,
+ int nid)
{
- EC_KEY *ret = EC_KEY_new_with_libctx(ctx, propq);
+ EC_KEY *ret = EC_KEY_new_ex(ctx, propq);
if (ret == NULL)
return NULL;
- ret->group = EC_GROUP_new_by_curve_name_with_libctx(ctx, propq, nid);
+ ret->group = EC_GROUP_new_by_curve_name_ex(ctx, propq, nid);
if (ret->group == NULL) {
EC_KEY_free(ret);
return NULL;
@@ -61,7 +61,7 @@ EC_KEY *EC_KEY_new_by_curve_name_with_libctx(OPENSSL_CTX *ctx,
#ifndef FIPS_MODULE
EC_KEY *EC_KEY_new_by_curve_name(int nid)
{
- return EC_KEY_new_by_curve_name_with_libctx(NULL, NULL, nid);
+ return EC_KEY_new_by_curve_name_ex(NULL, NULL, nid);
}
#endif
@@ -122,8 +122,7 @@ 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_with_libctx(src->libctx, src->propq,
- src->group->meth);
+ dest->group = 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))
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c
index 222df55632..72ada1f723 100644
--- a/crypto/ec/ec_lib.c
+++ b/crypto/ec/ec_lib.c
@@ -26,8 +26,8 @@
/* functions for EC_GROUP objects */
-EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq,
- const EC_METHOD *meth)
+EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq,
+ const EC_METHOD *meth)
{
EC_GROUP *ret;
@@ -81,7 +81,7 @@ EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq,
# ifndef FIPS_MODULE
EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
{
- return ec_group_new_with_libctx(NULL, NULL, meth);
+ return 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_with_libctx(a->libctx, a->propq, a->meth)) == NULL)
+ if ((t = ec_group_new_ex(a->libctx, a->propq, a->meth)) == NULL)
return NULL;
if (!EC_GROUP_copy(t, a))
goto err;
@@ -1438,8 +1438,7 @@ static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group,
curve_name_nid = NID_secp224r1;
#endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */
- ret_group = EC_GROUP_new_by_curve_name_with_libctx(libctx, propq,
- curve_name_nid);
+ ret_group = EC_GROUP_new_by_curve_name_ex(libctx, propq, curve_name_nid);
if (ret_group == NULL)
goto err;
@@ -1522,7 +1521,7 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
ECerr(0, EC_R_INVALID_CURVE);
return NULL;
} else {
- return EC_GROUP_new_by_curve_name_with_libctx(libctx, propq, nid);
+ return EC_GROUP_new_by_curve_name_ex(libctx, propq, nid);
}
}
return NULL;
diff --git a/crypto/ec/ec_local.h b/crypto/ec/ec_local.h
index 11fab6b985..33f40167aa 100644
--- a/crypto/ec/ec_local.h
+++ b/crypto/ec/ec_local.h
@@ -601,8 +601,8 @@ int ec_group_simple_order_bits(const EC_GROUP *group);
* \param meth EC_METHOD to use
* \return newly created EC_GROUP object or NULL in case of an error.
*/
-EC_GROUP *ec_group_new_with_libctx(OPENSSL_CTX *libctx, const char *propq,
- const EC_METHOD *meth);
+EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq,
+ const EC_METHOD *meth);
#ifdef ECP_NISTZ256_ASM
/** Returns GFp methods using montgomery multiplication, with x86-64 optimized
diff --git a/crypto/ec/ecx_meth.c b/crypto/ec/ecx_meth.c
index 99f1e480c1..9aab96a050 100644
--- a/crypto/ec/ecx_meth.c
+++ b/crypto/ec/ecx_meth.c
@@ -149,9 +149,8 @@ static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
return CRYPTO_memcmp(akey->pubkey, bkey->pubkey, KEYLEN(a)) == 0;
}
-static int ecx_priv_decode_with_libctx(EVP_PKEY *pkey,
- const PKCS8_PRIV_KEY_INFO *p8,
- OPENSSL_CTX *libctx, const char *propq)
+static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
+ OPENSSL_CTX *libctx, const char *propq)
{
const unsigned char *p;
int plen;
@@ -505,7 +504,7 @@ const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = {
ecx_pkey_export_to,
x25519_import_from,
- ecx_priv_decode_with_libctx
+ ecx_priv_decode_ex
};
static int x448_import_from(const OSSL_PARAM params[], void *vpctx)
@@ -558,7 +557,7 @@ const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = {
ecx_pkey_export_to,
x448_import_from,
- ecx_priv_decode_with_libctx
+ ecx_priv_decode_ex
};
static int ecd_size25519(const EVP_PKEY *pkey)
@@ -684,7 +683,7 @@ const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
ecx_pkey_export_to,
ed25519_import_from,
- ecx_priv_decode_with_libctx
+ ecx_priv_decode_ex
};
static int ed448_import_from(const OSSL_PARAM params[], void *vpctx)
@@ -736,7 +735,7 @@ const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = {
ecx_pkey_export_to,
ed448_import_from,
- ecx_priv_decode_with_libctx
+ ecx_priv_decode_ex
};
static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)