check_config: request at least 1 builtin EC alg if there is at least 1 builtin curve
This slightly changes the previous requirement. Instead of enabling
ALL builtin EC algs when there is at least 1 built in curve, we ask
for at least one built alg if there is at least one builtin curve.
This relaxes the previous check while still keeping the base idea:
there must be a reason for which builtin curves are included into
the build.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h
index 37e38bd..f333f2e 100644
--- a/include/mbedtls/check_config.h
+++ b/include/mbedtls/check_config.h
@@ -125,6 +125,12 @@
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG || MBEDTLS_PSA_CRYPTO_C */
+#if defined(MBEDTLS_SOME_BUILTIN_EC) && \
+ !(defined(MBEDTLS_ECDSA_C) || defined(MBEDTLS_ECDSA_DETERMINISTIC) || \
+ defined(MBEDTLS_ECDH_C))
+#error "Some builtin curve is included, but there is no algorighm using it"
+#endif
+
#if defined(MBEDTLS_CTR_DRBG_C) && !defined(MBEDTLS_AES_C)
#error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
#endif