mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 19:05:37 +01:00
Fix an incorrect error code if RSA private operation glitched
mbedtls_rsa_private() could return the sum of two RSA error codes instead of a valid error code in some rare circumstances: * If rsa_prepare_blinding() returned MBEDTLS_ERR_RSA_RNG_FAILED (indicating a misbehaving or misconfigured RNG). * If the comparison with the public value failed (typically indicating a glitch attack). Make sure not to add two high-level error codes. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
9c1ae18c9c
commit
fc2c79633b
2
ChangeLog.d/rsa_private-ret.txt
Normal file
2
ChangeLog.d/rsa_private-ret.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Bugfix
|
||||||
|
* Fix an incorrect error code if an RSA private operation glitched.
|
@ -1045,10 +1045,10 @@ cleanup:
|
|||||||
mbedtls_mpi_free( &C );
|
mbedtls_mpi_free( &C );
|
||||||
mbedtls_mpi_free( &I );
|
mbedtls_mpi_free( &I );
|
||||||
|
|
||||||
if( ret != 0 )
|
if( ret != 0 && ret >= -0x007f )
|
||||||
return( MBEDTLS_ERR_RSA_PRIVATE_FAILED + ret );
|
return( MBEDTLS_ERR_RSA_PRIVATE_FAILED + ret );
|
||||||
|
|
||||||
return( 0 );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_PKCS1_V21)
|
#if defined(MBEDTLS_PKCS1_V21)
|
||||||
|
Loading…
Reference in New Issue
Block a user