crypto/dpaa2_sec: support AES-GCM and CTR
authorAkhil Goyal <akhil.goyal@nxp.com>
Mon, 3 Jul 2017 12:31:39 +0000 (18:01 +0530)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 6 Jul 2017 20:26:50 +0000 (22:26 +0200)
AES-GCM support is added as per the AEAD type of crypto
operations. Support for AES-CTR is also added.

test/crypto and documentation is also updated for
dpaa2_sec to add supported algorithms.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
doc/guides/cryptodevs/dpaa2_sec.rst
doc/guides/cryptodevs/features/dpaa2_sec.ini
doc/guides/rel_notes/release_17_08.rst
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
test/test/test_cryptodev.c
test/test/test_cryptodev_aes_test_vectors.h
test/test/test_cryptodev_blockcipher.c
test/test/test_cryptodev_des_test_vectors.h
test/test/test_cryptodev_hash_test_vectors.h

index becb910..1444a91 100644 (file)
@@ -126,7 +126,7 @@ fits in the DPAA2 Bus model
 Features
 --------
 
-The DPAA2 PMD has support for:
+The DPAA2_SEC PMD has support for:
 
 Cipher algorithms:
 
@@ -134,6 +134,9 @@ Cipher algorithms:
 * ``RTE_CRYPTO_CIPHER_AES128_CBC``
 * ``RTE_CRYPTO_CIPHER_AES192_CBC``
 * ``RTE_CRYPTO_CIPHER_AES256_CBC``
+* ``RTE_CRYPTO_CIPHER_AES128_CTR``
+* ``RTE_CRYPTO_CIPHER_AES192_CTR``
+* ``RTE_CRYPTO_CIPHER_AES256_CTR``
 
 Hash algorithms:
 
@@ -144,6 +147,10 @@ Hash algorithms:
 * ``RTE_CRYPTO_AUTH_SHA512_HMAC``
 * ``RTE_CRYPTO_AUTH_MD5_HMAC``
 
+AEAD algorithms:
+
+* ``RTE_CRYPTO_AEAD_AES_GCM``
+
 Supported DPAA2 SoCs
 --------------------
 
index db0ea4f..c3bb3dd 100644 (file)
@@ -15,6 +15,9 @@ HW Accelerated         = 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
 
 ;
@@ -29,6 +32,9 @@ SHA384 HMAC  = Y
 SHA512 HMAC  = Y
 
 ;
-; Supported AEAD algorithms of the 'openssl' crypto driver.
+; Supported AEAD algorithms of the 'dpaa2_sec' crypto driver.
 ;
 [AEAD]
+AES GCM (128) = Y
+AES GCM (192) = Y
+AES GCM (256) = Y
index d689af7..4fc92c5 100644 (file)
@@ -114,6 +114,10 @@ New Features
     necessary to use a combination of cipher and authentication
     structures anymore.
 
+* **Updated dpaa2_sec crypto PMD.**
+
+  Added support for AES-GCM and AES-CTR
+
 
 Resolved Issues
 ---------------
index dbdaf46..b1eede9 100644 (file)
 #define FSL_MC_DPSECI_DEVID     3
 
 #define NO_PREFETCH 0
-#define TDES_CBC_IV_LEN 8
-#define AES_CBC_IV_LEN 16
-#define AES_CTR_IV_LEN 16
-#define AES_GCM_IV_LEN 12
 /* FLE_POOL_NUM_BUFS is set as per the ipsec-secgw application */
 #define FLE_POOL_NUM_BUFS      32000
 #define FLE_POOL_BUF_SIZE      256
 
 enum rta_sec_era rta_sec_era = RTA_SEC_ERA_8;
 
+static inline int
+build_authenc_gcm_fd(dpaa2_sec_session *sess,
+                    struct rte_crypto_op *op,
+                    struct qbman_fd *fd, uint16_t bpid)
+{
+       struct rte_crypto_sym_op *sym_op = op->sym;
+       struct ctxt_priv *priv = sess->ctxt;
+       struct qbman_fle *fle, *sge;
+       struct sec_flow_context *flc;
+       uint32_t auth_only_len = sess->ext_params.aead_ctxt.auth_only_len;
+       int icv_len = sess->digest_length, retval;
+       uint8_t *old_icv;
+       uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
+                       sess->iv.offset);
+
+       PMD_INIT_FUNC_TRACE();
+
+       /* TODO we are using the first FLE entry to store Mbuf and session ctxt.
+        * Currently we donot know which FLE has the mbuf stored.
+        * So while retreiving we can go back 1 FLE from the FD -ADDR
+        * to get the MBUF Addr from the previous FLE.
+        * We can have a better approach to use the inline Mbuf
+        */
+       retval = rte_mempool_get(priv->fle_pool, (void **)(&fle));
+       if (retval) {
+               RTE_LOG(ERR, PMD, "Memory alloc failed for SGE\n");
+               return -1;
+       }
+       memset(fle, 0, FLE_POOL_BUF_SIZE);
+       DPAA2_SET_FLE_ADDR(fle, DPAA2_OP_VADDR_TO_IOVA(op));
+       DPAA2_FLE_SAVE_CTXT(fle, priv);
+       fle = fle + 1;
+       sge = fle + 2;
+       if (likely(bpid < MAX_BPID)) {
+               DPAA2_SET_FD_BPID(fd, bpid);
+               DPAA2_SET_FLE_BPID(fle, bpid);
+               DPAA2_SET_FLE_BPID(fle + 1, bpid);
+               DPAA2_SET_FLE_BPID(sge, bpid);
+               DPAA2_SET_FLE_BPID(sge + 1, bpid);
+               DPAA2_SET_FLE_BPID(sge + 2, bpid);
+               DPAA2_SET_FLE_BPID(sge + 3, bpid);
+       } else {
+               DPAA2_SET_FD_IVP(fd);
+               DPAA2_SET_FLE_IVP(fle);
+               DPAA2_SET_FLE_IVP((fle + 1));
+               DPAA2_SET_FLE_IVP(sge);
+               DPAA2_SET_FLE_IVP((sge + 1));
+               DPAA2_SET_FLE_IVP((sge + 2));
+               DPAA2_SET_FLE_IVP((sge + 3));
+       }
+
+       /* Save the shared descriptor */
+       flc = &priv->flc_desc[0].flc;
+       /* Configure FD as a FRAME LIST */
+       DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(fle));
+       DPAA2_SET_FD_COMPOUND_FMT(fd);
+       DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
+
+       PMD_TX_LOG(DEBUG, "auth_off: 0x%x/length %d, digest-len=%d\n"
+                  "iv-len=%d data_off: 0x%x\n",
+                  sym_op->aead.data.offset,
+                  sym_op->aead.data.length,
+                  sym_op->aead.digest.length,
+                  sess->iv.length,
+                  sym_op->m_src->data_off);
+
+       /* Configure Output FLE with Scatter/Gather Entry */
+       DPAA2_SET_FLE_ADDR(fle, DPAA2_VADDR_TO_IOVA(sge));
+       if (auth_only_len)
+               DPAA2_SET_FLE_INTERNAL_JD(fle, auth_only_len);
+       fle->length = (sess->dir == DIR_ENC) ?
+                       (sym_op->aead.data.length + icv_len + auth_only_len) :
+                       sym_op->aead.data.length + auth_only_len;
+
+       DPAA2_SET_FLE_SG_EXT(fle);
+
+       /* Configure Output SGE for Encap/Decap */
+       DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(sym_op->m_src));
+       DPAA2_SET_FLE_OFFSET(sge, sym_op->aead.data.offset +
+                               sym_op->m_src->data_off - auth_only_len);
+       sge->length = sym_op->aead.data.length + auth_only_len;
+
+       if (sess->dir == DIR_ENC) {
+               sge++;
+               DPAA2_SET_FLE_ADDR(sge,
+                               DPAA2_VADDR_TO_IOVA(sym_op->aead.digest.data));
+               sge->length = sess->digest_length;
+               DPAA2_SET_FD_LEN(fd, (sym_op->aead.data.length +
+                                       sess->iv.length + auth_only_len));
+       }
+       DPAA2_SET_FLE_FIN(sge);
+
+       sge++;
+       fle++;
+
+       /* Configure Input FLE with Scatter/Gather Entry */
+       DPAA2_SET_FLE_ADDR(fle, DPAA2_VADDR_TO_IOVA(sge));
+       DPAA2_SET_FLE_SG_EXT(fle);
+       DPAA2_SET_FLE_FIN(fle);
+       fle->length = (sess->dir == DIR_ENC) ?
+               (sym_op->aead.data.length + sess->iv.length + auth_only_len) :
+               (sym_op->aead.data.length + sess->iv.length + auth_only_len +
+                sess->digest_length);
+
+       /* Configure Input SGE for Encap/Decap */
+       DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(IV_ptr));
+       sge->length = sess->iv.length;
+       sge++;
+       if (auth_only_len) {
+               DPAA2_SET_FLE_ADDR(sge,
+                               DPAA2_VADDR_TO_IOVA(sym_op->aead.aad.data));
+               sge->length = auth_only_len;
+               DPAA2_SET_FLE_BPID(sge, bpid);
+               sge++;
+       }
+
+       DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(sym_op->m_src));
+       DPAA2_SET_FLE_OFFSET(sge, sym_op->aead.data.offset +
+                               sym_op->m_src->data_off);
+       sge->length = sym_op->aead.data.length;
+       if (sess->dir == DIR_DEC) {
+               sge++;
+               old_icv = (uint8_t *)(sge + 1);
+               memcpy(old_icv, sym_op->aead.digest.data,
+                      sess->digest_length);
+               memset(sym_op->aead.digest.data, 0, sess->digest_length);
+               DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(old_icv));
+               sge->length = sess->digest_length;
+               DPAA2_SET_FD_LEN(fd, (sym_op->aead.data.length +
+                                sess->digest_length +
+                                sess->iv.length +
+                                auth_only_len));
+       }
+       DPAA2_SET_FLE_FIN(sge);
+
+       if (auth_only_len) {
+               DPAA2_SET_FLE_INTERNAL_JD(fle, auth_only_len);
+               DPAA2_SET_FD_INTERNAL_JD(fd, auth_only_len);
+       }
+
+       return 0;
+}
+
 static inline int
 build_authenc_fd(dpaa2_sec_session *sess,
                 struct rte_crypto_op *op,
@@ -418,6 +557,9 @@ build_sec_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op,
        case DPAA2_SEC_AUTH:
                ret = build_auth_fd(sess, op, fd, bpid);
                break;
+       case DPAA2_SEC_AEAD:
+               ret = build_authenc_gcm_fd(sess, op, fd, bpid);
+               break;
        case DPAA2_SEC_CIPHER_HASH:
                ret = build_authenc_fd(sess, op, fd, bpid);
                break;
@@ -773,7 +915,6 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
                      struct rte_crypto_sym_xform *xform,
                      dpaa2_sec_session *session)
 {
-       struct dpaa2_sec_cipher_ctxt *ctxt = &session->ext_params.cipher_ctxt;
        struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
        struct alginfo cipherdata;
        int bufsize, i;
@@ -820,15 +961,17 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
                cipherdata.algtype = OP_ALG_ALGSEL_AES;
                cipherdata.algmode = OP_ALG_AAI_CBC;
                session->cipher_alg = RTE_CRYPTO_CIPHER_AES_CBC;
-               ctxt->iv.length = AES_CBC_IV_LEN;
                break;
        case RTE_CRYPTO_CIPHER_3DES_CBC:
                cipherdata.algtype = OP_ALG_ALGSEL_3DES;
                cipherdata.algmode = OP_ALG_AAI_CBC;
                session->cipher_alg = RTE_CRYPTO_CIPHER_3DES_CBC;
-               ctxt->iv.length = TDES_CBC_IV_LEN;
                break;
        case RTE_CRYPTO_CIPHER_AES_CTR:
+               cipherdata.algtype = OP_ALG_ALGSEL_AES;
+               cipherdata.algmode = OP_ALG_AAI_CTR;
+               session->cipher_alg = RTE_CRYPTO_CIPHER_AES_CTR;
+               break;
        case RTE_CRYPTO_CIPHER_3DES_CTR:
        case RTE_CRYPTO_CIPHER_AES_ECB:
        case RTE_CRYPTO_CIPHER_3DES_ECB:
@@ -851,8 +994,8 @@ dpaa2_sec_cipher_init(struct rte_cryptodev *dev,
                                DIR_ENC : DIR_DEC;
 
        bufsize = cnstr_shdsc_blkcipher(priv->flc_desc[0].desc, 1, 0,
-                                       &cipherdata, NULL, ctxt->iv.length,
-                       session->dir);
+                                       &cipherdata, NULL, session->iv.length,
+                                       session->dir);
        if (bufsize < 0) {
                RTE_LOG(ERR, PMD, "Crypto: Descriptor build failed\n");
                goto error_out;
@@ -887,7 +1030,6 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
                    struct rte_crypto_sym_xform *xform,
                    dpaa2_sec_session *session)
 {
-       struct dpaa2_sec_auth_ctxt *ctxt = &session->ext_params.auth_ctxt;
        struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
        struct alginfo authdata;
        unsigned int bufsize, i;
@@ -985,7 +1127,7 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
 
        bufsize = cnstr_shdsc_hmac(priv->flc_desc[DESC_INITFINAL].desc,
                                   1, 0, &authdata, !session->dir,
-                                  ctxt->trunc_len);
+                                  session->digest_length);
 
        flc->word1_sdl = (uint8_t)bufsize;
        flc->word2_rflc_31_0 = lower_32_bits(
@@ -997,7 +1139,8 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev,
        session->ctxt = priv;
        for (i = 0; i < bufsize; i++)
                PMD_DRV_LOG(DEBUG, "DESC[%d]:0x%x\n",
-                           i, priv->flc_desc[0].desc[i]);
+                           i, priv->flc_desc[DESC_INITFINAL].desc[i]);
+
 
        return 0;
 
@@ -1011,6 +1154,126 @@ static int
 dpaa2_sec_aead_init(struct rte_cryptodev *dev,
                    struct rte_crypto_sym_xform *xform,
                    dpaa2_sec_session *session)
+{
+       struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt;
+       struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
+       struct alginfo aeaddata;
+       unsigned int bufsize, i;
+       struct ctxt_priv *priv;
+       struct sec_flow_context *flc;
+       struct rte_crypto_aead_xform *aead_xform = &xform->aead;
+       int err;
+
+       PMD_INIT_FUNC_TRACE();
+
+       /* Set IV parameters */
+       session->iv.offset = aead_xform->iv.offset;
+       session->iv.length = aead_xform->iv.length;
+       session->ctxt_type = DPAA2_SEC_AEAD;
+
+       /* For SEC AEAD only one descriptor is required */
+       priv = (struct ctxt_priv *)rte_zmalloc(NULL,
+                       sizeof(struct ctxt_priv) + sizeof(struct sec_flc_desc),
+                       RTE_CACHE_LINE_SIZE);
+       if (priv == NULL) {
+               RTE_LOG(ERR, PMD, "No Memory for priv CTXT");
+               return -1;
+       }
+
+       priv->fle_pool = dev_priv->fle_pool;
+       flc = &priv->flc_desc[0].flc;
+
+       session->aead_key.data = rte_zmalloc(NULL, aead_xform->key.length,
+                                              RTE_CACHE_LINE_SIZE);
+       if (session->aead_key.data == NULL && aead_xform->key.length > 0) {
+               RTE_LOG(ERR, PMD, "No Memory for aead key");
+               rte_free(priv);
+               return -1;
+       }
+       memcpy(session->aead_key.data, aead_xform->key.data,
+              aead_xform->key.length);
+
+       session->digest_length = aead_xform->digest_length;
+       session->aead_key.length = aead_xform->key.length;
+       ctxt->auth_only_len = aead_xform->add_auth_data_length;
+
+       aeaddata.key = (uint64_t)session->aead_key.data;
+       aeaddata.keylen = session->aead_key.length;
+       aeaddata.key_enc_flags = 0;
+       aeaddata.key_type = RTA_DATA_IMM;
+
+       switch (aead_xform->algo) {
+       case RTE_CRYPTO_AEAD_AES_GCM:
+               aeaddata.algtype = OP_ALG_ALGSEL_AES;
+               aeaddata.algmode = OP_ALG_AAI_GCM;
+               session->cipher_alg = RTE_CRYPTO_AEAD_AES_GCM;
+               break;
+       case RTE_CRYPTO_AEAD_AES_CCM:
+               RTE_LOG(ERR, PMD, "Crypto: Unsupported AEAD alg %u",
+                       aead_xform->algo);
+               goto error_out;
+       default:
+               RTE_LOG(ERR, PMD, "Crypto: Undefined AEAD specified %u\n",
+                       aead_xform->algo);
+               goto error_out;
+       }
+       session->dir = (aead_xform->op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ?
+                               DIR_ENC : DIR_DEC;
+
+       priv->flc_desc[0].desc[0] = aeaddata.keylen;
+       err = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,
+                              MIN_JOB_DESC_SIZE,
+                              (unsigned int *)priv->flc_desc[0].desc,
+                              &priv->flc_desc[0].desc[1], 1);
+
+       if (err < 0) {
+               PMD_DRV_LOG(ERR, "Crypto: Incorrect key lengths");
+               goto error_out;
+       }
+       if (priv->flc_desc[0].desc[1] & 1) {
+               aeaddata.key_type = RTA_DATA_IMM;
+       } else {
+               aeaddata.key = DPAA2_VADDR_TO_IOVA(aeaddata.key);
+               aeaddata.key_type = RTA_DATA_PTR;
+       }
+       priv->flc_desc[0].desc[0] = 0;
+       priv->flc_desc[0].desc[1] = 0;
+
+       if (session->dir == DIR_ENC)
+               bufsize = cnstr_shdsc_gcm_encap(
+                               priv->flc_desc[0].desc, 1, 0,
+                               &aeaddata, session->iv.length,
+                               session->digest_length);
+       else
+               bufsize = cnstr_shdsc_gcm_decap(
+                               priv->flc_desc[0].desc, 1, 0,
+                               &aeaddata, session->iv.length,
+                               session->digest_length);
+       flc->word1_sdl = (uint8_t)bufsize;
+       flc->word2_rflc_31_0 = lower_32_bits(
+                       (uint64_t)&(((struct dpaa2_sec_qp *)
+                       dev->data->queue_pairs[0])->rx_vq));
+       flc->word3_rflc_63_32 = upper_32_bits(
+                       (uint64_t)&(((struct dpaa2_sec_qp *)
+                       dev->data->queue_pairs[0])->rx_vq));
+       session->ctxt = priv;
+       for (i = 0; i < bufsize; i++)
+               PMD_DRV_LOG(DEBUG, "DESC[%d]:0x%x\n",
+                           i, priv->flc_desc[0].desc[i]);
+
+       return 0;
+
+error_out:
+       rte_free(session->aead_key.data);
+       rte_free(priv);
+       return -1;
+}
+
+
+static int
+dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev,
+                   struct rte_crypto_sym_xform *xform,
+                   dpaa2_sec_session *session)
 {
        struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt;
        struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private;
@@ -1076,7 +1339,6 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
        memcpy(session->auth_key.data, auth_xform->key.data,
               auth_xform->key.length);
 
-       ctxt->trunc_len = auth_xform->digest_length;
        authdata.key = (uint64_t)session->auth_key.data;
        authdata.keylen = session->auth_key.length;
        authdata.key_enc_flags = 0;
@@ -1147,19 +1409,21 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
                cipherdata.algtype = OP_ALG_ALGSEL_AES;
                cipherdata.algmode = OP_ALG_AAI_CBC;
                session->cipher_alg = RTE_CRYPTO_CIPHER_AES_CBC;
-               ctxt->iv.length = AES_CBC_IV_LEN;
                break;
        case RTE_CRYPTO_CIPHER_3DES_CBC:
                cipherdata.algtype = OP_ALG_ALGSEL_3DES;
                cipherdata.algmode = OP_ALG_AAI_CBC;
                session->cipher_alg = RTE_CRYPTO_CIPHER_3DES_CBC;
-               ctxt->iv.length = TDES_CBC_IV_LEN;
+               break;
+       case RTE_CRYPTO_CIPHER_AES_CTR:
+               cipherdata.algtype = OP_ALG_ALGSEL_AES;
+               cipherdata.algmode = OP_ALG_AAI_CTR;
+               session->cipher_alg = RTE_CRYPTO_CIPHER_AES_CTR;
                break;
        case RTE_CRYPTO_CIPHER_SNOW3G_UEA2:
        case RTE_CRYPTO_CIPHER_NULL:
        case RTE_CRYPTO_CIPHER_3DES_ECB:
        case RTE_CRYPTO_CIPHER_AES_ECB:
-       case RTE_CRYPTO_CIPHER_AES_CTR:
        case RTE_CRYPTO_CIPHER_KASUMI_F8:
                RTE_LOG(ERR, PMD, "Crypto: Unsupported Cipher alg %u",
                        cipher_xform->algo);
@@ -1202,9 +1466,9 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
        if (session->ctxt_type == DPAA2_SEC_CIPHER_HASH) {
                bufsize = cnstr_shdsc_authenc(priv->flc_desc[0].desc, 1,
                                              0, &cipherdata, &authdata,
-                                             ctxt->iv.length,
+                                             session->iv.length,
                                              ctxt->auth_only_len,
-                                             ctxt->trunc_len,
+                                             session->digest_length,
                                              session->dir);
        } else {
                RTE_LOG(ERR, PMD, "Hash before cipher not supported");
@@ -1221,8 +1485,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev,
        session->ctxt = priv;
        for (i = 0; i < bufsize; i++)
                PMD_DRV_LOG(DEBUG, "DESC[%d]:0x%x\n",
-                           i, priv->flc_desc[DESC_INITFINAL].desc[i]);
-
+                           i, priv->flc_desc[0].desc[i]);
 
        return 0;
 
@@ -1264,13 +1527,19 @@ dpaa2_sec_session_configure(struct rte_cryptodev *dev,
        } else if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER &&
                   xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
                session->ext_params.aead_ctxt.auth_cipher_text = true;
-               dpaa2_sec_aead_init(dev, xform, session);
+               dpaa2_sec_aead_chain_init(dev, xform, session);
 
        /* Authenticate then Cipher */
        } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH &&
                   xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
                session->ext_params.aead_ctxt.auth_cipher_text = false;
+               dpaa2_sec_aead_chain_init(dev, xform, session);
+
+       /* AEAD operation for AES-GCM kind of Algorithms */
+       } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD &&
+                  xform->next == NULL) {
                dpaa2_sec_aead_init(dev, xform, session);
+
        } else {
                RTE_LOG(ERR, PMD, "Invalid crypto type");
                return NULL;
@@ -1300,7 +1569,7 @@ dpaa2_sec_dev_configure(struct rte_cryptodev *dev __rte_unused,
 {
        PMD_INIT_FUNC_TRACE();
 
-       return -ENOTSUP;
+       return 0;
 }
 
 static int
@@ -1626,7 +1895,7 @@ init_error:
 }
 
 static int
-cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
+cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv,
                          struct rte_dpaa2_device *dpaa2_dev)
 {
        struct rte_cryptodev *cryptodev;
@@ -1654,6 +1923,7 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 
        dpaa2_dev->cryptodev = cryptodev;
        cryptodev->device = &dpaa2_dev->device;
+       cryptodev->device->driver = &dpaa2_drv->driver;
 
        /* init user callbacks */
        TAILQ_INIT(&(cryptodev->link_intr_cbs));
index b4dfe24..a477404 100644 (file)
@@ -137,6 +137,7 @@ enum dpaa2_sec_op_type {
        DPAA2_SEC_NONE,  /*!< No Cipher operations*/
        DPAA2_SEC_CIPHER,/*!< CIPHER operations */
        DPAA2_SEC_AUTH,  /*!< Authentication Operations */
+       DPAA2_SEC_AEAD,  /*!< AEAD (AES-GCM/CCM) type operations */
        DPAA2_SEC_CIPHER_HASH,  /*!< Authenticated Encryption with
                                 * associated data
                                 */
@@ -149,30 +150,9 @@ enum dpaa2_sec_op_type {
        DPAA2_SEC_MAX
 };
 
-struct dpaa2_sec_cipher_ctxt {
-       struct {
-               uint8_t *data;
-               uint16_t length;
-       } iv;   /**< Initialisation vector parameters */
-       uint8_t *init_counter;  /*!< Set initial counter for CTR mode */
-};
-
-struct dpaa2_sec_auth_ctxt {
-       uint8_t trunc_len;              /*!< Length for output ICV, should
-                                        * be 0 if no truncation required
-                                        */
-};
-
 struct dpaa2_sec_aead_ctxt {
-       struct {
-               uint8_t *data;
-               uint16_t length;
-       } iv;   /**< Initialisation vector parameters */
        uint16_t auth_only_len; /*!< Length of data for Auth only */
        uint8_t auth_cipher_text;       /**< Authenticate/cipher ordering */
-       uint8_t trunc_len;              /*!< Length for output ICV, should
-                                        * be 0 if no truncation required
-                                        */
 };
 
 typedef struct dpaa2_sec_session_entry {
@@ -181,14 +161,22 @@ typedef struct dpaa2_sec_session_entry {
        uint8_t dir;         /*!< Operation Direction */
        enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
        enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/
-       struct {
-               uint8_t *data;  /**< pointer to key data */
-               size_t length;  /**< key length in bytes */
-       } cipher_key;
-       struct {
-               uint8_t *data;  /**< pointer to key data */
-               size_t length;  /**< key length in bytes */
-       } auth_key;
+       union {
+               struct {
+                       uint8_t *data;  /**< pointer to key data */
+                       size_t length;  /**< key length in bytes */
+               } aead_key;
+               struct {
+                       struct {
+                               uint8_t *data;  /**< pointer to key data */
+                               size_t length;  /**< key length in bytes */
+                       } cipher_key;
+                       struct {
+                               uint8_t *data;  /**< pointer to key data */
+                               size_t length;  /**< key length in bytes */
+                       } auth_key;
+               };
+       };
        struct {
                uint16_t length; /**< IV length in bytes */
                uint16_t offset; /**< IV offset in bytes */
@@ -196,8 +184,6 @@ typedef struct dpaa2_sec_session_entry {
        uint16_t digest_length;
        uint8_t status;
        union {
-               struct dpaa2_sec_cipher_ctxt cipher_ctxt;
-               struct dpaa2_sec_auth_ctxt auth_ctxt;
                struct dpaa2_sec_aead_ctxt aead_ctxt;
        } ext_params;
 } dpaa2_sec_session;
@@ -335,6 +321,36 @@ static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* AES GCM */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
+                       {.aead = {
+                               .algo = RTE_CRYPTO_AEAD_AES_GCM,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 16,
+                                       .max = 32,
+                                       .increment = 8
+                               },
+                               .digest_size = {
+                                       .min = 8,
+                                       .max = 16,
+                                       .increment = 4
+                               },
+                               .aad_size = {
+                                       .min = 0,
+                                       .max = 240,
+                                       .increment = 1
+                               },
+                               .iv_size = {
+                                       .min = 12,
+                                       .max = 12,
+                                       .increment = 0
+                               },
+                       }, }
+               }, }
+       },
        {       /* AES CBC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -355,6 +371,26 @@ static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* AES CTR */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                       {.cipher = {
+                               .algo = RTE_CRYPTO_CIPHER_AES_CTR,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 16,
+                                       .max = 32,
+                                       .increment = 8
+                               },
+                               .iv_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               },
+                       }, }
+               }, }
+       },
        {       /* 3DES CBC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
index 5e09b8e..7d3f7b5 100644 (file)
@@ -1738,6 +1738,22 @@ test_AES_cipheronly_dpaa2_sec_all(void)
        return TEST_SUCCESS;
 }
 
+static int
+test_authonly_dpaa2_sec_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_DPAA2_SEC_PMD,
+               BLKCIPHER_AUTHONLY_TYPE);
+
+       TEST_ASSERT_EQUAL(status, 0, "Test failed");
+
+       return TEST_SUCCESS;
+}
+
 static int
 test_authonly_openssl_all(void)
 {
@@ -8281,28 +8297,84 @@ static struct unit_test_suite cryptodev_dpaa2_sec_testsuite  = {
        .teardown = testsuite_teardown,
        .unit_test_cases = {
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_device_configure_invalid_dev_id),
+                       test_device_configure_invalid_dev_id),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_multi_session),
+                       test_multi_session),
 
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_AES_chain_dpaa2_sec_all),
+                       test_AES_chain_dpaa2_sec_all),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_3DES_chain_dpaa2_sec_all),
+                       test_3DES_chain_dpaa2_sec_all),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_AES_cipheronly_dpaa2_sec_all),
+                       test_AES_cipheronly_dpaa2_sec_all),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_3DES_cipheronly_dpaa2_sec_all),
+                       test_3DES_cipheronly_dpaa2_sec_all),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_authonly_dpaa2_sec_all),
 
-               /** HMAC_MD5 Authentication */
+               /** AES GCM Authenticated Encryption */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_2),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_3),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_4),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_5),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_6),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_encryption_test_case_7),
+
+               /** AES GCM Authenticated Decryption */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_2),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_MD5_HMAC_generate_case_1),
+                       test_mb_AES_GCM_authenticated_decryption_test_case_3),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_4),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_5),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_6),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_authenticated_decryption_test_case_7),
+
+               /** AES GCM Authenticated Encryption 256 bits key */
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_2),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_3),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_4),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_MD5_HMAC_verify_case_1),
+                       test_mb_AES_GCM_auth_encryption_test_case_256_5),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_6),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_encryption_test_case_256_7),
+
+               /** AES GCM Authenticated Decryption 256 bits key */
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_MD5_HMAC_generate_case_2),
+                       test_mb_AES_GCM_auth_decryption_test_case_256_1),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_decryption_test_case_256_2),
                TEST_CASE_ST(ut_setup, ut_teardown,
-                            test_MD5_HMAC_verify_case_2),
+                       test_mb_AES_GCM_auth_decryption_test_case_256_3),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_decryption_test_case_256_4),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_decryption_test_case_256_5),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_decryption_test_case_256_6),
+               TEST_CASE_ST(ut_setup, ut_teardown,
+                       test_mb_AES_GCM_auth_decryption_test_case_256_7),
 
                TEST_CASES_END() /**< NULL terminate unit test array */
        }
index 07d6eab..f692d57 100644 (file)
@@ -1028,7 +1028,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CTR HMAC-SHA1 Decryption Digest "
@@ -1038,7 +1039,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-192-CTR XCBC Encryption Digest",
@@ -1074,7 +1076,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CTR HMAC-SHA1 Decryption Digest "
@@ -1084,7 +1087,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest",
@@ -1094,7 +1098,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@@ -1124,7 +1129,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA1 Decryption Digest "
@@ -1141,7 +1147,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA256 Encryption Digest "
@@ -1159,7 +1166,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA256 Decryption Digest "
@@ -1175,7 +1183,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA512 Encryption Digest "
@@ -1205,7 +1214,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA512 Decryption Digest "
@@ -1262,7 +1272,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA224 Decryption Digest "
@@ -1272,7 +1283,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA384 Encryption Digest",
@@ -1281,7 +1293,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA384 Decryption Digest "
@@ -1291,7 +1304,8 @@ static const struct blockcipher_test_case aes_chain_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_MB |
                        BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC HMAC-SHA1 Encryption Digest "
@@ -1322,7 +1336,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CBC Decryption",
@@ -1331,7 +1346,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-192-CBC Encryption",
@@ -1340,7 +1356,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-192-CBC Encryption Scater gather",
@@ -1357,7 +1374,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CBC Encryption",
@@ -1366,7 +1384,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CBC Decryption",
@@ -1375,7 +1394,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CBC OOP Encryption",
@@ -1400,7 +1420,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-128-CTR Decryption",
@@ -1409,7 +1430,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-192-CTR Encryption",
@@ -1418,7 +1440,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-192-CTR Decryption",
@@ -1427,7 +1450,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CTR Encryption",
@@ -1436,7 +1460,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "AES-256-CTR Decryption",
@@ -1445,7 +1470,8 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = {
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_QAT |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
 };
 
index e8e4ea5..fc27dd6 100644 (file)
@@ -101,6 +101,7 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
                        tdata->auth_key.len);
 
        switch (cryptodev_type) {
+       case RTE_CRYPTODEV_DPAA2_SEC_PMD:
        case RTE_CRYPTODEV_QAT_SYM_PMD:
        case RTE_CRYPTODEV_OPENSSL_PMD:
        case RTE_CRYPTODEV_ARMV8_PMD: /* Fall through */
index b226794..0b6e0b8 100644 (file)
@@ -1058,14 +1058,16 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
                .test_data = &triple_des128cbc_hmac_sha1_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-128-CBC HMAC-SHA1 Decryption Digest Verify",
                .test_data = &triple_des128cbc_hmac_sha1_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-128-CBC SHA1 Encryption Digest",
@@ -1084,14 +1086,16 @@ static const struct blockcipher_test_case triple_des_chain_test_cases[] = {
                .test_data = &triple_des192cbc_hmac_sha1_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_ENC_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-192-CBC HMAC-SHA1 Decryption Digest Verify",
                .test_data = &triple_des192cbc_hmac_sha1_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY_DEC,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-192-CBC SHA1 Encryption Digest",
@@ -1199,28 +1203,32 @@ static const struct blockcipher_test_case triple_des_cipheronly_test_cases[] = {
                .test_data = &triple_des128cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-128-CBC Decryption",
                .test_data = &triple_des128cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-192-CBC Encryption",
                .test_data = &triple_des192cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-192-CBC Decryption",
                .test_data = &triple_des192cbc_test_vector,
                .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
-                       BLOCKCIPHER_TEST_TARGET_PMD_QAT
+                       BLOCKCIPHER_TEST_TARGET_PMD_QAT |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "3DES-128-CTR Encryption",
index 3214f9a..24353fc 100644 (file)
@@ -366,7 +366,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-MD5 Digest Verify",
@@ -374,7 +375,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "SHA1 Digest",
@@ -394,7 +396,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-SHA1 Digest Verify",
@@ -402,7 +405,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "SHA224 Digest",
@@ -422,7 +426,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-SHA224 Digest Verify",
@@ -430,7 +435,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "SHA256 Digest",
@@ -450,7 +456,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-SHA256 Digest Verify",
@@ -458,7 +465,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "SHA384 Digest",
@@ -478,7 +486,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-SHA384 Digest Verify",
@@ -486,7 +495,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "SHA512 Digest",
@@ -506,7 +516,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
        {
                .test_descr = "HMAC-SHA512 Digest Verify",
@@ -514,7 +525,8 @@ static const struct blockcipher_test_case hash_test_cases[] = {
                .op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
                .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL |
                        BLOCKCIPHER_TEST_TARGET_PMD_MB |
-                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER
+                       BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |
+                       BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC
        },
 };