mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-04-26 19:56:29 +00:00
Avoid memory leak when RSA-CRT is not enabled in build
This commit is contained in:
parent
8c2631b6d3
commit
60239753d2
|
@ -769,6 +769,7 @@ static int pk_parse_key_pkcs1_der( mbedtls_rsa_context *rsa,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
p += len;
|
p += len;
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_RSA_NO_CRT)
|
||||||
/*
|
/*
|
||||||
* The RSA CRT parameters DP, DQ and QP are nominally redundant, in
|
* The RSA CRT parameters DP, DQ and QP are nominally redundant, in
|
||||||
* that they can be easily recomputed from D, P and Q. However by
|
* that they can be easily recomputed from D, P and Q. However by
|
||||||
|
@ -800,6 +801,13 @@ static int pk_parse_key_pkcs1_der( mbedtls_rsa_context *rsa,
|
||||||
( ret = mbedtls_mpi_read_binary( &rsa->QP, p, len ) ) != 0 )
|
( ret = mbedtls_mpi_read_binary( &rsa->QP, p, len ) ) != 0 )
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
p += len;
|
p += len;
|
||||||
|
#else
|
||||||
|
/* Verify existance of the CRT params */
|
||||||
|
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 ||
|
||||||
|
( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 ||
|
||||||
|
( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 )
|
||||||
|
goto cleanup;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Complete the RSA private key */
|
/* Complete the RSA private key */
|
||||||
if( ( ret = mbedtls_rsa_complete( rsa ) ) != 0 )
|
if( ( ret = mbedtls_rsa_complete( rsa ) ) != 0 )
|
||||||
|
|
Loading…
Reference in a new issue