]> git.droids-corp.org - dpdk.git/commitdiff
crypto/ipsec_mb: support null auth/cipher for aesni_mb
authorFan Zhang <roy.fan.zhang@intel.com>
Mon, 21 Feb 2022 13:39:46 +0000 (13:39 +0000)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 22 Feb 2022 19:05:55 +0000 (20:05 +0100)
Add NULL cipher and auth support to AESNI-MB PMD type.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
drivers/crypto/ipsec_mb/pmd_aesni_mb.c
drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h

index a308d42ffac27e2c8f1d22e4652bf3d1bbf5c5ec..0111c6f5404da176979733caa302feeb183d9c22 100644 (file)
@@ -88,6 +88,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr,
        sess->auth.operation = xform->auth.op;
 
        /* Set Authentication Parameters */
+       if (xform->auth.algo == RTE_CRYPTO_AUTH_NULL) {
+               sess->auth.algo = IMB_AUTH_NULL;
+               sess->auth.gen_digest_len = 0;
+               return 0;
+       }
+
        if (xform->auth.algo == RTE_CRYPTO_AUTH_AES_XCBC_MAC) {
                sess->auth.algo = IMB_AUTH_AES_XCBC;
 
@@ -434,6 +440,12 @@ aesni_mb_set_session_cipher_parameters(const IMB_MGR *mb_mgr,
                sess->cipher.mode = IMB_CIPHER_KASUMI_UEA1_BITLEN;
                is_kasumi = 1;
                break;
+       case RTE_CRYPTO_CIPHER_NULL:
+               sess->cipher.mode = IMB_CIPHER_NULL;
+               sess->cipher.key_length_in_bytes = 0;
+               sess->iv.offset = xform->cipher.iv.offset;
+               sess->iv.length = xform->cipher.iv.length;
+               return 0;
        default:
                IPSEC_MB_LOG(ERR, "Unsupported cipher mode parameter");
                return -ENOTSUP;
@@ -1324,6 +1336,12 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp,
                        session->iv.offset);
        }
 
+       if (job->cipher_mode == IMB_CIPHER_NULL && oop) {
+               memcpy(job->dst + job->cipher_start_src_offset_in_bytes,
+                       job->src + job->cipher_start_src_offset_in_bytes,
+                       job->msg_len_to_cipher_in_bytes);
+       }
+
        if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3)
                job->msg_len_to_cipher_in_bytes >>= 3;
        else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1)
index d177961ea5e1c8ec25df0600f8c24d6b23b8e65c..6ddfce22853a1a2edb81b2d0de1f7d380644e8b6 100644 (file)
@@ -275,6 +275,43 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* 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 = { 0 }
+                       }, },
+               }, }
+       },
        {       /* AES CBC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {