Change ifdefs in psa_crypto.c to new WANT macros

There are a few instances of MBEDTLS_*_C (specifically for DES) in
psa_crypto.c.  Change to the PSA_WANT_KEY_TYPE_DES macros to reflect the
new PSA crypto config.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-02-05 12:51:07 -07:00
parent 4b9ec7a598
commit 0baa7b5e98

View file

@ -3875,7 +3875,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
if( ret != 0 )
goto exit;
#if defined(MBEDTLS_DES_C)
#if defined(PSA_WANT_KEY_TYPE_DES)
if( slot->attr.type == PSA_KEY_TYPE_DES && key_bits == 128 )
{
/* Two-key Triple-DES is 3-key Triple-DES with K1=K3 */
@ -5063,7 +5063,7 @@ exit:
return( status );
}
#if defined(MBEDTLS_DES_C)
#if defined(PSA_WANT_KEY_TYPE_DES)
static void psa_des_set_key_parity( uint8_t *data, size_t data_size )
{
if( data_size >= 8 )
@ -5073,7 +5073,7 @@ static void psa_des_set_key_parity( uint8_t *data, size_t data_size )
if( data_size >= 24 )
mbedtls_des_key_set_parity( data + 16 );
}
#endif /* MBEDTLS_DES_C */
#endif /* PSA_WANT_KEY_TYPE_DES */
static psa_status_t psa_generate_derived_key_internal(
psa_key_slot_t *slot,
@ -5095,10 +5095,10 @@ static psa_status_t psa_generate_derived_key_internal(
status = psa_key_derivation_output_bytes( operation, data, bytes );
if( status != PSA_SUCCESS )
goto exit;
#if defined(MBEDTLS_DES_C)
#if defined(PSA_WANT_KEY_TYPE_DES)
if( slot->attr.type == PSA_KEY_TYPE_DES )
psa_des_set_key_parity( data, bytes );
#endif /* MBEDTLS_DES_C */
#endif /* PSA_WANT_KEY_TYPE_DES */
status = psa_allocate_buffer_to_slot( slot, bytes );
if( status != PSA_SUCCESS )
@ -6029,7 +6029,7 @@ psa_status_t psa_generate_key_internal(
if( status != PSA_SUCCESS )
return( status );
#if defined(MBEDTLS_DES_C)
#if defined(PSA_WANT_KEY_TYPE_DES)
if( type == PSA_KEY_TYPE_DES )
psa_des_set_key_parity( key_buffer, key_buffer_size );
#endif /* MBEDTLS_DES_C */