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.
This commit is contained in:
Jaeden Amero 2019-06-27 17:31:33 +01:00
parent 3a0f08d911
commit f7dca86522
3 changed files with 10 additions and 10 deletions

View file

@ -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;

View file

@ -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

View file

@ -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 ) );