mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-02 19:51:09 +00:00
Convert exercise_key_derivation_key to the new KDF API
This commit is contained in:
parent
d6dce9f4f3
commit
7607cd6e57
|
@ -530,9 +530,9 @@ static int exercise_key_derivation_key( psa_key_handle_t handle,
|
||||||
|
|
||||||
if( usage & PSA_KEY_USAGE_DERIVE )
|
if( usage & PSA_KEY_USAGE_DERIVE )
|
||||||
{
|
{
|
||||||
|
PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
|
||||||
if( PSA_ALG_IS_HKDF( alg ) )
|
if( PSA_ALG_IS_HKDF( alg ) )
|
||||||
{
|
{
|
||||||
PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
|
|
||||||
PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
|
PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
|
||||||
PSA_KEY_DERIVATION_INPUT_SALT,
|
PSA_KEY_DERIVATION_INPUT_SALT,
|
||||||
label,
|
label,
|
||||||
|
@ -545,17 +545,26 @@ static int exercise_key_derivation_key( psa_key_handle_t handle,
|
||||||
seed,
|
seed,
|
||||||
seed_length ) );
|
seed_length ) );
|
||||||
}
|
}
|
||||||
#if defined(PSA_PRE_1_0_KEY_DERIVATION)
|
else if( PSA_ALG_IS_TLS12_PRF( alg ) ||
|
||||||
|
PSA_ALG_IS_TLS12_PSK_TO_MS( alg ) )
|
||||||
|
{
|
||||||
|
PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
|
||||||
|
PSA_KEY_DERIVATION_INPUT_SEED,
|
||||||
|
seed,
|
||||||
|
seed_length ) );
|
||||||
|
PSA_ASSERT( psa_key_derivation_input_key( &operation,
|
||||||
|
PSA_KEY_DERIVATION_INPUT_SECRET,
|
||||||
|
handle ) );
|
||||||
|
PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
|
||||||
|
PSA_KEY_DERIVATION_INPUT_LABEL,
|
||||||
|
label,
|
||||||
|
label_length ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// legacy
|
TEST_ASSERT( ! "Key derivation algorithm not supported" );
|
||||||
PSA_ASSERT( psa_key_derivation( &operation,
|
|
||||||
handle, alg,
|
|
||||||
label, label_length,
|
|
||||||
seed, seed_length,
|
|
||||||
sizeof( output ) ) );
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
|
PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
|
||||||
output,
|
output,
|
||||||
sizeof( output ) ) );
|
sizeof( output ) ) );
|
||||||
|
|
Loading…
Reference in a new issue