From 2036c60489df2d6b8c6ee4925f9c9826d44de69a Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Thu, 7 Sep 2023 17:19:27 +0800 Subject: [PATCH 38/48] uadk_prov_cipher: xts mode does not use default provider Now uadk_provider chooses the default provider for small packets, when inlen < threshold (192), but xts mode fails in speed test. Temporarily solving the problem by disabling default for xfs mode. Fail: openssl speed -provider uadk_provider -evp aes-128-xts -bytes 16 Success: openssl speed -provider default -evp aes-128-xts -bytes 16 The speed will call EVP_CipherInit_ex2 twice, without iv the second time, and EVP_CIPHER_CTX_reset clears iv_set = 0 causing error. The default provider does not call EVP_CIPHER_CTX_reset, so iv_set = 1 without problem. A bit tricky, simply not using the default pvovider for xts mode. Signed-off-by: Zhangfei Gao --- src/uadk_prov_cipher.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/uadk_prov_cipher.c b/src/uadk_prov_cipher.c index 7a359f6..64058ee 100644 --- a/src/uadk_prov_cipher.c +++ b/src/uadk_prov_cipher.c @@ -143,12 +143,6 @@ static int uadk_fetch_sw_cipher(struct cipher_priv_ctx *priv) case NID_aes_256_ecb: priv->sw_cipher = EVP_CIPHER_fetch(NULL, "AES-256-ECB", "provider=default"); break; - case NID_aes_128_xts: - priv->sw_cipher = EVP_CIPHER_fetch(NULL, "AES-128-XTS", "provider=default"); - break; - case NID_aes_256_xts: - priv->sw_cipher = EVP_CIPHER_fetch(NULL, "AES-256-XTS", "provider=default"); - break; case NID_sm4_cbc: priv->sw_cipher = EVP_CIPHER_fetch(NULL, "SM4-CBC", "provider=default"); break; -- 2.25.1