Merge pull request #3988 from gilles-peskine-arm/rsa_private-ret-2.16

Backport 2.16: Fix an incorrect error code if RSA private operation glitched
This commit is contained in:
Gilles Peskine 2021-01-13 11:10:08 +01:00 committed by GitHub
commit 15c39e53e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
Bugfix
* Fix an incorrect error code if an RSA private operation glitched.

View file

@ -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)