Skip to content

Commit f7dca86

Browse files
committed
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.
1 parent 3a0f08d commit f7dca86

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tests/suites/test_suite_entropy.function

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static int entropy_dummy_source( void *data, unsigned char *output,
4848
* This might break memory checks in the future if sources need 'free-ing' then
4949
* as well.
5050
*/
51-
static void entropy_clear_sources( mbedtls_entropy_context *ctx )
51+
void entropy_clear_sources( mbedtls_entropy_context *ctx )
5252
{
5353
ctx->source_count = 0;
5454
}
@@ -58,7 +58,7 @@ static void entropy_clear_sources( mbedtls_entropy_context *ctx )
5858
*/
5959
static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
6060

61-
static int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
61+
int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
6262
{
6363
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
6464
return( -1 );
@@ -67,7 +67,7 @@ static int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
6767
return( 0 );
6868
}
6969

70-
static int buffer_nv_seed_write( unsigned char *buf, size_t buf_len )
70+
int buffer_nv_seed_write( unsigned char *buf, size_t buf_len )
7171
{
7272
if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
7373
return( -1 );
@@ -98,7 +98,7 @@ static int write_nv_seed( unsigned char *buf, size_t buf_len )
9898
return( 0 );
9999
}
100100

101-
static int read_nv_seed( unsigned char *buf, size_t buf_len )
101+
int read_nv_seed( unsigned char *buf, size_t buf_len )
102102
{
103103
FILE *f;
104104

tests/suites/test_suite_psa_crypto.function

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,9 @@ exit:
604604
return( ok );
605605
}
606606

607-
static int asn1_skip_integer( unsigned char **p, const unsigned char *end,
608-
size_t min_bits, size_t max_bits,
609-
int must_be_odd )
607+
int asn1_skip_integer( unsigned char **p, const unsigned char *end,
608+
size_t min_bits, size_t max_bits,
609+
int must_be_odd )
610610
{
611611
size_t len;
612612
size_t actual_bits;
@@ -731,10 +731,10 @@ static int exported_key_sanity_check( psa_key_type_t type, size_t bits,
731731
{
732732
uint8_t *p = exported;
733733
uint8_t *end = exported + exported_length;
734-
size_t len;
735734
#if defined(MBEDTLS_RSA_C)
736735
if( type == PSA_KEY_TYPE_RSA_PUBLIC_KEY )
737736
{
737+
size_t len;
738738
/* RSAPublicKey ::= SEQUENCE {
739739
* modulus INTEGER, -- n
740740
* publicExponent INTEGER } -- e

tests/suites/test_suite_psa_crypto_slot_management.function

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ void psa_purge_key_storage( void )
5050
#define TEST_MAX_KEY_ID( key_id ) ( (void) ( key_id ) )
5151
#endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
5252

53-
static int psa_key_policy_equal( psa_key_policy_t *p1,
54-
psa_key_policy_t *p2 )
53+
int psa_key_policy_equal( psa_key_policy_t *p1,
54+
psa_key_policy_t *p2 )
5555
{
5656
return( psa_key_policy_get_usage( p1 ) == psa_key_policy_get_usage( p2 ) &&
5757
psa_key_policy_get_algorithm( p1 ) == psa_key_policy_get_algorithm( p2 ) );

0 commit comments

Comments
 (0)