mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-05-11 14:22:10 +00:00
parent
8e8ae3d961
commit
6c3ccf5fd0
|
@ -1,5 +1,10 @@
|
||||||
mbed TLS ChangeLog (Sorted per branch, date)
|
mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
|
= mbed TLS 1.3.12 released 2015-07-??
|
||||||
|
|
||||||
|
Bugfix
|
||||||
|
* Fix thread-safety issue in SSL debug module (found by Edwin van Vliet).
|
||||||
|
|
||||||
= mbed TLS 1.3.11 released 2015-06-04
|
= mbed TLS 1.3.11 released 2015-06-04
|
||||||
|
|
||||||
Security
|
Security
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define SSL_DEBUG_MSG( level, args ) \
|
#define SSL_DEBUG_MSG( level, args ) \
|
||||||
debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args );
|
debug_print_msg_free( ssl, level, __FILE__, __LINE__, debug_fmt args );
|
||||||
|
|
||||||
#define SSL_DEBUG_RET( level, text, ret ) \
|
#define SSL_DEBUG_RET( level, text, ret ) \
|
||||||
debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret );
|
debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret );
|
||||||
|
@ -115,6 +115,9 @@ void debug_set_threshold( int threshold );
|
||||||
|
|
||||||
char *debug_fmt( const char *format, ... );
|
char *debug_fmt( const char *format, ... );
|
||||||
|
|
||||||
|
void debug_print_msg_free( const ssl_context *ssl, int level,
|
||||||
|
const char *file, int line, char *text );
|
||||||
|
|
||||||
void debug_print_msg( const ssl_context *ssl, int level,
|
void debug_print_msg( const ssl_context *ssl, int level,
|
||||||
const char *file, int line, const char *text );
|
const char *file, int line, const char *text );
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,13 @@
|
||||||
#if defined(POLARSSL_PLATFORM_C)
|
#if defined(POLARSSL_PLATFORM_C)
|
||||||
#include "polarssl/platform.h"
|
#include "polarssl/platform.h"
|
||||||
#else
|
#else
|
||||||
#define polarssl_snprintf snprintf
|
#define polarssl_snprintf snprintf
|
||||||
|
#define polarssl_malloc malloc
|
||||||
|
#define polarssl_free free
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEBUG_BUF_SIZE 512
|
||||||
|
|
||||||
static int debug_log_mode = POLARSSL_DEBUG_DFL_MODE;
|
static int debug_log_mode = POLARSSL_DEBUG_DFL_MODE;
|
||||||
static int debug_threshold = 0;
|
static int debug_threshold = 0;
|
||||||
|
|
||||||
|
@ -66,17 +70,28 @@ void debug_set_threshold( int threshold )
|
||||||
char *debug_fmt( const char *format, ... )
|
char *debug_fmt( const char *format, ... )
|
||||||
{
|
{
|
||||||
va_list argp;
|
va_list argp;
|
||||||
static char str[512];
|
char *str = polarssl_malloc( DEBUG_BUF_SIZE );
|
||||||
int maxlen = sizeof( str ) - 1;
|
|
||||||
|
if( str == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
va_start( argp, format );
|
va_start( argp, format );
|
||||||
vsnprintf( str, maxlen, format, argp );
|
vsnprintf( str, DEBUG_BUF_SIZE - 1, format, argp );
|
||||||
va_end( argp );
|
va_end( argp );
|
||||||
|
|
||||||
str[maxlen] = '\0';
|
str[DEBUG_BUF_SIZE - 1] = '\0';
|
||||||
return( str );
|
return( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void debug_print_msg_free( const ssl_context *ssl, int level,
|
||||||
|
const char *file, int line, char *text )
|
||||||
|
{
|
||||||
|
if( text != NULL )
|
||||||
|
debug_print_msg( ssl, level, file, line, text );
|
||||||
|
|
||||||
|
polarssl_free( text );
|
||||||
|
}
|
||||||
|
|
||||||
void debug_print_msg( const ssl_context *ssl, int level,
|
void debug_print_msg( const ssl_context *ssl, int level,
|
||||||
const char *file, int line, const char *text )
|
const char *file, int line, const char *text )
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,8 @@ void debug_print_msg_threshold( int threshold, int level, char *file, int line,
|
||||||
debug_set_threshold( threshold );
|
debug_set_threshold( threshold );
|
||||||
ssl_set_dbg(&ssl, string_debug, &buffer);
|
ssl_set_dbg(&ssl, string_debug, &buffer);
|
||||||
|
|
||||||
debug_print_msg( &ssl, level, file, line,
|
debug_print_msg_free( &ssl, level, file, line,
|
||||||
debug_fmt("Text message, 2 == %d", 2 ) );
|
debug_fmt("Text message, 2 == %d", 2 ) );
|
||||||
|
|
||||||
TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
|
TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue