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.
This commit is contained in:
Jaeden Amero 2019-01-14 13:12:39 +00:00
parent cd09d8c83a
commit c67200d0e6

View file

@ -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 ), status = psa_import_ec_private_key( PSA_KEY_TYPE_GET_CURVE( slot->type ),
data, data_length, data, data_length,
&slot->data.ecp ); &slot->data.ecp );
if( status != PSA_SUCCESS )
return( status );
} }
else if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( slot->type ) ) 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 ), PSA_KEY_TYPE_GET_CURVE( slot->type ),
data, data_length, data, data_length,
&slot->data.ecp ); &slot->data.ecp );
if( status != PSA_SUCCESS )
return( status );
} }
else else
#endif /* MBEDTLS_ECP_C */ #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, status = psa_import_rsa_key( slot->type,
data, data_length, data, data_length,
&slot->data.rsa ); &slot->data.rsa );
if( status != PSA_SUCCESS )
return( status );
} }
else else
#endif /* defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C) */ #endif /* defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C) */
{ {
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
return( PSA_SUCCESS ); return( status );
} }
/* Retrieve an empty key slot (slot with no key data, but possibly /* Retrieve an empty key slot (slot with no key data, but possibly