mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-08 03:50:37 +00:00
Fix for memory leak in RSA-SSA signing
Fix in rsa_rsassa_pkcs1_v15_sign() in rsa.c. Resolves github issue #372
This commit is contained in:
parent
c3f9229d49
commit
e5049f46d4
|
@ -6,6 +6,8 @@ Bugfix
|
||||||
* Fix bug in certificate validation that caused valid chains to be rejected
|
* Fix bug in certificate validation that caused valid chains to be rejected
|
||||||
when the first intermediate certificate has pathLenConstraint=0. Found by
|
when the first intermediate certificate has pathLenConstraint=0. Found by
|
||||||
Nicholas Wilson. Introduced in mbed TLS 1.3.15. #280
|
Nicholas Wilson. Introduced in mbed TLS 1.3.15. #280
|
||||||
|
* Removed potential leak in rsa_rsassa_pkcs1_v15_sign(), found by
|
||||||
|
JayaraghavendranK. #372
|
||||||
|
|
||||||
= Version 1.2.18 released 2015-11-04
|
= Version 1.2.18 released 2015-11-04
|
||||||
|
|
||||||
|
|
|
@ -1034,10 +1034,16 @@ int rsa_rsassa_pkcs1_v15_sign( rsa_context *ctx,
|
||||||
* temporary buffer and check it before returning it.
|
* temporary buffer and check it before returning it.
|
||||||
*/
|
*/
|
||||||
sig_try = malloc( ctx->len );
|
sig_try = malloc( ctx->len );
|
||||||
verif = malloc( ctx->len );
|
if( sig_try == NULL )
|
||||||
if( sig_try == NULL || verif == NULL )
|
|
||||||
return( POLARSSL_ERR_MPI_MALLOC_FAILED );
|
return( POLARSSL_ERR_MPI_MALLOC_FAILED );
|
||||||
|
|
||||||
|
verif = malloc( ctx->len );
|
||||||
|
if( verif == NULL )
|
||||||
|
{
|
||||||
|
free( sig_try );
|
||||||
|
return( POLARSSL_ERR_MPI_MALLOC_FAILED );
|
||||||
|
}
|
||||||
|
|
||||||
MPI_CHK( rsa_private( ctx, f_rng, p_rng, sig, sig_try ) );
|
MPI_CHK( rsa_private( ctx, f_rng, p_rng, sig, sig_try ) );
|
||||||
MPI_CHK( rsa_public( ctx, sig_try, verif ) );
|
MPI_CHK( rsa_public( ctx, sig_try, verif ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue