setup_psa_key_derivation(): add optional salt parameter

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-04-05 17:12:11 +02:00
parent 60d83f0126
commit 1f02703e53

View file

@ -4715,6 +4715,7 @@ static psa_status_t setup_psa_key_derivation( psa_key_derivation_operation_t* de
psa_algorithm_t alg,
const unsigned char* seed, size_t seed_length,
const unsigned char* label, size_t label_length,
const unsigned char* salt, size_t salt_length,
size_t capacity )
{
psa_status_t status;
@ -4731,6 +4732,15 @@ static psa_status_t setup_psa_key_derivation( psa_key_derivation_operation_t* de
if( status != PSA_SUCCESS )
return( status );
if ( salt != NULL )
{
status = psa_key_derivation_input_bytes( derivation,
PSA_KEY_DERIVATION_INPUT_SALT,
salt, salt_length );
if( status != PSA_SUCCESS )
return( status );
}
if( mbedtls_svc_key_id_is_null( key ) )
{
status = psa_key_derivation_input_bytes(
@ -4804,6 +4814,7 @@ static int tls_prf_generic( mbedtls_md_type_t md_type,
random, rlen,
(unsigned char const *) label,
(size_t) strlen( label ),
NULL, 0,
dlen );
if( status != PSA_SUCCESS )
{