From 5b118d4aed8b3e211c00d55c48298aea5f14c03f Mon Sep 17 00:00:00 2001 From: Yanray Wang Date: Tue, 5 Dec 2023 10:31:54 +0800 Subject: [PATCH] Check MBEDTLS_PK_{PARSE,WRITE}_C requires MBEDTLS_OID_C - check_config.h: add this dependency check - mbedtls_config.h: update corresponding requirement documentation Signed-off-by: Yanray Wang --- include/mbedtls/check_config.h | 16 ++++------------ include/mbedtls/mbedtls_config.h | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index af78087b1..6aa87b8a9 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -436,24 +436,16 @@ #error "MBEDTLS_PK_C defined, but not all prerequisites" #endif -#if defined(MBEDTLS_PK_PARSE_C) && !defined(MBEDTLS_PK_C) +#if defined(MBEDTLS_PK_PARSE_C) && \ + (!defined(MBEDTLS_PK_C) || !defined(MBEDTLS_OID_C)) #error "MBEDTLS_PK_PARSE_C defined, but not all prerequisites" #endif -#if defined(MBEDTLS_PK_WRITE_C) && !defined(MBEDTLS_PK_C) +#if defined(MBEDTLS_PK_WRITE_C) && \ + (!defined(MBEDTLS_PK_C) || !defined(MBEDTLS_OID_C)) #error "MBEDTLS_PK_WRITE_C defined, but not all prerequisites" #endif -#if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_PK_HAVE_ECC_KEYS) && \ - !defined(MBEDTLS_OID_C) -#error "MBEDTLS_PK_PARSE_C and MBEDTLS_PK_HAVE_ECC_KEYS require MBEDTLS_OID_C" -#endif - -#if defined(MBEDTLS_PK_WRITE_C) && defined(MBEDTLS_PK_HAVE_ECC_KEYS) && \ - !defined(MBEDTLS_OID_C) -#error "MBEDTLS_PK_WRITE_C and MBEDTLS_PK_HAVE_ECC_KEYS require MBEDTLS_OID_C" -#endif - #if defined(MBEDTLS_PLATFORM_EXIT_ALT) && !defined(MBEDTLS_PLATFORM_C) #error "MBEDTLS_PLATFORM_EXIT_ALT defined, but not all prerequisites" #endif diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h index 6a5828c74..edf4a0b30 100644 --- a/include/mbedtls/mbedtls_config.h +++ b/include/mbedtls/mbedtls_config.h @@ -3059,7 +3059,7 @@ * Caller: library/x509_crt.c * library/x509_csr.c * - * Requires: MBEDTLS_PK_C + * Requires: MBEDTLS_PK_C, MBEDTLS_OID_C * * Uncomment to enable generic public key parse functions. */ @@ -3073,7 +3073,7 @@ * Module: library/pkwrite.c * Caller: library/x509write.c * - * Requires: MBEDTLS_PK_C + * Requires: MBEDTLS_PK_C, MBEDTLS_OID_C * * Uncomment to enable generic public key write functions. */