Add PSA support for MBEDTLS_CIPHER_AES_128_ECB

Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemyslaw Stekiel 2021-09-29 12:13:11 +02:00
parent 6c866689e3
commit f0fa86eee5
2 changed files with 7 additions and 3 deletions

View File

@ -59,6 +59,7 @@ static inline psa_key_type_t mbedtls_psa_translate_cipher_type(
case MBEDTLS_CIPHER_AES_128_CBC:
case MBEDTLS_CIPHER_AES_192_CBC:
case MBEDTLS_CIPHER_AES_256_CBC:
case MBEDTLS_CIPHER_AES_128_ECB:
return( PSA_KEY_TYPE_AES );
/* ARIA not yet supported in PSA. */

View File

@ -1246,9 +1246,12 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
if( status != PSA_SUCCESS )
return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );
status = psa_cipher_set_iv( &cipher_op, iv, iv_len );
if( status != PSA_SUCCESS )
return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );
if( ctx->cipher_info->mode != MBEDTLS_MODE_ECB )
{
status = psa_cipher_set_iv( &cipher_op, iv, iv_len );
if( status != PSA_SUCCESS )
return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED );
}
status = psa_cipher_update( &cipher_op,
input, ilen,