mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 00:35:33 +00:00
Debug module only outputs full lines instead of parts
This commit is contained in:
parent
eaebbd5eaa
commit
92478c37a6
|
@ -3,9 +3,11 @@ PolarSSL ChangeLog (Sorted per branch, date)
|
|||
= PolarSSL 1.3 branch
|
||||
Features
|
||||
* debug_set_log_mode() function added to determine raw or full logging
|
||||
|
||||
Changes
|
||||
* POLARSSL_CONFIG_OPTIONS has been removed. All values are individually
|
||||
checked and filled in the relevant module headers
|
||||
* Debug module only outputs full lines instead of parts
|
||||
|
||||
Bugfix
|
||||
* Only iterate over actual certificates in ssl_write_certificate_request()
|
||||
|
|
|
@ -127,6 +127,7 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
|||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
|
||||
idx = 0;
|
||||
for( i = 0; i < len; i++ )
|
||||
{
|
||||
if( i >= 4096 )
|
||||
|
@ -135,25 +136,29 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
|||
if( i % 16 == 0 )
|
||||
{
|
||||
if( i > 0 )
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
{
|
||||
snprintf( str + idx, maxlen - idx, "\n" );
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "%04x: ", (unsigned int) i );
|
||||
idx += snprintf( str + idx, maxlen - idx, "%04x: ",
|
||||
(unsigned int) i );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
}
|
||||
|
||||
snprintf( str, maxlen, " %02x", (unsigned int) buf[i] );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
idx += snprintf( str + idx, maxlen - idx, " %02x",
|
||||
(unsigned int) buf[i] );
|
||||
}
|
||||
|
||||
if( len > 0 )
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
{
|
||||
snprintf( str + idx, maxlen - idx, "\n" );
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_ECP_C)
|
||||
|
@ -203,6 +208,7 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
|
||||
idx = 0;
|
||||
for( i = n + 1, j = 0; i > 0; i-- )
|
||||
{
|
||||
if( zeros && X->p[i - 1] == 0 )
|
||||
|
@ -218,22 +224,19 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||
if( j % 16 == 0 )
|
||||
{
|
||||
if( j > 0 )
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
{
|
||||
snprintf( str + idx, maxlen - idx, "\n" );
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
{
|
||||
snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
}
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
}
|
||||
|
||||
snprintf( str, maxlen, " %02x", (unsigned int)
|
||||
idx += snprintf( str + idx, maxlen - idx, " %02x", (unsigned int)
|
||||
( X->p[i - 1] >> (k << 3) ) & 0xFF );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
|
@ -243,16 +246,15 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||
{
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
{
|
||||
snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
}
|
||||
idx += snprintf( str + idx, maxlen - idx, " 00" );
|
||||
}
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "\n" );
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
}
|
||||
ssl->f_dbg( ssl->p_dbg, level, " 00" );
|
||||
}
|
||||
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
}
|
||||
#endif /* POLARSSL_BIGNUM_C */
|
||||
|
||||
#if defined(POLARSSL_X509_CRT_PARSE_C)
|
||||
|
|
|
@ -14,6 +14,13 @@ void string_debug(void *data, int level, const char *str)
|
|||
|
||||
memcpy(buffer->ptr, str, strlen(str));
|
||||
buffer->ptr += strlen(str);
|
||||
|
||||
/* Detect if debug messages output partial lines and mark them */
|
||||
if( *(buffer->ptr - 1) != '\n' )
|
||||
{
|
||||
*buffer->ptr = '*';
|
||||
buffer->ptr++;
|
||||
}
|
||||
}
|
||||
/* END_HEADER */
|
||||
|
||||
|
|
Loading…
Reference in a new issue