Skip to content

Commit 08ad327

Browse files
committed
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.
1 parent ec6ff86 commit 08ad327

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

library/psa_crypto.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -701,18 +701,13 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot,
701701
status = psa_import_ec_private_key( PSA_KEY_TYPE_GET_CURVE( slot->type ),
702702
data, data_length,
703703
&slot->data.ecp );
704-
if( status != PSA_SUCCESS )
705-
return( status );
706704
}
707705
else if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( slot->type ) )
708706
{
709707
status = psa_import_ec_public_key(
710708
PSA_KEY_TYPE_GET_CURVE( slot->type ),
711709
data, data_length,
712710
&slot->data.ecp );
713-
714-
if( status != PSA_SUCCESS )
715-
return( status );
716711
}
717712
else
718713
#endif /* MBEDTLS_ECP_C */
@@ -722,16 +717,13 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot,
722717
status = psa_import_rsa_key( slot->type,
723718
data, data_length,
724719
&slot->data.rsa );
725-
726-
if( status != PSA_SUCCESS )
727-
return( status );
728720
}
729721
else
730722
#endif /* defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C) */
731723
{
732724
return( PSA_ERROR_NOT_SUPPORTED );
733725
}
734-
return( PSA_SUCCESS );
726+
return( status );
735727
}
736728

737729
/* Retrieve an empty key slot (slot with no key data, but possibly

0 commit comments

Comments
 (0)