pkparse: add new function for deriving public key from private using PSA
Instead of using the legacy mbedtls_ecp_mul() function which makes use of
ECP's math, this commit adds a new function named pk_derive_public_key()
which implements the same behavior using PSA functions.
The flow is simple:
- import the private key into PSA
- export its public part
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function
index 1a6858f..5e4f3b7 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -101,6 +101,10 @@
mbedtls_pk_context ctx;
int res;
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ PSA_INIT();
+#endif
+
mbedtls_pk_init(&ctx);
res = mbedtls_pk_parse_keyfile(&ctx, key_file, password,
@@ -117,6 +121,9 @@
exit:
mbedtls_pk_free(&ctx);
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+ PSA_DONE();
+#endif
}
/* END_CASE */