summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ec/ec_key.c')
-rw-r--r--crypto/ec/ec_key.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 30c524726d..50b53f97ed 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -30,13 +30,13 @@ static int ecdsa_keygen_pairwise_test(EC_KEY *eckey, OSSL_CALLBACK *cb,
#ifndef FIPS_MODULE
EC_KEY *EC_KEY_new(void)
{
- return ec_key_new_method_int(NULL, NULL, NULL);
+ return ossl_ec_key_new_method_int(NULL, NULL, NULL);
}
#endif
EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq)
{
- return ec_key_new_method_int(ctx, propq, NULL);
+ return ossl_ec_key_new_method_int(ctx, propq, NULL);
}
EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,
@@ -122,7 +122,8 @@ 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_ex(src->libctx, src->propq, src->group->meth);
+ dest->group = ossl_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))
@@ -183,8 +184,8 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
EC_KEY *EC_KEY_dup(const EC_KEY *ec_key)
{
- EC_KEY *ret = ec_key_new_method_int(ec_key->libctx, ec_key->propq,
- ec_key->engine);
+ EC_KEY *ret = ossl_ec_key_new_method_int(ec_key->libctx, ec_key->propq,
+ ec_key->engine);
if (ret == NULL)
return NULL;
@@ -357,12 +358,12 @@ err:
return ok;
}
-int ec_key_simple_generate_key(EC_KEY *eckey)
+int ossl_ec_key_simple_generate_key(EC_KEY *eckey)
{
return ec_generate_key(eckey, 0);
}
-int ec_key_simple_generate_public_key(EC_KEY *eckey)
+int ossl_ec_key_simple_generate_public_key(EC_KEY *eckey)
{
int ret;
BN_CTX *ctx = BN_CTX_new_ex(eckey->libctx);
@@ -445,7 +446,7 @@ err:
* ECC Partial Public-Key Validation as specified in SP800-56A R3
* Section 5.6.2.3.4 ECC Partial Public-Key Validation Routine.
*/
-int ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
+int ossl_ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
{
if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
@@ -476,13 +477,13 @@ int ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx)
* ECC Key validation as specified in SP800-56A R3.
* Section 5.6.2.3.3 ECC Full Public-Key Validation Routine.
*/
-int ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx)
+int ossl_ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx)
{
int ret = 0;
EC_POINT *point = NULL;
const BIGNUM *order = NULL;
- if (!ec_key_public_check_quick(eckey, ctx))
+ if (!ossl_ec_key_public_check_quick(eckey, ctx))
return 0;
point = EC_POINT_new(eckey->group);
@@ -514,7 +515,7 @@ err:
* Section 5.6.2.1.2 Owner Assurance of Private-Key Validity
* The private key is in the range [1, order-1]
*/
-int ec_key_private_check(const EC_KEY *eckey)
+int ossl_ec_key_private_check(const EC_KEY *eckey)
{
if (eckey == NULL || eckey->group == NULL || eckey->priv_key == NULL) {
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
@@ -533,7 +534,7 @@ int ec_key_private_check(const EC_KEY *eckey)
* Section 5.6.2.1.4 Owner Assurance of Pair-wise Consistency (b)
* Check if generator * priv_key = pub_key
*/
-int ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx)
+int ossl_ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx)
{
int ret = 0;
EC_POINT *point = NULL;
@@ -576,7 +577,7 @@ err:
* an approved elliptic-curve group is used.
* Returns 1 if the key is valid, otherwise it returns 0.
*/
-int ec_key_simple_check_key(const EC_KEY *eckey)
+int ossl_ec_key_simple_check_key(const EC_KEY *eckey)
{
int ok = 0;
BN_CTX *ctx = NULL;
@@ -588,12 +589,12 @@ int ec_key_simple_check_key(const EC_KEY *eckey)
if ((ctx = BN_CTX_new_ex(eckey->libctx)) == NULL)
return 0;
- if (!ec_key_public_check(eckey, ctx))
+ if (!ossl_ec_key_public_check(eckey, ctx))
goto err;
if (eckey->priv_key != NULL) {
- if (!ec_key_private_check(eckey)
- || !ec_key_pairwise_check(eckey, ctx))
+ if (!ossl_ec_key_private_check(eckey)
+ || !ossl_ec_key_pairwise_check(eckey, ctx))
goto err;
}
ok = 1;
@@ -660,17 +661,17 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
}
-OSSL_LIB_CTX *ec_key_get_libctx(const EC_KEY *key)
+OSSL_LIB_CTX *ossl_ec_key_get_libctx(const EC_KEY *key)
{
return key->libctx;
}
-const char *ec_key_get0_propq(const EC_KEY *key)
+const char *ossl_ec_key_get0_propq(const EC_KEY *key)
{
return key->propq;
}
-void ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx)
+void ossl_ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx)
{
key->libctx = libctx;
/* Do we need to propagate this to the group? */
@@ -903,8 +904,8 @@ size_t EC_KEY_priv2oct(const EC_KEY *eckey,
return eckey->group->meth->priv2oct(eckey, buf, len);
}
-size_t ec_key_simple_priv2oct(const EC_KEY *eckey,
- unsigned char *buf, size_t len)
+size_t ossl_ec_key_simple_priv2oct(const EC_KEY *eckey,
+ unsigned char *buf, size_t len)
{
size_t buf_len;
@@ -942,7 +943,8 @@ int EC_KEY_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
return ret;
}
-int ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len)
+int ossl_ec_key_simple_oct2priv(EC_KEY *eckey, const unsigned char *buf,
+ size_t len)
{
if (eckey->priv_key == NULL)
eckey->priv_key = BN_secure_new();