Skip to content

Commit 2e9eef4

Browse files
committed
Final review comments
1 parent 6023975 commit 2e9eef4

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

library/pkparse.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -782,25 +782,17 @@ static int pk_parse_key_pkcs1_der( mbedtls_rsa_context *rsa,
782782
*/
783783

784784
/* Import DP */
785-
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,
786-
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
787-
( ret = mbedtls_mpi_read_binary( &rsa->DP, p, len ) ) != 0 )
788-
goto cleanup;
789-
p += len;
785+
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DP ) ) != 0)
786+
goto cleanup;
790787

791788
/* Import DQ */
792-
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,
793-
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
794-
( ret = mbedtls_mpi_read_binary( &rsa->DQ, p, len ) ) != 0 )
795-
goto cleanup;
796-
p += len;
789+
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->DQ ) ) != 0)
790+
goto cleanup;
797791

798792
/* Import QP */
799-
if( ( ret = mbedtls_asn1_get_tag( &p, end, &len,
800-
MBEDTLS_ASN1_INTEGER ) ) != 0 ||
801-
( ret = mbedtls_mpi_read_binary( &rsa->QP, p, len ) ) != 0 )
802-
goto cleanup;
803-
p += len;
793+
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &rsa->QP ) ) != 0)
794+
goto cleanup;
795+
804796
#else
805797
/* Verify existance of the CRT params */
806798
if( ( ret = mbedtls_asn1_get_mpi( &p, end, &T ) ) != 0 ||

library/rsa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int mbedtls_rsa_complete( mbedtls_rsa_context *ctx )
334334
*/
335335

336336
#if !defined(MBEDTLS_RSA_NO_CRT)
337-
if( is_priv && !(have_DP && have_DQ && have_QP))
337+
if( is_priv && ! ( have_DP && have_DQ && have_QP ) )
338338
{
339339
ret = mbedtls_rsa_deduce_crt( &ctx->P, &ctx->Q, &ctx->D,
340340
&ctx->DP, &ctx->DQ, &ctx->QP );

0 commit comments

Comments
 (0)