test_suite_pk: replace USE_PSA with CRYPTO_C in tests using mbedtls_pk_setup_opaque()
This commit also fix guards for mbedtls_pk_can_do_ext().
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/include/mbedtls/pk.h b/include/mbedtls/pk.h
index 9316307..d3d6f6d 100644
--- a/include/mbedtls/pk.h
+++ b/include/mbedtls/pk.h
@@ -447,7 +447,7 @@
*/
int mbedtls_pk_can_do(const mbedtls_pk_context *ctx, mbedtls_pk_type_t type);
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
+#if defined(MBEDTLS_PSA_CRYPTO_C)
/**
* \brief Tell if context can do the operation given by PSA algorithm
*
@@ -477,7 +477,7 @@
*/
int mbedtls_pk_can_do_ext(const mbedtls_pk_context *ctx, psa_algorithm_t alg,
psa_key_usage_t usage);
-#endif /* MBEDTLS_USE_PSA_CRYPTO */
+#endif /* MBEDTLS_PSA_CRYPTO_C */
#if defined(MBEDTLS_PSA_CRYPTO_C)
/**
diff --git a/library/pk.c b/library/pk.c
index e7a2af4..87b1d8f 100644
--- a/library/pk.c
+++ b/library/pk.c
@@ -238,7 +238,7 @@
return ctx->pk_info->can_do(type);
}
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
+#if defined(MBEDTLS_PSA_CRYPTO_C)
/*
* Tell if a PK can do the operations of the given PSA algorithm
*/
@@ -376,7 +376,7 @@
return 0;
}
-#endif /* MBEDTLS_USE_PSA_CRYPTO */
+#endif /* MBEDTLS_PSA_CRYPTO_C */
#if defined(MBEDTLS_PSA_CRYPTO_C)
#if defined(MBEDTLS_RSA_C)
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index ff843cb..a625b56 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -332,7 +332,7 @@
}
#endif
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
+#if defined(MBEDTLS_PSA_CRYPTO_C)
/*
* Generate an ECC key using PSA and return the key identifier of that key,
@@ -377,7 +377,7 @@
exit:
return key;
}
-#endif /* MBEDTLS_USE_PSA_CRYPTO */
+#endif /* MBEDTLS_PSA_CRYPTO_C */
/* END_HEADER */
/* BEGIN_DEPENDENCIES
@@ -385,7 +385,7 @@
* END_DEPENDENCIES
*/
-/* BEGIN_CASE depends_on:MBEDTLS_USE_PSA_CRYPTO */
+/* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C */
void pk_psa_utils(int key_is_rsa)
{
mbedtls_pk_context pk, pk2;
@@ -487,7 +487,7 @@
}
/* END_CASE */
-/* BEGIN_CASE depends_on:MBEDTLS_USE_PSA_CRYPTO */
+/* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C */
void pk_can_do_ext(int opaque_key, int key_type, int key_usage, int key_alg,
int key_alg2, int curve_or_keybits, int alg_check, int usage_check,
int result)