Make psa_key_derivation_setup return early if the key agreement is not supported
Otherwise the systematically generated algorithm-not-supported tests complain when they try to start an operation and succeed. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
0cc417d34b
commit
0c3a071300
1 changed files with 14 additions and 0 deletions
|
@ -5080,6 +5080,16 @@ static psa_status_t psa_key_derivation_setup_kdf(
|
|||
operation->capacity = 255 * hash_size;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
static psa_status_t psa_key_agreement_try_support( psa_algorithm_t alg )
|
||||
{
|
||||
#if defined(PSA_WANT_ALG_ECDH)
|
||||
if( alg == PSA_ALG_ECDH )
|
||||
return( PSA_SUCCESS );
|
||||
#endif
|
||||
(void) alg;
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
|
||||
|
||||
psa_status_t psa_key_derivation_setup( psa_key_derivation_operation_t *operation,
|
||||
|
@ -5096,6 +5106,10 @@ psa_status_t psa_key_derivation_setup( psa_key_derivation_operation_t *operation
|
|||
{
|
||||
#if defined(AT_LEAST_ONE_BUILTIN_KDF)
|
||||
psa_algorithm_t kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF( alg );
|
||||
psa_algorithm_t ka_alg = PSA_ALG_KEY_AGREEMENT_GET_BASE( alg );
|
||||
status = psa_key_agreement_try_support( ka_alg );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
status = psa_key_derivation_setup_kdf( operation, kdf_alg );
|
||||
#else
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
|
|
Loading…
Reference in a new issue