mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 12:25:39 +01: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
|
= PolarSSL 1.3 branch
|
||||||
Features
|
Features
|
||||||
* debug_set_log_mode() function added to determine raw or full logging
|
* debug_set_log_mode() function added to determine raw or full logging
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* POLARSSL_CONFIG_OPTIONS has been removed. All values are individually
|
* POLARSSL_CONFIG_OPTIONS has been removed. All values are individually
|
||||||
checked and filled in the relevant module headers
|
checked and filled in the relevant module headers
|
||||||
|
* Debug module only outputs full lines instead of parts
|
||||||
|
|
||||||
Bugfix
|
Bugfix
|
||||||
* Only iterate over actual certificates in ssl_write_certificate_request()
|
* 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';
|
str[maxlen] = '\0';
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
for( i = 0; i < len; i++ )
|
for( i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
if( i >= 4096 )
|
if( i >= 4096 )
|
||||||
@ -135,25 +136,29 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
|||||||
if( i % 16 == 0 )
|
if( i % 16 == 0 )
|
||||||
{
|
{
|
||||||
if( i > 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 )
|
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
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] );
|
idx += snprintf( str + idx, maxlen - idx, " %02x",
|
||||||
|
(unsigned int) buf[i] );
|
||||||
str[maxlen] = '\0';
|
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( len > 0 )
|
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)
|
#if defined(POLARSSL_ECP_C)
|
||||||
@ -203,6 +208,7 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||||||
str[maxlen] = '\0';
|
str[maxlen] = '\0';
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||||
|
|
||||||
|
idx = 0;
|
||||||
for( i = n + 1, j = 0; i > 0; i-- )
|
for( i = n + 1, j = 0; i > 0; i-- )
|
||||||
{
|
{
|
||||||
if( zeros && X->p[i - 1] == 0 )
|
if( zeros && X->p[i - 1] == 0 )
|
||||||
@ -218,21 +224,18 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||||||
if( j % 16 == 0 )
|
if( j % 16 == 0 )
|
||||||
{
|
{
|
||||||
if( j > 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 )
|
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||||
{
|
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||||
snprintf( str, maxlen, "%s(%04d): ", file, line );
|
|
||||||
str[maxlen] = '\0';
|
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf( str, maxlen, " %02x", (unsigned int)
|
idx += snprintf( str + idx, maxlen - idx, " %02x", (unsigned int)
|
||||||
( X->p[i - 1] >> (k << 3) ) & 0xFF );
|
( X->p[i - 1] >> (k << 3) ) & 0xFF );
|
||||||
|
|
||||||
str[maxlen] = '\0';
|
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@ -243,15 +246,14 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
|||||||
{
|
{
|
||||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
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';
|
|
||||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
|
||||||
}
|
}
|
||||||
ssl->f_dbg( ssl->p_dbg, level, " 00" );
|
idx += snprintf( str + idx, maxlen - idx, " 00" );
|
||||||
}
|
}
|
||||||
|
|
||||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
snprintf( str + idx, maxlen - idx, "\n" );
|
||||||
|
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||||
}
|
}
|
||||||
#endif /* POLARSSL_BIGNUM_C */
|
#endif /* POLARSSL_BIGNUM_C */
|
||||||
|
|
||||||
|
@ -14,6 +14,13 @@ void string_debug(void *data, int level, const char *str)
|
|||||||
|
|
||||||
memcpy(buffer->ptr, str, strlen(str));
|
memcpy(buffer->ptr, str, strlen(str));
|
||||||
buffer->ptr += 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 */
|
/* END_HEADER */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user