Merge remote-tracking branch 'origin/pr/2320' into mbedtls-2.7

* origin/pr/2320:
  Clarify ChangeLog entry for fix to #1628
  Add Changelog entry for clang test-ref-configs.pl fix
  Enable more compiler warnings in tests/Makefile
  Change file scoping of test helpers.function
This commit is contained in:
Jaeden Amero 2019-06-21 13:10:39 +01:00
commit dd11fbccd2
4 changed files with 26 additions and 19 deletions

View File

@ -1,5 +1,11 @@
mbed TLS ChangeLog (Sorted per branch, date) mbed TLS ChangeLog (Sorted per branch, date)
= mbed TLS x.x.x branch released xxxx-xx-xx
Bugfix
* Fix to allow building test suites with any warning that detects unused
functions. Fixes #1628.
= mbed TLS 2.7.11 branch released 2019-06-11 = mbed TLS 2.7.11 branch released 2019-06-11
Security Security

View File

@ -3,7 +3,7 @@
# To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS # To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS
CFLAGS ?= -O2 CFLAGS ?= -O2
WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wno-unused-function -Wno-unused-value WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wunused
LDFLAGS ?= LDFLAGS ?=
LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64 LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64

View File

@ -128,6 +128,14 @@ test_info;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Helper Functions */ /* Helper Functions */
void test_fail( const char *test, int line_no, const char* filename )
{
test_info.failed = 1;
test_info.test = test;
test_info.line_no = line_no;
test_info.filename = filename;
}
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
static int redirect_output( FILE** out_stream, const char* path ) static int redirect_output( FILE** out_stream, const char* path )
{ {
@ -171,7 +179,7 @@ static void close_output( FILE* out_stream )
} }
#endif /* __unix__ || __APPLE__ __MACH__ */ #endif /* __unix__ || __APPLE__ __MACH__ */
static int unhexify( unsigned char *obuf, const char *ibuf ) int unhexify( unsigned char *obuf, const char *ibuf )
{ {
unsigned char c, c2; unsigned char c, c2;
int len = strlen( ibuf ) / 2; int len = strlen( ibuf ) / 2;
@ -205,7 +213,7 @@ static int unhexify( unsigned char *obuf, const char *ibuf )
return len; return len;
} }
static void hexify( unsigned char *obuf, const unsigned char *ibuf, int len ) void hexify( unsigned char *obuf, const unsigned char *ibuf, int len )
{ {
unsigned char l, h; unsigned char l, h;
@ -259,7 +267,7 @@ static unsigned char *zero_alloc( size_t len )
* *
* For convenience, dies if allocation fails. * For convenience, dies if allocation fails.
*/ */
static unsigned char *unhexify_alloc( const char *ibuf, size_t *olen ) unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
{ {
unsigned char *obuf; unsigned char *obuf;
@ -310,7 +318,7 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
* *
* rng_state shall be NULL. * rng_state shall be NULL.
*/ */
static int rnd_zero_rand( void *rng_state, unsigned char *output, size_t len ) int rnd_zero_rand( void *rng_state, unsigned char *output, size_t len )
{ {
if( rng_state != NULL ) if( rng_state != NULL )
rng_state = NULL; rng_state = NULL;
@ -337,7 +345,7 @@ typedef struct
* *
* After the buffer is empty it will return rand(); * After the buffer is empty it will return rand();
*/ */
static int rnd_buffer_rand( void *rng_state, unsigned char *output, size_t len ) int rnd_buffer_rand( void *rng_state, unsigned char *output, size_t len )
{ {
rnd_buf_info *info = (rnd_buf_info *) rng_state; rnd_buf_info *info = (rnd_buf_info *) rng_state;
size_t use_len; size_t use_len;
@ -383,7 +391,7 @@ typedef struct
* *
* rng_state shall be a pointer to a rnd_pseudo_info structure. * rng_state shall be a pointer to a rnd_pseudo_info structure.
*/ */
static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
{ {
rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state; rnd_pseudo_info *info = (rnd_pseudo_info *) rng_state;
uint32_t i, *k, sum, delta=0x9E3779B9; uint32_t i, *k, sum, delta=0x9E3779B9;
@ -417,10 +425,3 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
return( 0 ); return( 0 );
} }
static void test_fail( const char *test, int line_no, const char* filename )
{
test_info.failed = 1;
test_info.test = test;
test_info.line_no = line_no;
test_info.filename = filename;
}

View File

@ -47,7 +47,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 * This might break memory checks in the future if sources need 'free-ing' then
* as well. * as well.
*/ */
static void entropy_clear_sources( mbedtls_entropy_context *ctx ) void entropy_clear_sources( mbedtls_entropy_context *ctx )
{ {
ctx->source_count = 0; ctx->source_count = 0;
} }
@ -57,7 +57,7 @@ static void entropy_clear_sources( mbedtls_entropy_context *ctx )
*/ */
static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE]; 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 ) if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
return( -1 ); return( -1 );
@ -66,7 +66,7 @@ static int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
return( 0 ); 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 ) if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
return( -1 ); return( -1 );
@ -78,7 +78,7 @@ static int buffer_nv_seed_write( unsigned char *buf, size_t buf_len )
/* /*
* NV seed read/write helpers that fill the base seedfile * NV seed read/write helpers that fill the base seedfile
*/ */
static int write_nv_seed( unsigned char *buf, size_t buf_len ) int write_nv_seed( unsigned char *buf, size_t buf_len )
{ {
FILE *f; FILE *f;
@ -97,7 +97,7 @@ static int write_nv_seed( unsigned char *buf, size_t buf_len )
return( 0 ); 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; FILE *f;