1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Merge pull request #6802 from gilles-peskine-arm/test_suite_psa_crypto_metadata-20221215

Add metadata tests for CCM* and TLS1.2-ECJPAKE-to-PMS
This commit is contained in:
Manuel Pégourié-Gonnard
2023-01-27 10:05:00 +01:00
committed by GitHub
9 changed files with 106 additions and 13 deletions

View File

@ -5168,6 +5168,18 @@ static psa_status_t psa_key_agreement_try_support(psa_algorithm_t alg)
(void) alg;
return PSA_ERROR_NOT_SUPPORTED;
}
static int psa_key_derivation_allows_free_form_secret_input(
psa_algorithm_t kdf_alg)
{
#if defined(PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS)
if (kdf_alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
return 0;
}
#endif
(void) kdf_alg;
return 1;
}
#endif /* AT_LEAST_ONE_BUILTIN_KDF */
psa_status_t psa_key_derivation_setup(psa_key_derivation_operation_t *operation,
@ -5189,6 +5201,9 @@ psa_status_t psa_key_derivation_setup(psa_key_derivation_operation_t *operation,
if (status != PSA_SUCCESS) {
return status;
}
if (!psa_key_derivation_allows_free_form_secret_input(kdf_alg)) {
return PSA_ERROR_INVALID_ARGUMENT;
}
status = psa_key_derivation_setup_kdf(operation, kdf_alg);
#else
return PSA_ERROR_NOT_SUPPORTED;