library: debug: add PK_WRITE_C guard to mbedtls_debug_print_crt()

In tf-psa-crypto "mbedtls_pk_write_pubkey_psa()" is only available when
MBEDTLS_PK_WRITE_C is defined. Therefore we need to add this guard also
in mbedtls to "debug_print_pk" (and indirectly to
"mbedtls_debug_print_crt") and the corresponding tests using it.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti
2025-12-16 09:41:41 +01:00
parent 3c419c1ca3
commit af62bae5c1
2 changed files with 4 additions and 3 deletions

View File

@@ -178,7 +178,8 @@ void mbedtls_debug_print_buf(const mbedtls_ssl_context *ssl, int level,
MBEDTLS_DEBUG_PRINT_BUF_ADD_TEXT);
}
#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO)
#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO) && \
defined(MBEDTLS_PK_WRITE_C)
static void debug_print_pk(const mbedtls_ssl_context *ssl, int level,
const char *file, int line,
const char *text, const mbedtls_pk_context *pk)
@@ -250,6 +251,6 @@ void mbedtls_debug_print_crt(const mbedtls_ssl_context *ssl, int level,
crt = crt->next;
}
}
#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_X509_REMOVE_INFO */
#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_X509_REMOVE_INFO && MBEDTLS_PK_WRITE_C */
#endif /* MBEDTLS_DEBUG_C */