From c67200d0e675ecc5b4f7f267a2504a3004bc1deb Mon Sep 17 00:00:00 2001 From: Jaeden Amero Date: Mon, 14 Jan 2019 13:12:39 +0000 Subject: [PATCH] psa: Remove extra status handling from import Remove extra status handling code from psa_import_key_into_slot(). This helps save a tiny amount of code space, but mainly serves to improve the readability of the code. --- library/psa_crypto.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 03d337178..bb53f8194 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -701,8 +701,6 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot, status = psa_import_ec_private_key( PSA_KEY_TYPE_GET_CURVE( slot->type ), data, data_length, &slot->data.ecp ); - if( status != PSA_SUCCESS ) - return( status ); } else if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( slot->type ) ) { @@ -710,9 +708,6 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot, PSA_KEY_TYPE_GET_CURVE( slot->type ), data, data_length, &slot->data.ecp ); - - if( status != PSA_SUCCESS ) - return( status ); } else #endif /* MBEDTLS_ECP_C */ @@ -722,16 +717,13 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot, status = psa_import_rsa_key( slot->type, data, data_length, &slot->data.rsa ); - - if( status != PSA_SUCCESS ) - return( status ); } else #endif /* defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C) */ { return( PSA_ERROR_NOT_SUPPORTED ); } - return( PSA_SUCCESS ); + return( status ); } /* Retrieve an empty key slot (slot with no key data, but possibly