diff --git a/library/aead_chacha20_poly1305.c b/library/aead_chacha20_poly1305.c index 2dea5c9c5..3aa8d637d 100644 --- a/library/aead_chacha20_poly1305.c +++ b/library/aead_chacha20_poly1305.c @@ -428,6 +428,11 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) for ( i = 0U; i < 1U; i++ ) { + if ( verbose != 0 ) + { + mbedtls_printf( " ChaCha20-Poly1305 test %zi ", i ); + } + result = mbedtls_aead_chacha20_poly1305_crypt_and_mac( test_key[i], test_nonce[i], MBEDTLS_AEAD_CHACHA20_POLY1305_ENCRYPT, @@ -441,7 +446,7 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "ChaCha20-Poly1305 test %zi error code: %i\n", i, result ); + mbedtls_printf( "error code: %i\n", result ); } return( -1 ); } @@ -450,7 +455,7 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "ChaCha20-Poly1305 test %zi failure (wrong output)\n", i ); + mbedtls_printf( "failure (wrong output)\n" ); } return( -1 ); } @@ -459,10 +464,20 @@ int mbedtls_aead_chacha20_poly1305_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "ChaCha20-Poly1305 test %zi failure (wrong MAC)\n", i ); + mbedtls_printf( "failure (wrong MAC)\n" ); } return( -1 ); } + + if ( verbose != 0 ) + { + mbedtls_printf( "passed\n" ); + } + } + + if( verbose != 0 ) + { + mbedtls_printf( "\n" ); } return( 0 ); diff --git a/library/chacha20.c b/library/chacha20.c index 351124541..f3ddd9b96 100644 --- a/library/chacha20.c +++ b/library/chacha20.c @@ -559,6 +559,11 @@ int mbedtls_chacha20_self_test( int verbose ) for ( i = 0U; i < 2U; i++ ) { + if ( verbose != 0 ) + { + mbedtls_printf( " ChaCha20 test %zi ", i ); + } + result = mbedtls_chacha20_crypt( test_keys[i], test_nonces[i], test_counters[i], @@ -569,7 +574,7 @@ int mbedtls_chacha20_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "ChaCha20 test %zi error code: %i\n", i, result ); + mbedtls_printf( "error code: %i\n", result ); } return( -1 ); @@ -579,11 +584,21 @@ int mbedtls_chacha20_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "ChaCha20 test %zi failed\n", i ); + mbedtls_printf( "failed\n" ); } return( -1 ); } + + if ( verbose != 0 ) + { + mbedtls_printf( "passed\n" ); + } + } + + if( verbose != 0 ) + { + mbedtls_printf( "\n" ); } return( 0 ); diff --git a/library/poly1305.c b/library/poly1305.c index f9bdf2c93..d7c9ce160 100644 --- a/library/poly1305.c +++ b/library/poly1305.c @@ -490,6 +490,11 @@ int mbedtls_poly1305_self_test( int verbose ) for ( i = 0U; i < 2U; i++ ) { + if ( verbose != 0 ) + { + mbedtls_printf( " Poly1305 test %zi ", i ); + } + result = mbedtls_poly1305_mac( test_keys[i], test_data_len[i], test_data[i], @@ -498,7 +503,7 @@ int mbedtls_poly1305_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "Poly1305 test %zi error code: %i\n", i, result ); + mbedtls_printf( "error code: %i\n", result ); } return( -1 ); @@ -508,11 +513,21 @@ int mbedtls_poly1305_self_test( int verbose ) { if ( verbose != 0 ) { - mbedtls_printf( "Poly1305 test %zi failed\n", i ); + mbedtls_printf( "failed\n" ); } return( -1 ); } + + if ( verbose != 0 ) + { + mbedtls_printf( "passed\n" ); + } + } + + if( verbose != 0 ) + { + mbedtls_printf( "\n" ); } return( 0 );