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 A3CDCA034E; Mon, 21 Feb 2022 14:39:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37EFC4068C; Mon, 21 Feb 2022 14:39:53 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 632D54013F for ; Mon, 21 Feb 2022 14:39:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645450791; x=1676986791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7Alr2I35tO59k3ZngXdq0ZuI6nd5U1I0eVxdIdkhhGo=; b=HyQ0jPH8rmk1XG4I3n9FHcgV2er+lDpG8Cnq1TcAgQHo/Oso+oxGmEhu 8w/bdBmw48bLfKCh2xYY1toO4PUW6wIW/xCX2h5ZsGvKFeXlw8dNjstHE eNXP59e3ju8hfVLJG05toSEXm3fjzlPV/1EX7ELUpx73rGDM8vVJ2hirQ 5MGvOnQ+045hXlT5ScuHyuAIog7tVKhSMwGnNfm9kzabkeIlAPzwwOZq5 +XVJdEs9hP2HWQBp/GGjYgjVMUyQuGTFtoAgJUUsnoewk9myW/ZMmXOtL 8JOPIolkYY3DAINCM/TL0T3Zmz3Q4EdJTcXrY5wE1jkZ9Ynuxaal9lxey w==; X-IronPort-AV: E=McAfee;i="6200,9189,10264"; a="337940346" X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="337940346" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 05:39:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,385,1635231600"; d="scan'208";a="507636821" Received: from silpixa00400885.ir.intel.com ([10.243.23.50]) by orsmga006.jf.intel.com with ESMTP; 21 Feb 2022 05:39:48 -0800 From: Fan Zhang To: dev@dpdk.org Cc: gakhil@marvell.com, Fan Zhang , Declan Doherty , Radu Nicolau Subject: [PATCH v2] crypto/ipsec_mb: add NULL/NULL support to aesni-mb Date: Mon, 21 Feb 2022 13:39:46 +0000 Message-Id: <20220221133946.2023823-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210907090715.460856-1-radu.nicolau@intel.com> References: <20210907090715.460856-1-radu.nicolau@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add NULL cipher and auth support to AESNI-MB PMD type. Signed-off-by: Fan Zhang Signed-off-by: Declan Doherty Signed-off-by: Radu Nicolau --- v2: - Added actual PMD support. drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 18 ++++++++++ drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 37 +++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index a308d42ffa..0111c6f540 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -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) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index d37cc787a0..f46037ff76 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -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 = { -- 2.25.1