crypto/qat: add Chacha-Poly in UCS-SPC mode
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Mon, 28 Jun 2021 16:34:27 +0000 (17:34 +0100)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 20 Jul 2021 08:32:05 +0000 (10:32 +0200)
This commit adds Chacha20-Poly1305 aglorithm that works
in UCS (Unified crypto slice) SPC(Single-Pass) mode.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/crypto/qat/qat_sym_capabilities.h
drivers/crypto/qat/qat_sym_session.c

index fc8e667..5c6e723 100644 (file)
                                },                                      \
                        }, }                                            \
                }, }                                                    \
-       }                                                               \
+       },                                                              \
+       {       /* Chacha20-Poly1305 */                                 \
+       .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,        \
+                       {.aead = {                                      \
+                               .algo = RTE_CRYPTO_AEAD_CHACHA20_POLY1305, \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 32,                      \
+                                       .max = 32,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 16,                      \
+                                       .max = 16,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                               .aad_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 240,                     \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = {                            \
+                                       .min = 12,                      \
+                                       .max = 12,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                       }, }                                            \
+               }, }                                                    \
+       }
 
 
 
index 04bc2d7..6b87fc0 100644 (file)
@@ -922,6 +922,8 @@ qat_sym_session_configure_aead(struct rte_cryptodev *dev,
        case RTE_CRYPTO_AEAD_CHACHA20_POLY1305:
                if (aead_xform->key.length != ICP_QAT_HW_CHACHAPOLY_KEY_SZ)
                        return -EINVAL;
+               if (qat_dev_gen == QAT_GEN4)
+                       session->is_ucs = 1;
                session->qat_cipher_alg =
                                ICP_QAT_HW_CIPHER_ALGO_CHACHA20_POLY1305;
                qat_sym_session_handle_single_pass(session,