Use new PSA builtin defines for CHACHA20

Change the psa_crypto use of the CHACHA20 cipher to also use the new
MBEDTLS_PSA_BUILTIN_KE_TYPE_CHACHA20.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-02-16 12:54:35 -07:00
parent 8107e31b74
commit 1bfe4d7fca

View file

@ -519,7 +519,7 @@ static psa_status_t validate_unstructured_key_bit_size( psa_key_type_t type,
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
break; break;
#endif #endif
#if defined(MBEDTLS_CHACHA20_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20)
case PSA_KEY_TYPE_CHACHA20: case PSA_KEY_TYPE_CHACHA20:
if( bits != 256 ) if( bits != 256 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
@ -3924,7 +3924,7 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
{ {
operation->iv_size = PSA_BLOCK_CIPHER_BLOCK_LENGTH( slot->attr.type ); operation->iv_size = PSA_BLOCK_CIPHER_BLOCK_LENGTH( slot->attr.type );
} }
#if defined(MBEDTLS_CHACHA20_C) #if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20)
else else
if( alg == PSA_ALG_STREAM_CIPHER && slot->attr.type == PSA_KEY_TYPE_CHACHA20 ) if( alg == PSA_ALG_STREAM_CIPHER && slot->attr.type == PSA_KEY_TYPE_CHACHA20 )
operation->iv_size = 12; operation->iv_size = 12;