#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,
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))
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;
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);
* 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);
* 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);
* 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);
* 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;
* 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;
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;
}
-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? */
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;
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();