diff --git a/ChangeLog.d/rsa_private-ret.txt b/ChangeLog.d/rsa_private-ret.txt new file mode 100644 index 000000000..b965cea77 --- /dev/null +++ b/ChangeLog.d/rsa_private-ret.txt @@ -0,0 +1,2 @@ +Bugfix + * Fix an incorrect error code if an RSA private operation glitched. diff --git a/library/rsa.c b/library/rsa.c index a25c633bc..000754649 100644 --- a/library/rsa.c +++ b/library/rsa.c @@ -1106,10 +1106,10 @@ cleanup: mbedtls_mpi_free( &C ); mbedtls_mpi_free( &I ); - if( ret != 0 ) + if( ret != 0 && ret >= -0x007f ) return( MBEDTLS_ERR_RSA_PRIVATE_FAILED + ret ); - return( 0 ); + return( ret ); } #if defined(MBEDTLS_PKCS1_V21)