From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A86E0A00C4; Thu, 23 Apr 2020 15:46:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 847C01D16C; Thu, 23 Apr 2020 15:46:57 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id EE1E81D164 for ; Thu, 23 Apr 2020 15:46:55 +0200 (CEST) IronPort-SDR: 9O7JXQ1HDLNnerEEt60u38Ia4cNe/p9GsJXwZlYxn3SQTfym4jyZa4fi0d0OaFbp3uw+6hYFno rhUXl+59ZR7A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 06:46:54 -0700 IronPort-SDR: wxDou6wWKDT/XidPM9AKYV+QeUVFn/eItC1fTp8r1M9aoZ7qN5g3PsfoK3ZyduO0Ocpu/Ho632 Cp6JLE10qyQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,307,1583222400"; d="scan'208";a="247756551" Received: from silpixa00399593.ir.intel.com (HELO silpixa00399593.ger.corp.intel.com) ([10.237.223.21]) by fmsmga008.fm.intel.com with ESMTP; 23 Apr 2020 06:46:53 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: akhil.goyal@nxp.com, dev@dpdk.org, Pablo de Lara Date: Thu, 23 Apr 2020 14:46:49 +0100 Message-Id: <1587649609-67464-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1587475342-2395-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1587475342-2395-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2] crypto/aesni_mb: fix DOCSIS AES-256 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" When adding support for DOCSIS AES-256, when setting the cipher parameters, all key sizes were accepted, but only 128-bit and 256-bit keys are supported. Fixes: 124d04b43743 ("crypto/aesni_mb: support DOCSIS AES-256") Signed-off-by: Pablo de Lara Acked-by: Mairtin o Loingsigh --- v2: - Fixed commit message (missing a word). - Rebased on top of dpdk-next-crypto drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index a1d59e8..5ff6a79 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -381,6 +381,7 @@ aesni_mb_set_session_cipher_parameters(const MB_MGR *mb_mgr, { uint8_t is_aes = 0; uint8_t is_3DES = 0; + uint8_t is_docsis = 0; if (xform == NULL) { sess->cipher.mode = NULL_CIPHER; @@ -417,7 +418,7 @@ aesni_mb_set_session_cipher_parameters(const MB_MGR *mb_mgr, break; case RTE_CRYPTO_CIPHER_AES_DOCSISBPI: sess->cipher.mode = DOCSIS_SEC_BPI; - is_aes = 1; + is_docsis = 1; break; case RTE_CRYPTO_CIPHER_DES_CBC: sess->cipher.mode = DES; @@ -463,6 +464,26 @@ aesni_mb_set_session_cipher_parameters(const MB_MGR *mb_mgr, AESNI_MB_LOG(ERR, "Invalid cipher key length"); return -EINVAL; } + } else if (is_docsis) { + switch (xform->cipher.key.length) { + case AES_128_BYTES: + sess->cipher.key_length_in_bytes = AES_128_BYTES; + IMB_AES_KEYEXP_128(mb_mgr, xform->cipher.key.data, + sess->cipher.expanded_aes_keys.encode, + sess->cipher.expanded_aes_keys.decode); + break; +#if IMB_VERSION_NUM >= IMB_VERSION(0, 53, 3) + case AES_256_BYTES: + sess->cipher.key_length_in_bytes = AES_256_BYTES; + IMB_AES_KEYEXP_256(mb_mgr, xform->cipher.key.data, + sess->cipher.expanded_aes_keys.encode, + sess->cipher.expanded_aes_keys.decode); + break; +#endif + default: + AESNI_MB_LOG(ERR, "Invalid cipher key length"); + return -EINVAL; + } } else if (is_3DES) { uint64_t *keys[3] = {sess->cipher.exp_3des_keys.key[0], sess->cipher.exp_3des_keys.key[1], -- 2.7.5