Exclude a few lines from lcov coverage stats:
- "fail" branches in selftests
- "should never happen" errors in SSL
- cipher_xxx() failures in SSL
- some things that fail only if malloc() fails
- some things that fail only if fread/fwrite()/ftell() fails
(after fopen() succeeded)
- some things that fail only if a parameter is invalid, but the parameter was
actually validated earlier
- generated code in library/error.c
diff --git a/library/rsa.c b/library/rsa.c
index 3883d09..70c8119 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -1603,12 +1603,12 @@
if( mbedtls_rsa_check_pubkey( &rsa ) != 0 ||
mbedtls_rsa_check_privkey( &rsa ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( verbose != 0 )
mbedtls_printf( "passed\n PKCS#1 encryption : " );
@@ -1617,12 +1617,12 @@
if( mbedtls_rsa_pkcs1_encrypt( &rsa, myrand, NULL, MBEDTLS_RSA_PUBLIC, PT_LEN,
rsa_plaintext, rsa_ciphertext ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( verbose != 0 )
mbedtls_printf( "passed\n PKCS#1 decryption : " );
@@ -1630,20 +1630,20 @@
if( mbedtls_rsa_pkcs1_decrypt( &rsa, myrand, NULL, MBEDTLS_RSA_PRIVATE, &len,
rsa_ciphertext, rsa_decrypted,
sizeof(rsa_decrypted) ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( memcmp( rsa_decrypted, rsa_plaintext, len ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( verbose != 0 )
mbedtls_printf( "passed\n" );
@@ -1656,24 +1656,24 @@
if( mbedtls_rsa_pkcs1_sign( &rsa, myrand, NULL, MBEDTLS_RSA_PRIVATE, MBEDTLS_MD_SHA1, 0,
sha1sum, rsa_ciphertext ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( verbose != 0 )
mbedtls_printf( "passed\n PKCS#1 sig. verify: " );
if( mbedtls_rsa_pkcs1_verify( &rsa, NULL, NULL, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_SHA1, 0,
sha1sum, rsa_ciphertext ) != 0 )
- {
+ { // LCOV_EXCL_START
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
- }
+ } // LCOV_EXCL_STOP
if( verbose != 0 )
mbedtls_printf( "passed\n" );