Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 2.7: Change file scoping of test helper functions #2320

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
mbed TLS ChangeLog (Sorted per branch, date)

= mbed TLS x.x.x branch released xxxx-xx-xx

Bugfix
* Fix to allow test-ref-config.pl to build with Clang. Fixes #1628.

= mbed TLS 2.7.9 branch released 2018-12-21

Bugfix
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To compile with PKCS11: add "-lpkcs11-helper" to LDFLAGS

CFLAGS ?= -O2
WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wno-unused-function -Wno-unused-value
WARNING_CFLAGS ?= -Wall -W -Wdeclaration-after-statement -Wunused
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Probably don't need -Wunused here, since -Wall enables lots of -Wunused-* warnings.

LDFLAGS ?=

LOCAL_CFLAGS = $(WARNING_CFLAGS) -I../include -D_FILE_OFFSET_BITS=64
Expand Down
27 changes: 14 additions & 13 deletions tests/suites/helpers.function
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ test_info;
/*----------------------------------------------------------------------------*/
/* 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__))
static int redirect_output( FILE** out_stream, const char* path )
{
Expand Down Expand Up @@ -170,7 +178,7 @@ static void close_output( FILE* out_stream )
}
#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;
int len = strlen( ibuf ) / 2;
Expand Down Expand Up @@ -204,7 +212,7 @@ static int unhexify( unsigned char *obuf, const char *ibuf )
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;

Expand Down Expand Up @@ -258,7 +266,7 @@ static unsigned char *zero_alloc( size_t len )
*
* 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;

Expand Down Expand Up @@ -309,7 +317,7 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
*
* 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 )
rng_state = NULL;
Expand All @@ -336,7 +344,7 @@ typedef struct
*
* 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;
size_t use_len;
Expand Down Expand Up @@ -382,7 +390,7 @@ typedef struct
*
* 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;
uint32_t i, *k, sum, delta=0x9E3779B9;
Expand Down Expand Up @@ -416,10 +424,3 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
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;
}