mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 16:55:43 +01:00
debug_set_log_mode() added to determine raw or full logging
This commit is contained in:
parent
57ffa5570d
commit
eaebbd5eaa
@ -1,6 +1,8 @@
|
||||
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
|
||||
|
@ -2097,6 +2097,9 @@
|
||||
//#define SSL_MAX_CONTENT_LEN 16384 /**< Size of the input / output buffer */
|
||||
//#define SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */
|
||||
|
||||
/* Debug options */
|
||||
//#define POLARSSL_DEBUG_DFL_MODE POLARSSL_DEBUG_LOG_FULL /**< Default log: Full or Raw */
|
||||
|
||||
/* \} name */
|
||||
|
||||
/*
|
||||
|
@ -35,6 +35,32 @@
|
||||
|
||||
#if defined(POLARSSL_DEBUG_C)
|
||||
|
||||
#define POLARSSL_DEBUG_LOG_FULL 0 /**< Include file:line in log lines */
|
||||
#define POLARSSL_DEBUG_LOG_RAW 1 /**< Only log raw debug lines */
|
||||
|
||||
/**
|
||||
* \name SECTION: Module settings
|
||||
*
|
||||
* The configuration options you can set for this module are in this section.
|
||||
* Either change them in config.h or define them on the compiler command line.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#if !defined(POLARSSL_DEBUG_DFL_MODE)
|
||||
#define POLARSSL_DEBUG_DFL_MODE POLARSSL_DEBUG_LOG_FULL /**< Default log: Full or Raw */
|
||||
#endif
|
||||
|
||||
/* \} name SECTION: Module settings */
|
||||
|
||||
/**
|
||||
* \brief Set the log mode for the debug functions globally
|
||||
* (Default value: POLARSSL_DEBUG_DFL_MODE)
|
||||
*
|
||||
* \param log_mode The log mode to use (POLARSSL_DEBUG_LOG_FULL or
|
||||
* POLARSSL_DEBUG_LOG_RAW)
|
||||
*/
|
||||
void debug_set_log_mode( int log_mode );
|
||||
|
||||
#define SSL_DEBUG_MSG( level, args ) \
|
||||
debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args );
|
||||
|
||||
|
@ -46,6 +46,13 @@
|
||||
#endif
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
static int debug_log_mode = POLARSSL_DEBUG_DFL_MODE;
|
||||
|
||||
void debug_set_log_mode( int log_mode )
|
||||
{
|
||||
debug_log_mode = log_mode;
|
||||
}
|
||||
|
||||
char *debug_fmt( const char *format, ... )
|
||||
{
|
||||
va_list argp;
|
||||
@ -69,6 +76,12 @@ void debug_print_msg( const ssl_context *ssl, int level,
|
||||
if( ssl->f_dbg == NULL )
|
||||
return;
|
||||
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_RAW )
|
||||
{
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): %s\n", file, line, text );
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
@ -80,12 +93,16 @@ void debug_print_ret( const ssl_context *ssl, int level,
|
||||
{
|
||||
char str[512];
|
||||
int maxlen = sizeof( str ) - 1;
|
||||
size_t idx = 0;
|
||||
|
||||
if( ssl->f_dbg == NULL )
|
||||
return;
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): %s() returned %d (-0x%04x)\n",
|
||||
file, line, text, ret, -ret );
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "%s() returned %d (-0x%04x)\n",
|
||||
text, ret, -ret );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
@ -96,13 +113,16 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
||||
unsigned char *buf, size_t len )
|
||||
{
|
||||
char str[512];
|
||||
size_t i, maxlen = sizeof( str ) - 1;
|
||||
size_t i, maxlen = sizeof( str ) - 1, idx = 0;
|
||||
|
||||
if( ssl->f_dbg == NULL )
|
||||
return;
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): dumping '%s' (%d bytes)\n",
|
||||
file, line, text, (unsigned int) len );
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "dumping '%s' (%d bytes)\n",
|
||||
text, (unsigned int) len );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
@ -117,8 +137,10 @@ void debug_print_buf( const ssl_context *ssl, int level,
|
||||
if( i > 0 )
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): %04x: ", file, line,
|
||||
(unsigned int) i );
|
||||
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 );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
@ -159,7 +181,7 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
{
|
||||
char str[512];
|
||||
int j, k, maxlen = sizeof( str ) - 1, zeros = 1;
|
||||
size_t i, n;
|
||||
size_t i, n, idx = 0;
|
||||
|
||||
if( ssl->f_dbg == NULL || X == NULL )
|
||||
return;
|
||||
@ -172,9 +194,11 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
if( ( ( X->p[n] >> j ) & 1 ) != 0 )
|
||||
break;
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): value of '%s' (%d bits) is:\n",
|
||||
file, line, text,
|
||||
(int) ( ( n * ( sizeof(t_uint) << 3 ) ) + j + 1 ) );
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "value of '%s' (%d bits) is:\n",
|
||||
text, (int) ( ( n * ( sizeof(t_uint) << 3 ) ) + j + 1 ) );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
@ -196,11 +220,13 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
if( j > 0 )
|
||||
ssl->f_dbg( ssl->p_dbg, level, "\n" );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
snprintf( str, maxlen, " %02x", (unsigned int)
|
||||
( X->p[i - 1] >> (k << 3) ) & 0xFF );
|
||||
@ -214,11 +240,14 @@ void debug_print_mpi( const ssl_context *ssl, int level,
|
||||
}
|
||||
|
||||
if( zeros == 1 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
ssl->f_dbg( ssl->p_dbg, level, " 00" );
|
||||
}
|
||||
|
||||
@ -268,13 +297,19 @@ void debug_print_crt( const ssl_context *ssl, int level,
|
||||
const char *text, const x509_crt *crt )
|
||||
{
|
||||
char str[1024], prefix[64];
|
||||
int i = 0, maxlen = sizeof( prefix ) - 1;
|
||||
int i = 0, maxlen = sizeof( prefix ) - 1, idx = 0;
|
||||
|
||||
if( ssl->f_dbg == NULL || crt == NULL )
|
||||
return;
|
||||
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
{
|
||||
snprintf( prefix, maxlen, "%s(%04d): ", file, line );
|
||||
prefix[maxlen] = '\0';
|
||||
}
|
||||
else
|
||||
prefix[0] = '\0';
|
||||
|
||||
maxlen = sizeof( str ) - 1;
|
||||
|
||||
while( crt != NULL )
|
||||
@ -282,8 +317,11 @@ void debug_print_crt( const ssl_context *ssl, int level,
|
||||
char buf[1024];
|
||||
x509_crt_info( buf, sizeof( buf ) - 1, prefix, crt );
|
||||
|
||||
snprintf( str, maxlen, "%s(%04d): %s #%d:\n%s",
|
||||
file, line, text, ++i, buf );
|
||||
if( debug_log_mode == POLARSSL_DEBUG_LOG_FULL )
|
||||
idx = snprintf( str, maxlen, "%s(%04d): ", file, line );
|
||||
|
||||
snprintf( str + idx, maxlen - idx, "%s #%d:\n%s",
|
||||
text, ++i, buf );
|
||||
|
||||
str[maxlen] = '\0';
|
||||
ssl->f_dbg( ssl->p_dbg, level, str );
|
||||
|
@ -1,49 +1,69 @@
|
||||
Debug print return value #1
|
||||
debug_print_ret:"MyFile":999:"Test return value":0:"MyFile(0999)\: Test return value() returned 0 (-0x0000)\n"
|
||||
debug_print_ret:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":0:"MyFile(0999)\: Test return value() returned 0 (-0x0000)\n"
|
||||
|
||||
Debug print return value #1 (raw)
|
||||
debug_print_ret:POLARSSL_DEBUG_LOG_RAW:"MyFile":999:"Test return value":0:"Test return value() returned 0 (-0x0000)\n"
|
||||
|
||||
Debug print return value #2
|
||||
debug_print_ret:"MyFile":999:"Test return value":-0x1000:"MyFile(0999)\: Test return value() returned -4096 (-0x1000)\n"
|
||||
debug_print_ret:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":-0x1000:"MyFile(0999)\: Test return value() returned -4096 (-0x1000)\n"
|
||||
|
||||
Debug print return value #3
|
||||
debug_print_ret:"MyFile":999:"Test return value":-0xFFFF:"MyFile(0999)\: Test return value() returned -65535 (-0xffff)\n"
|
||||
debug_print_ret:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":-0xFFFF:"MyFile(0999)\: Test return value() returned -65535 (-0xffff)\n"
|
||||
|
||||
Debug print return value #3 (raw)
|
||||
debug_print_ret:POLARSSL_DEBUG_LOG_RAW:"MyFile":999:"Test return value":-0xFFFF:"Test return value() returned -65535 (-0xffff)\n"
|
||||
|
||||
Debug print buffer #1
|
||||
debug_print_buf:"MyFile":999:"Test return value":"":"MyFile(0999)\: dumping 'Test return value' (0 bytes)\n"
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":"":"MyFile(0999)\: dumping 'Test return value' (0 bytes)\n"
|
||||
|
||||
Debug print buffer #2
|
||||
debug_print_buf:"MyFile":999:"Test return value":"00":"MyFile(0999)\: dumping 'Test return value' (1 bytes)\nMyFile(0999)\: 0000\: 00\n"
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":"00":"MyFile(0999)\: dumping 'Test return value' (1 bytes)\nMyFile(0999)\: 0000\: 00\n"
|
||||
|
||||
Debug print buffer #3
|
||||
debug_print_buf:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F":"MyFile(0999)\: dumping 'Test return value' (16 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n"
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F":"MyFile(0999)\: dumping 'Test return value' (16 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n"
|
||||
|
||||
Debug print buffer #4
|
||||
debug_print_buf:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F00":"MyFile(0999)\: dumping 'Test return value' (17 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0010\: 00\n"
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F00":"MyFile(0999)\: dumping 'Test return value' (17 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0010\: 00\n"
|
||||
|
||||
Debug print buffer #5
|
||||
debug_print_buf:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F00":"MyFile(0999)\: dumping 'Test return value' (49 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0010\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0020\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0030\: 00\n"
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_FULL:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F00":"MyFile(0999)\: dumping 'Test return value' (49 bytes)\nMyFile(0999)\: 0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0010\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0020\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\nMyFile(0999)\: 0030\: 00\n"
|
||||
|
||||
Debug print buffer #5 (raw)
|
||||
debug_print_buf:POLARSSL_DEBUG_LOG_RAW:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F00":"dumping 'Test return value' (49 bytes)\n0000\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n0010\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n0020\: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n0030\: 00\n"
|
||||
|
||||
Debug print certificate #1 (RSA)
|
||||
depends_on:POLARSSL_PEM_PARSE_C:POLARSSL_BASE64_C:POLARSSL_RSA_C
|
||||
debug_print_crt:"data_files/server1.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: 01\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=PolarSSL Server 1\nMyFile(0999)\: issued on \: 2011-02-12 14\:44\:06\nMyFile(0999)\: expires on \: 2021-02-12 14\:44\:06\nMyFile(0999)\: signed using \: RSA with SHA1\nMyFile(0999)\: RSA key size \: 2048 bits\nMyFile(0999)\: basic constraints \: CA=false\nMyFile(0999)\: value of 'crt->rsa.N' (2048 bits) is\:\nMyFile(0999)\: a9 02 1f 3d 40 6a d5 55 53 8b fd 36 ee 82 65 2e\nMyFile(0999)\: 15 61 5e 89 bf b8 e8 45 90 db ee 88 16 52 d3 f1\nMyFile(0999)\: 43 50 47 96 12 59 64 87 6b fd 2b e0 46 f9 73 be\nMyFile(0999)\: dd cf 92 e1 91 5b ed 66 a0 6f 89 29 79 45 80 d0\nMyFile(0999)\: 83 6a d5 41 43 77 5f 39 7c 09 04 47 82 b0 57 39\nMyFile(0999)\: 70 ed a3 ec 15 19 1e a8 33 08 47 c1 05 42 a9 fd\nMyFile(0999)\: 4c c3 b4 df dd 06 1f 4d 10 51 40 67 73 13 0f 40\nMyFile(0999)\: f8 6d 81 25 5f 0a b1 53 c6 30 7e 15 39 ac f9 5a\nMyFile(0999)\: ee 7f 92 9e a6 05 5b e7 13 97 85 b5 23 92 d9 d4\nMyFile(0999)\: 24 06 d5 09 25 89 75 07 dd a6 1a 8f 3f 09 19 be\nMyFile(0999)\: ad 65 2c 64 eb 95 9b dc fe 41 5e 17 a6 da 6c 5b\nMyFile(0999)\: 69 cc 02 ba 14 2c 16 24 9c 4a dc cd d0 f7 52 67\nMyFile(0999)\: 73 f1 2d a0 23 fd 7e f4 31 ca 2d 70 ca 89 0b 04\nMyFile(0999)\: db 2e a6 4f 70 6e 9e ce bd 58 89 e2 53 59 9e 6e\nMyFile(0999)\: 5a 92 65 e2 88 3f 0c 94 19 a3 dd e5 e8 9d 95 13\nMyFile(0999)\: ed 29 db ab 70 12 dc 5a ca 6b 17 ab 52 82 54 b1\nMyFile(0999)\: value of 'crt->rsa.E' (17 bits) is\:\nMyFile(0999)\: 01 00 01\n"
|
||||
debug_print_crt:POLARSSL_DEBUG_LOG_FULL:"data_files/server1.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: 01\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=PolarSSL Server 1\nMyFile(0999)\: issued on \: 2011-02-12 14\:44\:06\nMyFile(0999)\: expires on \: 2021-02-12 14\:44\:06\nMyFile(0999)\: signed using \: RSA with SHA1\nMyFile(0999)\: RSA key size \: 2048 bits\nMyFile(0999)\: basic constraints \: CA=false\nMyFile(0999)\: value of 'crt->rsa.N' (2048 bits) is\:\nMyFile(0999)\: a9 02 1f 3d 40 6a d5 55 53 8b fd 36 ee 82 65 2e\nMyFile(0999)\: 15 61 5e 89 bf b8 e8 45 90 db ee 88 16 52 d3 f1\nMyFile(0999)\: 43 50 47 96 12 59 64 87 6b fd 2b e0 46 f9 73 be\nMyFile(0999)\: dd cf 92 e1 91 5b ed 66 a0 6f 89 29 79 45 80 d0\nMyFile(0999)\: 83 6a d5 41 43 77 5f 39 7c 09 04 47 82 b0 57 39\nMyFile(0999)\: 70 ed a3 ec 15 19 1e a8 33 08 47 c1 05 42 a9 fd\nMyFile(0999)\: 4c c3 b4 df dd 06 1f 4d 10 51 40 67 73 13 0f 40\nMyFile(0999)\: f8 6d 81 25 5f 0a b1 53 c6 30 7e 15 39 ac f9 5a\nMyFile(0999)\: ee 7f 92 9e a6 05 5b e7 13 97 85 b5 23 92 d9 d4\nMyFile(0999)\: 24 06 d5 09 25 89 75 07 dd a6 1a 8f 3f 09 19 be\nMyFile(0999)\: ad 65 2c 64 eb 95 9b dc fe 41 5e 17 a6 da 6c 5b\nMyFile(0999)\: 69 cc 02 ba 14 2c 16 24 9c 4a dc cd d0 f7 52 67\nMyFile(0999)\: 73 f1 2d a0 23 fd 7e f4 31 ca 2d 70 ca 89 0b 04\nMyFile(0999)\: db 2e a6 4f 70 6e 9e ce bd 58 89 e2 53 59 9e 6e\nMyFile(0999)\: 5a 92 65 e2 88 3f 0c 94 19 a3 dd e5 e8 9d 95 13\nMyFile(0999)\: ed 29 db ab 70 12 dc 5a ca 6b 17 ab 52 82 54 b1\nMyFile(0999)\: value of 'crt->rsa.E' (17 bits) is\:\nMyFile(0999)\: 01 00 01\n"
|
||||
|
||||
Debug print certificate #1 (RSA, raw)
|
||||
depends_on:POLARSSL_PEM_PARSE_C:POLARSSL_BASE64_C:POLARSSL_RSA_C
|
||||
debug_print_crt:POLARSSL_DEBUG_LOG_RAW:"data_files/server1.crt":"MyFile":999:"PREFIX_":"PREFIX_ #1\:\ncert. version \: 3\nserial number \: 01\nissuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name \: C=NL, O=PolarSSL, CN=PolarSSL Server 1\nissued on \: 2011-02-12 14\:44\:06\nexpires on \: 2021-02-12 14\:44\:06\nsigned using \: RSA with SHA1\nRSA key size \: 2048 bits\nbasic constraints \: CA=false\nvalue of 'crt->rsa.N' (2048 bits) is\:\n a9 02 1f 3d 40 6a d5 55 53 8b fd 36 ee 82 65 2e\n 15 61 5e 89 bf b8 e8 45 90 db ee 88 16 52 d3 f1\n 43 50 47 96 12 59 64 87 6b fd 2b e0 46 f9 73 be\n dd cf 92 e1 91 5b ed 66 a0 6f 89 29 79 45 80 d0\n 83 6a d5 41 43 77 5f 39 7c 09 04 47 82 b0 57 39\n 70 ed a3 ec 15 19 1e a8 33 08 47 c1 05 42 a9 fd\n 4c c3 b4 df dd 06 1f 4d 10 51 40 67 73 13 0f 40\n f8 6d 81 25 5f 0a b1 53 c6 30 7e 15 39 ac f9 5a\n ee 7f 92 9e a6 05 5b e7 13 97 85 b5 23 92 d9 d4\n 24 06 d5 09 25 89 75 07 dd a6 1a 8f 3f 09 19 be\n ad 65 2c 64 eb 95 9b dc fe 41 5e 17 a6 da 6c 5b\n 69 cc 02 ba 14 2c 16 24 9c 4a dc cd d0 f7 52 67\n 73 f1 2d a0 23 fd 7e f4 31 ca 2d 70 ca 89 0b 04\n db 2e a6 4f 70 6e 9e ce bd 58 89 e2 53 59 9e 6e\n 5a 92 65 e2 88 3f 0c 94 19 a3 dd e5 e8 9d 95 13\n ed 29 db ab 70 12 dc 5a ca 6b 17 ab 52 82 54 b1\nvalue of 'crt->rsa.E' (17 bits) is\:\n 01 00 01\n"
|
||||
|
||||
Debug print certificate #2 (EC)
|
||||
depends_on:POLARSSL_PEM_PARSE_C:POLARSSL_BASE64_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
debug_print_crt:"data_files/test-ca2.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: C1\:43\:E2\:7E\:62\:43\:CC\:E8\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nMyFile(0999)\: issued on \: 2013-09-24 15\:49\:48\nMyFile(0999)\: expires on \: 2023-09-22 15\:49\:48\nMyFile(0999)\: signed using \: ECDSA with SHA256\nMyFile(0999)\: EC key size \: 384 bits\nMyFile(0999)\: basic constraints \: CA=true\nMyFile(0999)\: value of 'crt->eckey.Q(X)' (384 bits) is\:\nMyFile(0999)\: c3 da 2b 34 41 37 58 2f 87 56 fe fc 89 ba 29 43\nMyFile(0999)\: 4b 4e e0 6e c3 0e 57 53 33 39 58 d4 52 b4 91 95\nMyFile(0999)\: 39 0b 23 df 5f 17 24 62 48 fc 1a 95 29 ce 2c 2d\nMyFile(0999)\: value of 'crt->eckey.Q(Y)' (384 bits) is\:\nMyFile(0999)\: 87 c2 88 52 80 af d6 6a ab 21 dd b8 d3 1c 6e 58\nMyFile(0999)\: b8 ca e8 b2 69 8e f3 41 ad 29 c3 b4 5f 75 a7 47\nMyFile(0999)\: 6f d5 19 29 55 69 9a 53 3b 20 b4 66 16 60 33 1e\n"
|
||||
debug_print_crt:POLARSSL_DEBUG_LOG_FULL:"data_files/test-ca2.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: C1\:43\:E2\:7E\:62\:43\:CC\:E8\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nMyFile(0999)\: issued on \: 2013-09-24 15\:49\:48\nMyFile(0999)\: expires on \: 2023-09-22 15\:49\:48\nMyFile(0999)\: signed using \: ECDSA with SHA256\nMyFile(0999)\: EC key size \: 384 bits\nMyFile(0999)\: basic constraints \: CA=true\nMyFile(0999)\: value of 'crt->eckey.Q(X)' (384 bits) is\:\nMyFile(0999)\: c3 da 2b 34 41 37 58 2f 87 56 fe fc 89 ba 29 43\nMyFile(0999)\: 4b 4e e0 6e c3 0e 57 53 33 39 58 d4 52 b4 91 95\nMyFile(0999)\: 39 0b 23 df 5f 17 24 62 48 fc 1a 95 29 ce 2c 2d\nMyFile(0999)\: value of 'crt->eckey.Q(Y)' (384 bits) is\:\nMyFile(0999)\: 87 c2 88 52 80 af d6 6a ab 21 dd b8 d3 1c 6e 58\nMyFile(0999)\: b8 ca e8 b2 69 8e f3 41 ad 29 c3 b4 5f 75 a7 47\nMyFile(0999)\: 6f d5 19 29 55 69 9a 53 3b 20 b4 66 16 60 33 1e\n"
|
||||
|
||||
Debug print certificate #2 (EC, raw)
|
||||
depends_on:POLARSSL_PEM_PARSE_C:POLARSSL_BASE64_C:POLARSSL_ECP_C:POLARSSL_ECP_DP_SECP192R1_ENABLED
|
||||
debug_print_crt:POLARSSL_DEBUG_LOG_RAW:"data_files/test-ca2.crt":"MyFile":999:"PREFIX_":"PREFIX_ #1\:\ncert. version \: 3\nserial number \: C1\:43\:E2\:7E\:62\:43\:CC\:E8\nissuer name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nsubject name \: C=NL, O=PolarSSL, CN=Polarssl Test EC CA\nissued on \: 2013-09-24 15\:49\:48\nexpires on \: 2023-09-22 15\:49\:48\nsigned using \: ECDSA with SHA256\nEC key size \: 384 bits\nbasic constraints \: CA=true\nvalue of 'crt->eckey.Q(X)' (384 bits) is\:\n c3 da 2b 34 41 37 58 2f 87 56 fe fc 89 ba 29 43\n 4b 4e e0 6e c3 0e 57 53 33 39 58 d4 52 b4 91 95\n 39 0b 23 df 5f 17 24 62 48 fc 1a 95 29 ce 2c 2d\nvalue of 'crt->eckey.Q(Y)' (384 bits) is\:\n 87 c2 88 52 80 af d6 6a ab 21 dd b8 d3 1c 6e 58\n b8 ca e8 b2 69 8e f3 41 ad 29 c3 b4 5f 75 a7 47\n 6f d5 19 29 55 69 9a 53 3b 20 b4 66 16 60 33 1e\n"
|
||||
|
||||
Debug print mpi #1
|
||||
debug_print_mpi:16:"01020304050607":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (49 bits) is\:\nMyFile(0999)\: 01 02 03 04 05 06 07\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"01020304050607":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (49 bits) is\:\nMyFile(0999)\: 01 02 03 04 05 06 07\n"
|
||||
|
||||
Debug print mpi #2
|
||||
debug_print_mpi:16:"00000000000007":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (3 bits) is\:\nMyFile(0999)\: 07\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"00000000000007":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (3 bits) is\:\nMyFile(0999)\: 07\n"
|
||||
|
||||
Debug print mpi #3
|
||||
debug_print_mpi:16:"00000000000000":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (0 bits) is\:\nMyFile(0999)\: 00\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"00000000000000":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (0 bits) is\:\nMyFile(0999)\: 00\n"
|
||||
|
||||
Debug print mpi #4
|
||||
debug_print_mpi:16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
|
||||
Debug print mpi #5
|
||||
debug_print_mpi:16:"0000000000000000000000000000000000000000000000000000000941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"0000000000000000000000000000000000000000000000000000000941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
|
||||
Debug print mpi #5 (raw)
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_RAW:16:"0000000000000000000000000000000000000000000000000000000941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"value of 'VALUE' (764 bits) is\:\n 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\n 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\n ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\n 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\n af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\n 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
|
||||
Debug print mpi #6
|
||||
debug_print_mpi:16:"0000000000000000000000000000000000000000000000000000000041379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (759 bits) is\:\nMyFile(0999)\: 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a 14\nMyFile(0999)\: 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90 ff\nMyFile(0999)\: e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c 09\nMyFile(0999)\: 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89 af\nMyFile(0999)\: 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b 52\nMyFile(0999)\: 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
debug_print_mpi:POLARSSL_DEBUG_LOG_FULL:16:"0000000000000000000000000000000000000000000000000000000041379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (759 bits) is\:\nMyFile(0999)\: 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a 14\nMyFile(0999)\: 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90 ff\nMyFile(0999)\: e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c 09\nMyFile(0999)\: 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89 af\nMyFile(0999)\: 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b 52\nMyFile(0999)\: 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
|
||||
|
@ -23,7 +23,7 @@ void string_debug(void *data, int level, const char *str)
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void debug_print_ret( char *file, int line, char *text, int value,
|
||||
void debug_print_ret( int mode, char *file, int line, char *text, int value,
|
||||
char *result_str )
|
||||
{
|
||||
ssl_context ssl;
|
||||
@ -33,6 +33,7 @@ void debug_print_ret( char *file, int line, char *text, int value,
|
||||
memset( buffer.buf, 0, 2000 );
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
debug_set_log_mode( mode );
|
||||
ssl_set_dbg(&ssl, string_debug, &buffer);
|
||||
|
||||
debug_print_ret( &ssl, 0, file, line, text, value);
|
||||
@ -42,8 +43,8 @@ void debug_print_ret( char *file, int line, char *text, int value,
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void debug_print_buf( char *file, int line, char *text, char *data_string,
|
||||
char *result_str )
|
||||
void debug_print_buf( int mode, char *file, int line, char *text,
|
||||
char *data_string, char *result_str )
|
||||
{
|
||||
unsigned char data[10000];
|
||||
ssl_context ssl;
|
||||
@ -57,6 +58,7 @@ void debug_print_buf( char *file, int line, char *text, char *data_string,
|
||||
|
||||
data_len = unhexify( data, data_string );
|
||||
|
||||
debug_set_log_mode( mode );
|
||||
ssl_set_dbg(&ssl, string_debug, &buffer);
|
||||
|
||||
debug_print_buf( &ssl, 0, file, line, text, data, data_len );
|
||||
@ -66,8 +68,8 @@ void debug_print_buf( char *file, int line, char *text, char *data_string,
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO:POLARSSL_X509_CRT_PARSE_C */
|
||||
void debug_print_crt( char *crt_file, char *file, int line, char *prefix,
|
||||
char *result_str )
|
||||
void debug_print_crt( int mode, char *crt_file, char *file, int line,
|
||||
char *prefix, char *result_str )
|
||||
{
|
||||
x509_crt crt;
|
||||
ssl_context ssl;
|
||||
@ -78,6 +80,7 @@ void debug_print_crt( char *crt_file, char *file, int line, char *prefix,
|
||||
memset( buffer.buf, 0, 2000 );
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
debug_set_log_mode( mode );
|
||||
ssl_set_dbg(&ssl, string_debug, &buffer);
|
||||
|
||||
TEST_ASSERT( x509_crt_parse_file( &crt, crt_file ) == 0 );
|
||||
@ -90,7 +93,7 @@ void debug_print_crt( char *crt_file, char *file, int line, char *prefix,
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_BIGNUM_C */
|
||||
void debug_print_mpi( int radix, char *value, char *file, int line,
|
||||
void debug_print_mpi( int mode, int radix, char *value, char *file, int line,
|
||||
char *prefix, char *result_str )
|
||||
{
|
||||
ssl_context ssl;
|
||||
@ -104,6 +107,8 @@ void debug_print_mpi( int radix, char *value, char *file, int line,
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
TEST_ASSERT( mpi_read_string( &val, radix, value ) == 0 );
|
||||
|
||||
debug_set_log_mode( mode );
|
||||
ssl_set_dbg(&ssl, string_debug, &buffer);
|
||||
|
||||
debug_print_mpi( &ssl, 0, file, line, prefix, &val);
|
||||
|
Loading…
Reference in New Issue
Block a user