pk: remove useless internal function
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/pk.c b/library/pk.c
index aa8e997..52eb0d5 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -196,42 +196,6 @@
}
#endif /* MBEDTLS_USE_PSA_CRYPTO */
-#if defined(MBEDTLS_PK_USE_PSA_EC_DATA)
-int mbedtls_pk_update_public_key_from_keypair(mbedtls_pk_context *pk,
- mbedtls_ecp_keypair *ecp_keypair)
-{
- int ret = MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;
-
- if (pk == NULL) {
- return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
- }
- /* The raw public key storing mechanism is only supported for EC keys so
- * we fail silently for other ones. */
- if ((pk->pk_info->type != MBEDTLS_PK_ECKEY) &&
- (pk->pk_info->type != MBEDTLS_PK_ECKEY_DH) &&
- (pk->pk_info->type != MBEDTLS_PK_ECDSA)) {
- return 0;
- }
-
- ret = mbedtls_ecp_point_write_binary(&ecp_keypair->grp, &ecp_keypair->Q,
- MBEDTLS_ECP_PF_UNCOMPRESSED,
- &pk->pub_raw_len,
- pk->pub_raw,
- MBEDTLS_PK_MAX_EC_PUBKEY_RAW_LEN);
- if (ret != 0) {
- return ret;
- }
-
- pk->ec_family = mbedtls_ecc_group_to_psa(ecp_keypair->grp.id,
- &pk->ec_bits);
- if (pk->ec_family == 0) {
- return MBEDTLS_ERR_PK_BAD_INPUT_DATA;
- }
-
- return 0;
-}
-#endif /* MBEDTLS_PK_USE_PSA_EC_DATA */
-
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/*
* Initialize an RSA-alt context
diff --git a/library/pk_internal.h b/library/pk_internal.h
index 263a1c7..3d05f57 100644
--- a/library/pk_internal.h
+++ b/library/pk_internal.h
@@ -117,19 +117,5 @@
#endif /* MBEDTLS_ECP_DP_CURVE25519_ENABLED || MBEDTLS_ECP_DP_CURVE448_ENABLED */
#endif /* MBEDTLS_PK_HAVE_ECC_KEYS */
-#if defined(MBEDTLS_PK_USE_PSA_EC_DATA)
-/**
- * \brief Copy the public key content in raw format from "ctx->pk_ctx"
- * (which is an ecp_keypair) into the internal "ctx->pub_raw" buffer.
- *
- * \note This is a temporary function that can be removed as soon as the pk
- * module is free from ECP_C
- *
- * \param pk It is the pk_context which is going to be updated. It acts both
- * as input and output.
- */
-int mbedtls_pk_update_public_key_from_keypair(mbedtls_pk_context *pk,
- mbedtls_ecp_keypair *ecp_keypair);
-#endif /* MBEDTLS_PK_USE_PSA_EC_DATA */
#endif /* MBEDTLS_PK_INTERNAL_H */
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 150296e..4074e13 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -728,15 +728,10 @@
TEST_ASSERT(mbedtls_pk_can_do(&pk, MBEDTLS_PK_ECDSA));
#if defined(MBEDTLS_PK_USE_PSA_EC_DATA)
- mbedtls_ecp_keypair ecp;
- mbedtls_ecp_keypair_init(&ecp);
-
- TEST_ASSERT(mbedtls_ecp_group_load(&ecp.grp, id) == 0);
- TEST_ASSERT(mbedtls_ecp_point_read_binary(&ecp.grp, &ecp.Q,
- key->x, key->len) == 0);
- TEST_ASSERT(mbedtls_pk_update_public_key_from_keypair(&pk, &ecp) == 0);
-
- mbedtls_ecp_keypair_free(&ecp);
+ TEST_ASSERT(key->len <= MBEDTLS_PK_MAX_EC_PUBKEY_RAW_LEN);
+ memcpy(pk.pub_raw, key->x, key->len);
+ pk.ec_family = mbedtls_ecc_group_to_psa(id, &(pk.ec_bits));
+ pk.pub_raw_len = key->len;
#else
mbedtls_ecp_keypair *eckey = (mbedtls_ecp_keypair *) mbedtls_pk_ec(pk);