From f7dca865220fc32b2bd48ceaa7f66b20fa8533e1 Mon Sep 17 00:00:00 2001 From: Jaeden Amero Date: Thu, 27 Jun 2019 17:31:33 +0100 Subject: [PATCH] Allow building with the -Wunused flag Make some functions non-static, to avoid Wunused function warnings. Make a function scoped variable block scoped instead, to avoid Wunused variable warnings in some configurations. --- tests/suites/test_suite_entropy.function | 8 ++++---- tests/suites/test_suite_psa_crypto.function | 8 ++++---- .../suites/test_suite_psa_crypto_slot_management.function | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function index 0b1cfe80d4..46137da638 100644 --- a/tests/suites/test_suite_entropy.function +++ b/tests/suites/test_suite_entropy.function @@ -48,7 +48,7 @@ static int entropy_dummy_source( void *data, unsigned char *output, * This might break memory checks in the future if sources need 'free-ing' then * as well. */ -static void entropy_clear_sources( mbedtls_entropy_context *ctx ) +void entropy_clear_sources( mbedtls_entropy_context *ctx ) { ctx->source_count = 0; } @@ -58,7 +58,7 @@ static void entropy_clear_sources( mbedtls_entropy_context *ctx ) */ static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE]; -static int buffer_nv_seed_read( unsigned char *buf, size_t buf_len ) +int buffer_nv_seed_read( unsigned char *buf, size_t buf_len ) { if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE ) return( -1 ); @@ -67,7 +67,7 @@ static int buffer_nv_seed_read( unsigned char *buf, size_t buf_len ) return( 0 ); } -static int buffer_nv_seed_write( unsigned char *buf, size_t buf_len ) +int buffer_nv_seed_write( unsigned char *buf, size_t buf_len ) { if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE ) return( -1 ); @@ -98,7 +98,7 @@ static int write_nv_seed( unsigned char *buf, size_t buf_len ) return( 0 ); } -static int read_nv_seed( unsigned char *buf, size_t buf_len ) +int read_nv_seed( unsigned char *buf, size_t buf_len ) { FILE *f; diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index 597e391cc6..9626c3969f 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -604,9 +604,9 @@ exit: return( ok ); } -static int asn1_skip_integer( unsigned char **p, const unsigned char *end, - size_t min_bits, size_t max_bits, - int must_be_odd ) +int asn1_skip_integer( unsigned char **p, const unsigned char *end, + size_t min_bits, size_t max_bits, + int must_be_odd ) { size_t len; size_t actual_bits; @@ -731,10 +731,10 @@ static int exported_key_sanity_check( psa_key_type_t type, size_t bits, { uint8_t *p = exported; uint8_t *end = exported + exported_length; - size_t len; #if defined(MBEDTLS_RSA_C) if( type == PSA_KEY_TYPE_RSA_PUBLIC_KEY ) { + size_t len; /* RSAPublicKey ::= SEQUENCE { * modulus INTEGER, -- n * publicExponent INTEGER } -- e diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index d036e9e56f..f0191a8716 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -50,8 +50,8 @@ void psa_purge_key_storage( void ) #define TEST_MAX_KEY_ID( key_id ) ( (void) ( key_id ) ) #endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */ -static int psa_key_policy_equal( psa_key_policy_t *p1, - psa_key_policy_t *p2 ) +int psa_key_policy_equal( psa_key_policy_t *p1, + psa_key_policy_t *p2 ) { return( psa_key_policy_get_usage( p1 ) == psa_key_policy_get_usage( p2 ) && psa_key_policy_get_algorithm( p1 ) == psa_key_policy_get_algorithm( p2 ) );