diff --git a/include/mbedtls/psa_util.h b/include/mbedtls/psa_util.h index f6f2e58054..31a1254b9f 100644 --- a/include/mbedtls/psa_util.h +++ b/include/mbedtls/psa_util.h @@ -57,6 +57,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. */ diff --git a/library/cipher.c b/library/cipher.c index 546cace552..dc801894b7 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -1266,9 +1266,12 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx, if( status != PSA_SUCCESS ) return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); - status = psa_cipher_set_iv( &cipher_op, iv, iv_len ); - if( status != PSA_SUCCESS ) - return( MBEDTLS_ERR_PLATFORM_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,