crypto/qat: enable GEN4 legacy algorithms
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Mon, 28 Jun 2021 16:34:21 +0000 (17:34 +0100)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 20 Jul 2021 08:32:05 +0000 (10:32 +0200)
This commit enables algorithms labeled as 'legacy'
on QAT generation 4 devices.
Following algorithms were enabled:
* AES-CBC
* AES-CMAC
* AES-XCBC MAC
* NULL (auth, cipher)
* SHA1-HMAC
* SHA2-HMAC (224, 256, 384, 512)

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_pmd.c

index f7cab2f..21c817b 100644 (file)
                }, }                                                    \
        }
 
+#define QAT_BASE_GEN4_SYM_CAPABILITIES                                 \
+       {       /* AES CBC */                                           \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,      \
+                       {.cipher = {                                    \
+                               .algo = RTE_CRYPTO_CIPHER_AES_CBC,      \
+                               .block_size = 16,                       \
+                               .key_size = {                           \
+                                       .min = 16,                      \
+                                       .max = 32,                      \
+                                       .increment = 8                  \
+                               },                                      \
+                               .iv_size = {                            \
+                                       .min = 16,                      \
+                                       .max = 16,                      \
+                                       .increment = 0                  \
+                               }                                       \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA1 HMAC */                                         \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,      \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 1,                       \
+                                       .max = 64,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 20,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA224 HMAC */                                       \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA224_HMAC,    \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 1,                       \
+                                       .max = 64,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 28,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA256 HMAC */                                       \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,    \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 1,                       \
+                                       .max = 64,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 32,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA384 HMAC */                                       \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,    \
+                               .block_size = 128,                      \
+                               .key_size = {                           \
+                                       .min = 1,                       \
+                                       .max = 128,                     \
+                                       .increment = 1                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 48,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA512 HMAC */                                       \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,    \
+                               .block_size = 128,                      \
+                               .key_size = {                           \
+                                       .min = 1,                       \
+                                       .max = 128,                     \
+                                       .increment = 1                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 64,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* AES XCBC MAC */                                      \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC,   \
+                               .block_size = 16,                       \
+                               .key_size = {                           \
+                                       .min = 16,                      \
+                                       .max = 16,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 12,                      \
+                                       .max = 12,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                               .aad_size = { 0 },                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* AES CMAC */                                          \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_AES_CMAC,       \
+                               .block_size = 16,                       \
+                               .key_size = {                           \
+                                       .min = 16,                      \
+                                       .max = 16,                      \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 4,                       \
+                                       .max = 16,                      \
+                                       .increment = 4                  \
+                               }                                       \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* AES DOCSIS BPI */                                    \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,      \
+                       {.cipher = {                                    \
+                               .algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI,\
+                               .block_size = 16,                       \
+                               .key_size = {                           \
+                                       .min = 16,                      \
+                                       .max = 32,                      \
+                                       .increment = 16                 \
+                               },                                      \
+                               .iv_size = {                            \
+                                       .min = 16,                      \
+                                       .max = 16,                      \
+                                       .increment = 0                  \
+                               }                                       \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* NULL (AUTH) */                                       \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_NULL,           \
+                               .block_size = 1,                        \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, },                                           \
+               }, },                                                   \
+       },                                                              \
+       {       /* NULL (CIPHER) */                                     \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,      \
+                       {.cipher = {                                    \
+                               .algo = RTE_CRYPTO_CIPHER_NULL,         \
+                               .block_size = 1,                        \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .iv_size = {                            \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               }                                       \
+                       }, },                                           \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA1 */                                              \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA1,           \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 20,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA224 */                                            \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA224,         \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 28,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA256 */                                            \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA256,         \
+                               .block_size = 64,                       \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 32,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA384 */                                            \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA384,         \
+                               .block_size = 128,                      \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 48,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       },                                                              \
+       {       /* SHA512 */                                            \
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,                     \
+               {.sym = {                                               \
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,        \
+                       {.auth = {                                      \
+                               .algo = RTE_CRYPTO_AUTH_SHA512,         \
+                               .block_size = 128,                      \
+                               .key_size = {                           \
+                                       .min = 0,                       \
+                                       .max = 0,                       \
+                                       .increment = 0                  \
+                               },                                      \
+                               .digest_size = {                        \
+                                       .min = 1,                       \
+                                       .max = 64,                      \
+                                       .increment = 1                  \
+                               },                                      \
+                               .iv_size = { 0 }                        \
+                       }, }                                            \
+               }, }                                                    \
+       }                                                               \
+
+
+
 #ifdef RTE_LIB_SECURITY
 #define QAT_SECURITY_SYM_CAPABILITIES                                  \
        {       /* AES DOCSIS BPI */                                    \
index e15722a..0097ee2 100644 (file)
@@ -39,6 +39,11 @@ static const struct rte_cryptodev_capabilities qat_gen3_sym_capabilities[] = {
        RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
+static const struct rte_cryptodev_capabilities qat_gen4_sym_capabilities[] = {
+       QAT_BASE_GEN4_SYM_CAPABILITIES,
+       RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
+};
+
 #ifdef RTE_LIB_SECURITY
 static const struct rte_cryptodev_capabilities
                                        qat_security_sym_capabilities[] = {
@@ -450,8 +455,8 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
                capa_size = sizeof(qat_gen3_sym_capabilities);
                break;
        case QAT_GEN4:
-               capabilities = NULL;
-               capa_size = 0;
+               capabilities = qat_gen4_sym_capabilities;
+               capa_size = sizeof(qat_gen4_sym_capabilities);
                break;
        default:
                QAT_LOG(DEBUG,