From c23d2e3ef125a16f21ee5c62d856e0ed185f3ac0 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Fri, 18 Mar 2022 15:31:59 +0100 Subject: [PATCH] Wrap unused declaration in #if/#endif when USE_PSA is set in x509_csr_check() Signed-off-by: Neil Armstrong --- tests/suites/test_suite_x509write.function | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function index 7503b5e813..4aaacd2014 100644 --- a/tests/suites/test_suite_x509write.function +++ b/tests/suites/test_suite_x509write.function @@ -83,11 +83,14 @@ void x509_csr_check( char * key_file, char * cert_req_check_file, int md_type, mbedtls_pk_context key; mbedtls_x509write_csr req; unsigned char buf[4096]; - unsigned char check_buf[4000]; int ret; - size_t olen = 0, pem_len = 0, buf_index; - int der_len = -1; +#if !defined(MBEDTLS_USE_PSA_CRYPTO) + unsigned char check_buf[4000]; FILE *f; + size_t olen = 0; +#endif /* !MBEDTLS_USE_PSA_CRYPTO */ + size_t pem_len = 0, buf_index; + int der_len = -1; const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1"; mbedtls_test_rnd_pseudo_info rnd_info; @@ -121,9 +124,6 @@ void x509_csr_check( char * key_file, char * cert_req_check_file, int md_type, #if defined(MBEDTLS_USE_PSA_CRYPTO) // When using PSA crypto, RNG isn't controllable, so cert_req_check_file can't be used - (void)f; - (void)olen; - (void)check_buf; (void)cert_req_check_file; buf[pem_len] = '\0'; TEST_ASSERT( x509_crt_verifycsr( buf, pem_len + 1 ) == 0 ); @@ -135,7 +135,7 @@ void x509_csr_check( char * key_file, char * cert_req_check_file, int md_type, TEST_ASSERT( olen >= pem_len - 1 ); TEST_ASSERT( memcmp( buf, check_buf, pem_len - 1 ) == 0 ); -#endif +#endif /* MBEDTLS_USE_PSA_CRYPTO */ der_len = mbedtls_x509write_csr_der( &req, buf, sizeof( buf ), mbedtls_test_rnd_pseudo_rand,