diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-05 22:41:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-05 22:41:37 +0100 |
| commit | da05ca6720cd64c3e0a615b9d1efc31305d759d6 (patch) | |
| tree | c840d1508b0fa5f2c62895ae946e6b7a3a0308d4 /thirdparty/mbedtls/library/rsa.c | |
| parent | 93f7c63ba5f14a963c6857eb61dbc032d6d3b66d (diff) | |
| parent | e435bed84708edb0c14fb94529fba7665966324f (diff) | |
| download | redot-engine-da05ca6720cd64c3e0a615b9d1efc31305d759d6.tar.gz | |
Merge pull request #36823 from akien-mga/mbedtls-2.16.5
mbedtls: Update to upstream version 2.16.5
Diffstat (limited to 'thirdparty/mbedtls/library/rsa.c')
| -rw-r--r-- | thirdparty/mbedtls/library/rsa.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/thirdparty/mbedtls/library/rsa.c b/thirdparty/mbedtls/library/rsa.c index af1a878599..09fd379fdb 100644 --- a/thirdparty/mbedtls/library/rsa.c +++ b/thirdparty/mbedtls/library/rsa.c @@ -249,6 +249,9 @@ int mbedtls_rsa_complete( mbedtls_rsa_context *ctx ) { int ret = 0; int have_N, have_P, have_Q, have_D, have_E; +#if !defined(MBEDTLS_RSA_NO_CRT) + int have_DP, have_DQ, have_QP; +#endif int n_missing, pq_missing, d_missing, is_pub, is_priv; RSA_VALIDATE_RET( ctx != NULL ); @@ -259,6 +262,12 @@ int mbedtls_rsa_complete( mbedtls_rsa_context *ctx ) have_D = ( mbedtls_mpi_cmp_int( &ctx->D, 0 ) != 0 ); have_E = ( mbedtls_mpi_cmp_int( &ctx->E, 0 ) != 0 ); +#if !defined(MBEDTLS_RSA_NO_CRT) + have_DP = ( mbedtls_mpi_cmp_int( &ctx->DP, 0 ) != 0 ); + have_DQ = ( mbedtls_mpi_cmp_int( &ctx->DQ, 0 ) != 0 ); + have_QP = ( mbedtls_mpi_cmp_int( &ctx->QP, 0 ) != 0 ); +#endif + /* * Check whether provided parameters are enough * to deduce all others. The following incomplete @@ -324,7 +333,7 @@ int mbedtls_rsa_complete( mbedtls_rsa_context *ctx ) */ #if !defined(MBEDTLS_RSA_NO_CRT) - if( is_priv ) + if( is_priv && ! ( have_DP && have_DQ && have_QP ) ) { ret = mbedtls_rsa_deduce_crt( &ctx->P, &ctx->Q, &ctx->D, &ctx->DP, &ctx->DQ, &ctx->QP ); |
