From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B38FA0C45; Fri, 15 Oct 2021 16:40:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89EC24127C; Fri, 15 Oct 2021 16:40:29 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 7A8AF4126A for ; Fri, 15 Oct 2021 16:40:27 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="227816143" X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="227816143" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 07:40:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="442542812" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.87]) by orsmga006.jf.intel.com with ESMTP; 15 Oct 2021 07:40:23 -0700 From: Ciara Power To: dev@dpdk.org Cc: roy.fan.zhang@intel.com, piotrx.bronowski@intel.com, gakhil@marvell.com, pablo.de.lara.guarch@intel.com, mdr@ashroe.eu Date: Fri, 15 Oct 2021 14:39:47 +0000 Message-Id: <20211015143957.842499-5-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015143957.842499-1-ciara.power@intel.com> References: <20210618121803.1189857-1-piotrx.bronowski@intel.com> <20211015143957.842499-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 04/14] crypto/ipsec_mb: support ZUC-256 for aesni_mb X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pablo de Lara Add support for ZUC-EEA3-256 and ZUC-EIA3-256. Only 4-byte tags supported for now. Signed-off-by: Pablo de Lara --- doc/guides/cryptodevs/aesni_mb.rst | 1 + doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 21 ++++++++++++++++----- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 16 ++++++++-------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst index 3551a0dbd7..948128ae9b 100644 --- a/doc/guides/cryptodevs/aesni_mb.rst +++ b/doc/guides/cryptodevs/aesni_mb.rst @@ -77,6 +77,7 @@ Limitations protocol. * RTE_CRYPTO_CIPHER_DES_DOCSISBPI is not supported for combined Crypto-CRC DOCSIS security protocol. +* The only tag size supported for ZUC-EIA3-256 is 4 bytes. Installation diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 7628c32052..46f8a22c8d 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -106,6 +106,10 @@ New Features * AESNI_MB PMD. +* **Updated the aesni_mb crypto PMD.** + + * Added support for ZUC-EEA3-256 and ZUC-EIA3-256. + * **Updated Marvell cnxk ethdev driver.** * Added rte_flow support for dual VLAN insert and strip actions. diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index c9c4906722..c38d85a366 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -179,7 +179,15 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, } if (xform->auth.algo == RTE_CRYPTO_AUTH_ZUC_EIA3) { - sess->auth.algo = IMB_AUTH_ZUC_EIA3_BITLEN; + if (xform->auth.key.length == 16) { + sess->auth.algo = IMB_AUTH_ZUC_EIA3_BITLEN; + } else if (xform->auth.key.length == 32) { + sess->auth.algo = IMB_AUTH_ZUC256_EIA3_BITLEN; + } else { + IPSEC_MB_LOG(ERR, "Invalid authentication key length\n"); + return -EINVAL; + } + uint16_t zuc_eia3_digest_len = get_truncated_digest_byte_length( IMB_AUTH_ZUC_EIA3_BITLEN); @@ -189,7 +197,8 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, } sess->auth.gen_digest_len = sess->auth.req_digest_len; - memcpy(sess->auth.zuc_auth_key, xform->auth.key.data, 16); + memcpy(sess->auth.zuc_auth_key, xform->auth.key.data, + xform->auth.key.length); return 0; } else if (xform->auth.algo == RTE_CRYPTO_AUTH_SNOW3G_UIA2) { sess->auth.algo = IMB_AUTH_SNOW3G_UIA2_BITLEN; @@ -522,13 +531,14 @@ aesni_mb_set_session_cipher_parameters(const IMB_MGR *mb_mgr, sess->cipher.key_length_in_bytes = 24; } else if (is_zuc) { - if (xform->cipher.key.length != 16) { + if (xform->cipher.key.length != 16 && + xform->cipher.key.length != 32) { IPSEC_MB_LOG(ERR, "Invalid cipher key length"); return -EINVAL; } - sess->cipher.key_length_in_bytes = 16; + sess->cipher.key_length_in_bytes = xform->cipher.key.length; memcpy(sess->cipher.zuc_cipher_key, xform->cipher.key.data, - 16); + xform->cipher.key.length); } else if (is_snow3g) { if (xform->cipher.key.length != 16) { IPSEC_MB_LOG(ERR, "Invalid cipher key length"); @@ -1150,6 +1160,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->dec_keys = &session->cipher.gcm_key; break; case IMB_AUTH_ZUC_EIA3_BITLEN: + case IMB_AUTH_ZUC256_EIA3_BITLEN: job->u.ZUC_EIA3._key = session->auth.zuc_auth_key; job->u.ZUC_EIA3._iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->auth_iv.offset); diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index db7d283ca2..d37cc787a0 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -526,8 +526,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { .block_size = 16, .key_size = { .min = 16, - .max = 16, - .increment = 0 + .max = 32, + .increment = 16 }, .digest_size = { .min = 4, @@ -536,8 +536,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { }, .iv_size = { .min = 16, - .max = 16, - .increment = 0 + .max = 25, + .increment = 9 } }, } }, } @@ -551,13 +551,13 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { .block_size = 16, .key_size = { .min = 16, - .max = 16, - .increment = 0 + .max = 32, + .increment = 16 }, .iv_size = { .min = 16, - .max = 16, - .increment = 0 + .max = 25, + .increment = 9 }, }, } }, } -- 2.25.1