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 86120438E9; Wed, 17 Jan 2024 11:32:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84B00410E6; Wed, 17 Jan 2024 11:31:55 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0676040DDD for ; Wed, 17 Jan 2024 11:31:51 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H8pnMt012890 for ; Wed, 17 Jan 2024 02:31:51 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=a/m61A7KcO7M8e6waN3f5dpUCBcE8jJT+cLfAh0RxTc=; b=iJ5 5TXuOCHmJ5piTe5myRiZqUcRKhOBafdWJITTGKoB9bFnRbV4paQvh4xr0XuHelK6 BmcVNtTmYb3Oh2iWvAu1aXKVz4+bc2GdySpUMWdoF/bq4wxab3J/i+djsehbQ8jp nXNI+pD+ukvRC7CenGr9tliBizTTFWnEt8mr9GH56xsKdD40PpvHbS+3sEjrocA5 q7R+rtLSIzzkedZCxeJkg8fAiqxMrveXbyNIATqsvYHgH7QAE/J9E/7LgeO4rCmo TftfOlN39y212nZfpEnZvWMBIcqNErkEJFXBa694v15+87h5Le3OeL4wTl/K7Zoj n7S6x2Sv7Dkm/yuwO7w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vp0ge2juh-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 17 Jan 2024 02:31:50 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 02:31:42 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 02:31:42 -0800 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.22.179]) by maili.marvell.com (Postfix) with ESMTP id C80A33F7044; Wed, 17 Jan 2024 02:31:40 -0800 (PST) From: Anoob Joseph To: Akhil Goyal CC: Jerin Jacob , Vidya Sagar Velumuri , Tejasree Kondoj , Subject: [PATCH v3 12/24] common/cnxk: update opad-ipad gen to handle TLS Date: Wed, 17 Jan 2024 16:00:57 +0530 Message-ID: <20240117103109.922-13-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240117103109.922-1-anoobj@marvell.com> References: <20240102045417.115-1-anoobj@marvell.com> <20240117103109.922-1-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: f_tAZmM6hY56dL25yTKS7ATuRuezuZBm X-Proofpoint-ORIG-GUID: f_tAZmM6hY56dL25yTKS7ATuRuezuZBm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-17_05,2024-01-17_01,2023-05-22_02 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 For TLS opcodes, ipad is at the offset 64 as compared to the packed implementation for IPsec. Extend the function to handle TLS contexts as well. Signed-off-by: Anoob Joseph Signed-off-by: Vidya Sagar Velumuri --- drivers/common/cnxk/cnxk_security.c | 15 ++++++++------- drivers/common/cnxk/cnxk_security.h | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index 81991c4697..bdb04fe142 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -9,7 +9,8 @@ #include "roc_api.h" void -cnxk_sec_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform, uint8_t *hmac_opad_ipad) +cnxk_sec_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform, uint8_t *hmac_opad_ipad, + bool is_tls) { const uint8_t *key = auth_xform->auth.key.data; uint32_t length = auth_xform->auth.key.length; @@ -29,11 +30,11 @@ cnxk_sec_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform, uint8_t *hmac_op switch (auth_xform->auth.algo) { case RTE_CRYPTO_AUTH_MD5_HMAC: roc_hash_md5_gen(opad, (uint32_t *)&hmac_opad_ipad[0]); - roc_hash_md5_gen(ipad, (uint32_t *)&hmac_opad_ipad[24]); + roc_hash_md5_gen(ipad, (uint32_t *)&hmac_opad_ipad[is_tls ? 64 : 24]); break; case RTE_CRYPTO_AUTH_SHA1_HMAC: roc_hash_sha1_gen(opad, (uint32_t *)&hmac_opad_ipad[0]); - roc_hash_sha1_gen(ipad, (uint32_t *)&hmac_opad_ipad[24]); + roc_hash_sha1_gen(ipad, (uint32_t *)&hmac_opad_ipad[is_tls ? 64 : 24]); break; case RTE_CRYPTO_AUTH_SHA256_HMAC: roc_hash_sha256_gen(opad, (uint32_t *)&hmac_opad_ipad[0], 256); @@ -191,7 +192,7 @@ ot_ipsec_sa_common_param_fill(union roc_ot_ipsec_sa_word2 *w2, const uint8_t *auth_key = auth_xfrm->auth.key.data; roc_aes_xcbc_key_derive(auth_key, hmac_opad_ipad); } else { - cnxk_sec_opad_ipad_gen(auth_xfrm, hmac_opad_ipad); + cnxk_sec_opad_ipad_gen(auth_xfrm, hmac_opad_ipad, false); } tmp_key = (uint64_t *)hmac_opad_ipad; @@ -740,7 +741,7 @@ onf_ipsec_sa_common_param_fill(struct roc_ie_onf_sa_ctl *ctl, uint8_t *salt, key = cipher_xfrm->cipher.key.data; length = cipher_xfrm->cipher.key.length; - cnxk_sec_opad_ipad_gen(auth_xfrm, hmac_opad_ipad); + cnxk_sec_opad_ipad_gen(auth_xfrm, hmac_opad_ipad, false); } switch (length) { @@ -1373,7 +1374,7 @@ cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipsec, roc_aes_xcbc_key_derive(auth_key, hmac_opad_ipad); } else if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_NULL) { - cnxk_sec_opad_ipad_gen(auth_xform, hmac_opad_ipad); + cnxk_sec_opad_ipad_gen(auth_xform, hmac_opad_ipad, false); } } @@ -1440,7 +1441,7 @@ cnxk_on_ipsec_inb_sa_create(struct rte_security_ipsec_xform *ipsec, roc_aes_xcbc_key_derive(auth_key, hmac_opad_ipad); } else if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_NULL) { - cnxk_sec_opad_ipad_gen(auth_xform, hmac_opad_ipad); + cnxk_sec_opad_ipad_gen(auth_xform, hmac_opad_ipad, false); } } diff --git a/drivers/common/cnxk/cnxk_security.h b/drivers/common/cnxk/cnxk_security.h index fabf694df4..86ec657cb0 100644 --- a/drivers/common/cnxk/cnxk_security.h +++ b/drivers/common/cnxk/cnxk_security.h @@ -70,6 +70,7 @@ int __roc_api cnxk_on_ipsec_outb_sa_create(struct rte_security_ipsec_xform *ipse struct roc_ie_on_outb_sa *out_sa); __rte_internal -void cnxk_sec_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform, uint8_t *hmac_opad_ipad); +void cnxk_sec_opad_ipad_gen(struct rte_crypto_sym_xform *auth_xform, uint8_t *hmac_opad_ipad, + bool is_tls); #endif /* _CNXK_SECURITY_H__ */ -- 2.25.1