Simplify psa_key_derivation_input_bytes

The specific key derivation input functions support a subset of the
input options and need to check it anyway. Checking it at the top level
is redundant, it brings a very little value and comes with a cost in
code size and maintainability.
This commit is contained in:
Janos Follath 2019-06-14 11:27:57 +01:00
parent adbec81cc4
commit c56215163f

View file

@ -4851,17 +4851,11 @@ psa_status_t psa_key_derivation_input_bytes( psa_key_derivation_operation_t *ope
const uint8_t *data,
size_t data_length )
{
switch( step )
{
case PSA_KEY_DERIVATION_INPUT_LABEL:
case PSA_KEY_DERIVATION_INPUT_SALT:
case PSA_KEY_DERIVATION_INPUT_INFO:
case PSA_KEY_DERIVATION_INPUT_SEED:
return( psa_key_derivation_input_internal( operation, step,
data, data_length ) );
default:
return( PSA_ERROR_INVALID_ARGUMENT );
}
if( step == PSA_KEY_DERIVATION_INPUT_SECRET )
return( PSA_ERROR_INVALID_ARGUMENT );
return( psa_key_derivation_input_internal( operation, step,
data, data_length ) );
}
psa_status_t psa_key_derivation_input_key( psa_key_derivation_operation_t *operation,