Final review comments

This commit is contained in:
Jack Lloyd 2020-01-28 14:43:52 -05:00
parent 60239753d2
commit 2e9eef4f7b
2 changed files with 8 additions and 16 deletions

View File

@ -782,25 +782,17 @@ static int pk_parse_key_pkcs1_der( mbedtls_rsa_context *rsa,
*/ */
/* Import DP */ /* Import DP */
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DP ) ) != 0)
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
( ret = mbedtls_mpi_read_binary( &rsa->DP, p, len ) ) != 0 )
goto cleanup; goto cleanup;
p += len;
/* Import DQ */ /* Import DQ */
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DQ ) ) != 0)
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
( ret = mbedtls_mpi_read_binary( &rsa->DQ, p, len ) ) != 0 )
goto cleanup; goto cleanup;
p += len;
/* Import QP */ /* Import QP */
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->QP ) ) != 0)
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
( ret = mbedtls_mpi_read_binary( &rsa->QP, p, len ) ) != 0 )
goto cleanup; goto cleanup;
p += len;
#else #else
/* Verify existance of the CRT params */ /* Verify existance of the CRT params */
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 || if( ( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 ||

View File

@ -334,7 +334,7 @@ int mbedtls_rsa_complete( mbedtls_rsa_context *ctx )
*/ */
#if !defined(MBEDTLS_RSA_NO_CRT) #if !defined(MBEDTLS_RSA_NO_CRT)
if( is_priv && !(have_DP && have_DQ && have_QP)) if( is_priv && ! ( have_DP && have_DQ && have_QP ) )
{ {
ret = mbedtls_rsa_deduce_crt( &ctx->P, &ctx->Q, &ctx->D, ret = mbedtls_rsa_deduce_crt( &ctx->P, &ctx->Q, &ctx->D,
&ctx->DP, &ctx->DQ, &ctx->QP ); &ctx->DP, &ctx->DQ, &ctx->QP );