Stream ciphers use ENCRYPT mode in HW for both encryption and
decryption operations. This patch adds in an overwrite to always set
ENCRYPT mode for these algorithms.

Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability")
Cc: arkadiuszx.kusz...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Ciara Power <ciara.po...@intel.com>
---
 drivers/crypto/qat/qat_sym_session.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym_session.c 
b/drivers/crypto/qat/qat_sym_session.c
index 0ebc66f89e..c91acc1e9b 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -1849,9 +1849,10 @@ int qat_sym_cd_cipher_set(struct qat_sym_session *cdesc,
                key_convert = ICP_QAT_HW_CIPHER_NO_CONVERT;
        } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2
                || cdesc->qat_cipher_alg ==
-                       ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3)
+                       ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3) {
                key_convert = ICP_QAT_HW_CIPHER_KEY_CONVERT;
-       else if (cdesc->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT)
+               cdesc->qat_dir = ICP_QAT_HW_CIPHER_ENCRYPT;
+       } else if (cdesc->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT)
                key_convert = ICP_QAT_HW_CIPHER_NO_CONVERT;
        else if (cdesc->qat_mode == ICP_QAT_HW_CIPHER_AEAD_MODE)
                key_convert = ICP_QAT_HW_CIPHER_NO_CONVERT;
-- 
2.34.1

Reply via email to