mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Make salt mandatory for HKDF-EXTRACT + adapt tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
@@ -5233,9 +5233,14 @@ static psa_status_t psa_hkdf_input( psa_hkdf_key_derivation_t *hkdf,
|
||||
else
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXPAND */
|
||||
{
|
||||
/* If no salt was provided, use an empty salt. */
|
||||
/* HKDF: If no salt was provided, use an empty salt.
|
||||
* HKDF-EXTRACT: salt is mandatory. */
|
||||
if( hkdf->state == HKDF_STATE_INIT )
|
||||
{
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT)
|
||||
if( PSA_ALG_IS_HKDF_EXTRACT( kdf_alg ) )
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
#endif /* MBEDTLS_PSA_BUILTIN_ALG_HKDF_EXTRACT */
|
||||
status = psa_key_derivation_start_hmac( &hkdf->hmac,
|
||||
hash_alg,
|
||||
NULL, 0 );
|
||||
|
||||
Reference in New Issue
Block a user