mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-29 09:21:19 +00:00
Add mbedtls_debug_print_mpi test case for 0
There was already a test case for 0 but with a non-empty representation (X->n == 1). Add a test case with X->n == 0 (freshly initialized mpi). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
c5b9510114
commit
3beb72eeaf
@ -37,6 +37,9 @@ mbedtls_debug_print_buf:"MyFile":999:"Test return value":"000102030405060708090A
|
||||
Debug print buffer #5
|
||||
mbedtls_debug_print_buf:"MyFile":999:"Test return value":"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F30":"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\: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................\nMyFile(0999)\: 0020\: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !"#$%&'()*+,-./\nMyFile(0999)\: 0030\: 30 0\n"
|
||||
|
||||
Debug print mbedtls_mpi: 0 (empty representation)
|
||||
mbedtls_debug_print_mpi:16:"":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (0 bits) is\:\nMyFile(0999)\: 00\n"
|
||||
|
||||
Debug print mbedtls_mpi: 0 (non-empty representation)
|
||||
mbedtls_debug_print_mpi:16:"00000000000000":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (0 bits) is\:\nMyFile(0999)\: 00\n"
|
||||
|
||||
|
@ -179,7 +179,9 @@ void mbedtls_debug_print_mpi( int radix, char * value, char * file, int line,
|
||||
|
||||
TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_mpi_read_string( &val, radix, value ) == 0 );
|
||||
/* If value is empty, keep val->n == 0. */
|
||||
if( value[0] != 0 )
|
||||
TEST_ASSERT( mbedtls_mpi_read_string( &val, radix, value ) == 0 );
|
||||
|
||||
mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user