crypto/qat: support DOCSIS BPI mode
authorFiona Trahe <fiona.trahe@intel.com>
Thu, 2 Mar 2017 13:03:09 +0000 (13:03 +0000)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Wed, 5 Apr 2017 22:17:44 +0000 (00:17 +0200)
DOCSIS BPI mode is handled in the QAT PMD by sending full blocks to the
hardware device for encryption and using OpenSSL libcrypto for pre- or
post-processing of any partial blocks.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
doc/guides/cryptodevs/features/qat.ini
doc/guides/cryptodevs/qat.rst
doc/guides/rel_notes/release_17_05.rst
drivers/crypto/qat/qat_adf/qat_algs.h
drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
drivers/crypto/qat/qat_crypto.c
test/test/test_cryptodev.c
test/test/test_cryptodev_aes_test_vectors.h
test/test/test_cryptodev_des_test_vectors.h

index a3a46eb..6e34571 100644 (file)
@@ -12,19 +12,20 @@ HW Accelerated         = Y
 ; Supported crypto algorithms of the 'qat' crypto driver.
 ;
 [Cipher]
-NULL         = Y
-AES CBC (128) = Y
-AES CBC (192) = Y
-AES CBC (256) = Y
-AES CTR (128) = Y
-AES CTR (192) = Y
-AES CTR (256) = Y
-3DES CBC      = Y
-3DES CTR      = Y
-DES CBC       = Y
-SNOW3G UEA2   = Y
-KASUMI F8     = Y
-
+NULL           = Y
+AES CBC (128)  = Y
+AES CBC (192)  = Y
+AES CBC (256)  = Y
+AES CTR (128)  = Y
+AES CTR (192)  = Y
+AES CTR (256)  = Y
+3DES CBC       = Y
+3DES CTR       = Y
+DES CBC        = Y
+SNOW3G UEA2    = Y
+KASUMI F8      = Y
+AES DOCSIS BPI = Y
+DES DOCSIS BPI = Y
 ;
 ; Supported authentication algorithms of the 'qat' crypto driver.
 ;
index 9ecd19b..e239a25 100644 (file)
@@ -55,6 +55,8 @@ Cipher algorithms:
 * ``RTE_CRYPTO_CIPHER_NULL``
 * ``RTE_CRYPTO_CIPHER_KASUMI_F8``
 * ``RTE_CRYPTO_CIPHER_DES_CBC``
+* ``RTE_CRYPTO_CIPHER_AES_DOCSISBPI``
+* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI``
 
 Hash algorithms:
 
index cd55780..08eb707 100644 (file)
@@ -245,6 +245,13 @@ New Features
     primary slave first. Then, any operation that cannot be enqueued is
     enqueued to a secondary slave.
 
+* **Updated the QAT PMD.**
+
+  The QAT PMD has been updated with additional support for:
+
+  * AES DOCSIS BPI algorithm.
+  * DES DOCSIS BPI algorithm.
+
 * **Updated the AESNI MB PMD.**
 
   The AESNI MB PMD has been updated with additional support for:
index b9e3fd6..011a88c 100644 (file)
@@ -112,6 +112,7 @@ struct qat_session {
        enum icp_qat_hw_cipher_mode qat_mode;
        enum icp_qat_hw_auth_algo qat_hash_alg;
        enum icp_qat_hw_auth_op auth_op;
+       void *bpi_ctx;
        struct qat_alg_cd cd;
        uint8_t *cd_cur_ptr;
        phys_addr_t cd_paddr;
@@ -154,8 +155,11 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd,
                                        unsigned int keylen);
 
 int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int qat_alg_validate_aes_docsisbpi_key(int key_len,
+                                       enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 int qat_alg_validate_des_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
+int qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);
 #endif
index fbeef0a..96835d9 100644 (file)
 #include <rte_crypto_sym.h>
 
 #include "../qat_logs.h"
-#include "qat_algs.h"
 
 #include <openssl/sha.h>       /* Needed to calculate pre-compute values */
 #include <openssl/aes.h>       /* Needed to calculate pre-compute values */
 #include <openssl/md5.h>       /* Needed to calculate pre-compute values */
 
+#include "qat_algs.h"
+
+/* returns block size in bytes per cipher algo */
+int qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg)
+{
+       switch (qat_cipher_alg) {
+       case ICP_QAT_HW_CIPHER_ALGO_DES:
+               return ICP_QAT_HW_DES_BLK_SZ;
+       case ICP_QAT_HW_CIPHER_ALGO_3DES:
+               return ICP_QAT_HW_3DES_BLK_SZ;
+       case ICP_QAT_HW_CIPHER_ALGO_AES128:
+       case ICP_QAT_HW_CIPHER_ALGO_AES192:
+       case ICP_QAT_HW_CIPHER_ALGO_AES256:
+               return ICP_QAT_HW_AES_BLK_SZ;
+       default:
+               PMD_DRV_LOG(ERR, "invalid block cipher alg %u", qat_cipher_alg);
+               return -EFAULT;
+       };
+       return -EFAULT;
+}
 
 /*
  * Returns size in bytes per hash algo for state1 size field in cd_ctrl
@@ -838,6 +857,19 @@ int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
        return 0;
 }
 
+int qat_alg_validate_aes_docsisbpi_key(int key_len,
+               enum icp_qat_hw_cipher_algo *alg)
+{
+       switch (key_len) {
+       case ICP_QAT_HW_AES_128_KEY_SZ:
+               *alg = ICP_QAT_HW_CIPHER_ALGO_AES128;
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
 int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 {
        switch (key_len) {
index 67cb8f8..b851926 100644 (file)
@@ -59,6 +59,8 @@
 #include <rte_string_fns.h>
 #include <rte_spinlock.h>
 #include <rte_hexdump.h>
+#include <rte_crypto_sym.h>
+#include <openssl/evp.h>
 
 #include "qat_logs.h"
 #include "qat_algs.h"
@@ -330,6 +332,26 @@ static const struct rte_cryptodev_capabilities qat_pmd_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* AES DOCSISBPI */
+               .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 = 16,
+                                       .increment = 0
+                               },
+                               .iv_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               }
+                       }, }
+               }, }
+       },
        {       /* SNOW 3G (UEA2) */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -516,9 +538,128 @@ static const struct rte_cryptodev_capabilities qat_pmd_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* DES DOCSISBPI */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                       {.cipher = {
+                               .algo = RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
+                               .block_size = 8,
+                               .key_size = {
+                                       .min = 8,
+                                       .max = 8,
+                                       .increment = 0
+                               },
+                               .iv_size = {
+                                       .min = 8,
+                                       .max = 8,
+                                       .increment = 0
+                               }
+                       }, }
+               }, }
+       },
        RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
+/** Encrypt a single partial block
+ *  Depends on openssl libcrypto
+ *  Uses ECB+XOR to do CFB encryption, same result, more performant
+ */
+static inline int
+bpi_cipher_encrypt(uint8_t *src, uint8_t *dst,
+               uint8_t *iv, int ivlen, int srclen,
+               void *bpi_ctx)
+{
+       EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
+       int encrypted_ivlen;
+       uint8_t encrypted_iv[16];
+       int i;
+
+       /* ECB method: encrypt the IV, then XOR this with plaintext */
+       if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
+                                                               <= 0)
+               goto cipher_encrypt_err;
+
+       for (i = 0; i < srclen; i++)
+               *(dst+i) = *(src+i)^(encrypted_iv[i]);
+
+       return 0;
+
+cipher_encrypt_err:
+       PMD_DRV_LOG(ERR, "libcrypto ECB cipher encrypt failed");
+       return -EINVAL;
+}
+
+/** Decrypt a single partial block
+ *  Depends on openssl libcrypto
+ *  Uses ECB+XOR to do CFB encryption, same result, more performant
+ */
+static inline int
+bpi_cipher_decrypt(uint8_t *src, uint8_t *dst,
+               uint8_t *iv, int ivlen, int srclen,
+               void *bpi_ctx)
+{
+       EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
+       int encrypted_ivlen;
+       uint8_t encrypted_iv[16];
+       int i;
+
+       /* ECB method: encrypt (not decrypt!) the IV, then XOR with plaintext */
+       if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
+                                                               <= 0)
+               goto cipher_decrypt_err;
+
+       for (i = 0; i < srclen; i++)
+               *(dst+i) = *(src+i)^(encrypted_iv[i]);
+
+       return 0;
+
+cipher_decrypt_err:
+       PMD_DRV_LOG(ERR, "libcrypto ECB cipher encrypt for BPI IV failed");
+       return -EINVAL;
+}
+
+/** Creates a context in either AES or DES in ECB mode
+ *  Depends on openssl libcrypto
+ */
+static void *
+bpi_cipher_ctx_init(enum rte_crypto_cipher_algorithm cryptodev_algo,
+               enum rte_crypto_cipher_operation direction __rte_unused,
+                                       uint8_t *key)
+{
+       const EVP_CIPHER *algo = NULL;
+       EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
+
+       if (ctx == NULL)
+               goto ctx_init_err;
+
+       if (cryptodev_algo == RTE_CRYPTO_CIPHER_DES_DOCSISBPI)
+               algo = EVP_des_ecb();
+       else
+               algo = EVP_aes_128_ecb();
+
+       /* IV will be ECB encrypted whether direction is encrypt or decrypt*/
+       if (EVP_EncryptInit_ex(ctx, algo, NULL, key, 0) != 1)
+               goto ctx_init_err;
+
+       return ctx;
+
+ctx_init_err:
+       if (ctx != NULL)
+               EVP_CIPHER_CTX_free(ctx);
+       return NULL;
+}
+
+/** Frees a context previously created
+ *  Depends on openssl libcrypto
+ */
+static void
+bpi_cipher_ctx_free(void *bpi_ctx)
+{
+       if (bpi_ctx != NULL)
+               EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)bpi_ctx);
+}
+
 static inline uint32_t
 adf_modulo(uint32_t data, uint32_t shift);
 
@@ -533,7 +674,11 @@ void qat_crypto_sym_clear_session(struct rte_cryptodev *dev,
        phys_addr_t cd_paddr;
 
        PMD_INIT_FUNC_TRACE();
-       if (session) {
+       if (sess) {
+               if (sess->bpi_ctx) {
+                       bpi_cipher_ctx_free(sess->bpi_ctx);
+                       sess->bpi_ctx = NULL;
+               }
                cd_paddr = sess->cd_paddr;
                memset(sess, 0, qat_crypto_sym_get_session_private_size(dev));
                sess->cd_paddr = cd_paddr;
@@ -674,6 +819,38 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
                }
                session->qat_mode = ICP_QAT_HW_CIPHER_CTR_MODE;
                break;
+       case RTE_CRYPTO_CIPHER_DES_DOCSISBPI:
+               session->bpi_ctx = bpi_cipher_ctx_init(
+                                       cipher_xform->algo,
+                                       cipher_xform->op,
+                                       cipher_xform->key.data);
+               if (session->bpi_ctx == NULL) {
+                       PMD_DRV_LOG(ERR, "failed to create DES BPI ctx");
+                       goto error_out;
+               }
+               if (qat_alg_validate_des_key(cipher_xform->key.length,
+                               &session->qat_cipher_alg) != 0) {
+                       PMD_DRV_LOG(ERR, "Invalid DES cipher key size");
+                       goto error_out;
+               }
+               session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
+               break;
+       case RTE_CRYPTO_CIPHER_AES_DOCSISBPI:
+               session->bpi_ctx = bpi_cipher_ctx_init(
+                                       cipher_xform->algo,
+                                       cipher_xform->op,
+                                       cipher_xform->key.data);
+               if (session->bpi_ctx == NULL) {
+                       PMD_DRV_LOG(ERR, "failed to create AES BPI ctx");
+                       goto error_out;
+               }
+               if (qat_alg_validate_aes_docsisbpi_key(cipher_xform->key.length,
+                               &session->qat_cipher_alg) != 0) {
+                       PMD_DRV_LOG(ERR, "Invalid AES DOCSISBPI key size");
+                       goto error_out;
+               }
+               session->qat_mode = ICP_QAT_HW_CIPHER_CBC_MODE;
+               break;
        case RTE_CRYPTO_CIPHER_3DES_ECB:
        case RTE_CRYPTO_CIPHER_AES_ECB:
        case RTE_CRYPTO_CIPHER_AES_CCM:
@@ -703,6 +880,10 @@ qat_crypto_sym_configure_session_cipher(struct rte_cryptodev *dev,
        return session;
 
 error_out:
+       if (session->bpi_ctx) {
+               bpi_cipher_ctx_free(session->bpi_ctx);
+               session->bpi_ctx = NULL;
+       }
        rte_mempool_put(internals->sess_mp, session);
        return NULL;
 }
@@ -717,7 +898,6 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
        struct qat_session *session = session_private;
 
        int qat_cmd_id;
-
        PMD_INIT_FUNC_TRACE();
 
        /* Get requested QAT command id */
@@ -759,6 +939,7 @@ qat_crypto_sym_configure_session(struct rte_cryptodev *dev,
                session->qat_cmd);
                goto error_out;
        }
+
        return session;
 
 error_out:
@@ -868,6 +1049,113 @@ unsigned qat_crypto_sym_get_session_private_size(
        return RTE_ALIGN_CEIL(sizeof(struct qat_session), 8);
 }
 
+static inline uint32_t
+qat_bpicipher_preprocess(struct qat_session *ctx,
+                               struct rte_crypto_op *op)
+{
+       uint8_t block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
+       struct rte_crypto_sym_op *sym_op = op->sym;
+       uint8_t last_block_len = sym_op->cipher.data.length % block_len;
+
+       if (last_block_len &&
+                       ctx->qat_dir == ICP_QAT_HW_CIPHER_DECRYPT) {
+
+               /* Decrypt last block */
+               uint8_t *last_block, *dst, *iv;
+               uint32_t last_block_offset = sym_op->cipher.data.offset +
+                               sym_op->cipher.data.length - last_block_len;
+               last_block = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_src,
+                               uint8_t *, last_block_offset);
+
+               if (unlikely(sym_op->m_dst != NULL))
+                       /* out-of-place operation (OOP) */
+                       dst = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_dst,
+                                               uint8_t *, last_block_offset);
+               else
+                       dst = last_block;
+
+               if (last_block_len < sym_op->cipher.data.length)
+                       /* use previous block ciphertext as IV */
+                       iv = last_block - block_len;
+               else
+                       /* runt block, i.e. less than one full block */
+                       iv = sym_op->cipher.iv.data;
+
+#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX
+               rte_hexdump(stdout, "BPI: src before pre-process:", last_block,
+                       last_block_len);
+               if (sym_op->m_dst != NULL)
+                       rte_hexdump(stdout, "BPI: dst before pre-process:", dst,
+                               last_block_len);
+#endif
+               bpi_cipher_decrypt(last_block, dst, iv, block_len,
+                               last_block_len, ctx->bpi_ctx);
+#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX
+               rte_hexdump(stdout, "BPI: src after pre-process:", last_block,
+                       last_block_len);
+               if (sym_op->m_dst != NULL)
+                       rte_hexdump(stdout, "BPI: dst after pre-process:", dst,
+                               last_block_len);
+#endif
+       }
+
+       return sym_op->cipher.data.length - last_block_len;
+}
+
+static inline uint32_t
+qat_bpicipher_postprocess(struct qat_session *ctx,
+                               struct rte_crypto_op *op)
+{
+       uint8_t block_len = qat_cipher_get_block_size(ctx->qat_cipher_alg);
+       struct rte_crypto_sym_op *sym_op = op->sym;
+       uint8_t last_block_len = sym_op->cipher.data.length % block_len;
+
+       if (last_block_len > 0 &&
+                       ctx->qat_dir == ICP_QAT_HW_CIPHER_ENCRYPT) {
+
+               /* Encrypt last block */
+               uint8_t *last_block, *dst, *iv;
+               uint32_t last_block_offset;
+
+               last_block_offset = sym_op->cipher.data.offset +
+                               sym_op->cipher.data.length - last_block_len;
+               last_block = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_src,
+                               uint8_t *, last_block_offset);
+
+               if (unlikely(sym_op->m_dst != NULL))
+                       /* out-of-place operation (OOP) */
+                       dst = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_dst,
+                                               uint8_t *, last_block_offset);
+               else
+                       dst = last_block;
+
+               if (last_block_len < sym_op->cipher.data.length)
+                       /* use previous block ciphertext as IV */
+                       iv = dst - block_len;
+               else
+                       /* runt block, i.e. less than one full block */
+                       iv = sym_op->cipher.iv.data;
+
+#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_RX
+               rte_hexdump(stdout, "BPI: src before post-process:", last_block,
+                       last_block_len);
+               if (sym_op->m_dst != NULL)
+                       rte_hexdump(stdout, "BPI: dst before post-process:",
+                                       dst, last_block_len);
+#endif
+               bpi_cipher_encrypt(last_block, dst, iv, block_len,
+                               last_block_len, ctx->bpi_ctx);
+#ifdef RTE_LIBRTE_PMD_QAT_DEBUG_RX
+               rte_hexdump(stdout, "BPI: src after post-process:", last_block,
+                       last_block_len);
+               if (sym_op->m_dst != NULL)
+                       rte_hexdump(stdout, "BPI: dst after post-process:", dst,
+                               last_block_len);
+#endif
+       }
+       return sym_op->cipher.data.length - last_block_len;
+}
+
 uint16_t
 qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops,
                uint16_t nb_ops)
@@ -956,8 +1244,13 @@ qat_pmd_dequeue_op_burst(void *qp, struct rte_crypto_op **ops,
                                        resp_msg->comn_hdr.comn_status)) {
                        rx_op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
                } else {
+                       struct qat_session *sess = (struct qat_session *)
+                                               (rx_op->sym->session->_private);
+                       if (sess->bpi_ctx)
+                               qat_bpicipher_postprocess(sess, rx_op);
                        rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
                }
+
                *(uint32_t *)resp_msg = ADF_RING_EMPTY_SIG;
                queue->head = adf_modulo(queue->head +
                                queue->msg_size,
@@ -1099,6 +1392,14 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
                        cipher_len = op->sym->cipher.data.length >> 3;
                        cipher_ofs = op->sym->cipher.data.offset >> 3;
 
+               } else if (ctx->bpi_ctx) {
+                       /* DOCSIS - only send complete blocks to device
+                        * Process any partial block using CFB mode.
+                        * Even if 0 complete blocks, still send this to device
+                        * to get into rx queue for post-process and dequeuing
+                        */
+                       cipher_len = qat_bpicipher_preprocess(ctx, op);
+                       cipher_ofs = op->sym->cipher.data.offset;
                } else {
                        cipher_len = op->sym->cipher.data.length;
                        cipher_ofs = op->sym->cipher.data.offset;
index a7218f4..a8f3ae5 100644 (file)
@@ -1547,6 +1547,38 @@ test_AES_docsis_mb_all(void)
        return TEST_SUCCESS;
 }
 
+static int
+test_AES_docsis_qat_all(void)
+{
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       int status;
+
+       status = test_blockcipher_all_tests(ts_params->mbuf_pool,
+               ts_params->op_mpool, ts_params->valid_devs[0],
+               RTE_CRYPTODEV_QAT_SYM_PMD,
+               BLKCIPHER_AES_DOCSIS_TYPE);
+
+       TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+       return TEST_SUCCESS;
+}
+
+static int
+test_DES_docsis_qat_all(void)
+{
+       struct crypto_testsuite_params *ts_params = &testsuite_params;
+       int status;
+
+       status = test_blockcipher_all_tests(ts_params->mbuf_pool,
+               ts_params->op_mpool, ts_params->valid_devs[0],
+               RTE_CRYPTODEV_QAT_SYM_PMD,
+               BLKCIPHER_DES_DOCSIS_TYPE);
+
+       TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+       return TEST_SUCCESS;
+}
+
 static int
 test_authonly_mb_all(void)
 {
@@ -7548,6 +7580,10 @@ static struct unit_test_suite cryptodev_qat_testsuite  = {
                                                test_3DES_cipheronly_qat_all),
                TEST_CASE_ST(ut_setup, ut_teardown,
                                                test_DES_cipheronly_qat_all),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                                               test_AES_docsis_qat_all),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                                               test_DES_docsis_qat_all),
                TEST_CASE_ST(ut_setup, ut_teardown, test_stats),
 
                /** AES GCM Authenticated Encryption */
index aacabab..992705e 100644 (file)
@@ -1439,37 +1439,43 @@ static const struct blockcipher_test_case aes_docsis_test_cases[] = {
                .test_descr = "AES-DOCSIS-BPI Full Block Encryption",
                .test_data = &aes_test_data_docsis_1,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "AES-DOCSIS-BPI Runt Block Encryption",
                .test_data = &aes_test_data_docsis_2,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "AES-DOCSIS-BPI Uneven Encryption",
                .test_data = &aes_test_data_docsis_3,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "AES-DOCSIS-BPI Full Block Decryption",
                .test_data = &aes_test_data_docsis_1,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "AES-DOCSIS-BPI Runt Block Decryption",
                .test_data = &aes_test_data_docsis_2,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "AES-DOCSIS-BPI Uneven Decryption",
                .test_data = &aes_test_data_docsis_3,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        }
 };
 #endif /* TEST_CRYPTODEV_AES_TEST_VECTORS_H_ */
index b29a49e..06dcf5e 100644 (file)
@@ -964,37 +964,43 @@ static const struct blockcipher_test_case des_docsis_test_cases[] = {
                .test_descr = "DES-DOCSIS-BPI Full Block Encryption",
                .test_data = &des_test_data_1,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "DES-DOCSIS-BPI Runt Block Encryption",
                .test_data = &des_test_data_2,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "DES-DOCSIS-BPI Uneven Encryption",
                .test_data = &des_test_data_3,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "DES-DOCSIS-BPI Full Block Decryption",
                .test_data = &des_test_data_1,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "DES-DOCSIS-BPI Runt Block Decryption",
                .test_data = &des_test_data_2,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        },
        {
                .test_descr = "DES-DOCSIS-BPI Uneven Decryption",
                .test_data = &des_test_data_3,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
-               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL
+               .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
        }
 
 };