From 9566ff791337d6645943d1123e041b65149b3a99 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Wed, 7 Feb 2018 18:59:41 +0200 Subject: [PATCH] Fix minor issues raised in PR review 1. Style issues fixes - remove redundant spacing. 2. Remove depency of `MBEDTLS_RSA_C` in `pk_parse_public_keyfile_rsa()` tests, as the function itself is dependent on it. --- library/pkparse.c | 8 ++++---- tests/suites/test_suite_pkparse.data | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/library/pkparse.c b/library/pkparse.c index 41eeadf45..cccc0b596 100644 --- a/library/pkparse.c +++ b/library/pkparse.c @@ -1325,16 +1325,16 @@ int mbedtls_pk_parse_public_key( mbedtls_pk_context *ctx, if( ( ret = mbedtls_pk_setup( ctx, pk_info ) ) != 0 ) return( ret ); - p = (unsigned char *) key; + p = (unsigned char *)key; ret = pk_get_rsapubkey( &p, p + keylen, mbedtls_pk_rsa( *ctx ) ); - if ( ret == 0 ) + if( ret == 0 ) { return( ret ); } mbedtls_pk_free( ctx ); - if ( ret != ( MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) ) + if( ret != ( MBEDTLS_ERR_PK_INVALID_PUBKEY + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) ) { - return ( ret ); + return( ret ); } #endif /* MBEDTLS_RSA_C */ p = (unsigned char *) key; diff --git a/tests/suites/test_suite_pkparse.data b/tests/suites/test_suite_pkparse.data index 32957266c..e9f65c9c9 100644 --- a/tests/suites/test_suite_pkparse.data +++ b/tests/suites/test_suite_pkparse.data @@ -110,11 +110,10 @@ Parse Public RSA Key #1 (PKCS#8 wrapped, DER) pk_parse_public_keyfile_rsa:"data_files/rsa_pkcs8_2048_public.der":0 Parse Public RSA Key #3 (PKCS#1 wrapped) -depends_on:MBEDTLS_RSA_C:MBEDTLS_PEM_PARSE_C +depends_on:MBEDTLS_PEM_PARSE_C pk_parse_public_keyfile_rsa:"data_files/rsa_pkcs1_2048_public.pem":0 Parse Public RSA Key #4 (PKCS#1 wrapped, DER) -depends_on:MBEDTLS_RSA_C pk_parse_public_keyfile_rsa:"data_files/rsa_pkcs1_2048_public.der":0 Parse Public EC Key #1 (RFC 5480, DER)