From patchwork Fri Mar 15 05:42:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 138420 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A252143CA6; Fri, 15 Mar 2024 06:44:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47C9242EBA; Fri, 15 Mar 2024 06:43:46 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A62AC410FC for ; Fri, 15 Mar 2024 06:42:39 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42EMJOr2032321 for ; Thu, 14 Mar 2024 22:42:38 -0700 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=Ws3k1GuStpZg63k3NYnd3K5ZM3899P+X2XWF4+OEzNE=; b=bUD 4rsKH+I8Idt+dMWcu+KDLoNOfJm2b7VKOLMtYOVVbnasVbu43Pwzc0KysTO5j5xD L/eoBRSIbFwG/h5jG44TKZT+905H1KbqAw28qHiawnM/47GjeXuFhRkbMNuy9SYN yokeZ7gDcM1zyMxh9icEe7lzzB6xthqW5L5zzPpezIA6lH7nuaX43apYDIJfPGWZ MV+VfSucM+P2gKc1j0RXSKP6BdgWpgljFeFbtdR7902gmABaCpMPRKyYY74TWwhb SEaVQ4z59t1qqDAZb7rzzgNMUCsTSCv1+Nai1oVfoT2phZwhnH/sMaGq0tpoEqX3 i7SQR8yub6zYSzZTBmA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3wv9xa12hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Mar 2024 22:42:38 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Thu, 14 Mar 2024 22:42:37 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Thu, 14 Mar 2024 22:42:37 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.69.194]) by maili.marvell.com (Postfix) with ESMTP id 5034A3F703F; Thu, 14 Mar 2024 22:42:35 -0700 (PDT) From: Vidya Sagar Velumuri To: Akhil Goyal CC: Jerin Jacob , , Aakash Sasidharan , Anoob Joseph Subject: [PATCH v3 8/8] crypto/cnxk: update the context structure of tls Date: Fri, 15 Mar 2024 11:12:13 +0530 Message-ID: <20240315054213.540-9-vvelumuri@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315054213.540-1-vvelumuri@marvell.com> References: <20240314131839.3362494-1-vvelumuri@marvell.com> <20240315054213.540-1-vvelumuri@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: h8DDgnO4eiaV0M9NNI0kNBYpV6DnJ1lL X-Proofpoint-GUID: h8DDgnO4eiaV0M9NNI0kNBYpV6DnJ1lL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-14_13,2024-03-13_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 Keep the record context for TLS-1.3 in sync with microcode structure. Report error if optional padding is enabled for AEAD case in both TLS-1.2 and DTLS-1.2. Use the proper offset for calculating the context size in case of TLS-1.3. Signed-off-by: Vidya Sagar Velumuri --- drivers/common/cnxk/roc_ie_ot_tls.h | 17 ++++++++++++----- drivers/crypto/cnxk/cn10k_tls.c | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/common/cnxk/roc_ie_ot_tls.h b/drivers/common/cnxk/roc_ie_ot_tls.h index 39c42775f4..2d6a290d9b 100644 --- a/drivers/common/cnxk/roc_ie_ot_tls.h +++ b/drivers/common/cnxk/roc_ie_ot_tls.h @@ -68,6 +68,16 @@ struct roc_ie_ot_tls_read_ctx_update_reg { uint64_t ar_winbits[ROC_IE_OT_TLS_AR_WINBITS_SZ]; }; +struct roc_ie_ot_tls_1_3_read_ctx_update_reg { + uint64_t rsvd0; + uint64_t ar_valid_mask; + uint64_t hard_life; + uint64_t soft_life; + uint64_t mib_octs; + uint64_t mib_pkts; + uint64_t rsvd1; +}; + union roc_ie_ot_tls_param2 { uint16_t u16; struct { @@ -137,11 +147,8 @@ struct roc_ie_ot_tls_read_sa { union { struct { - /* Word10 */ - uint64_t w10_rsvd6; - - /* Word11 - Word25 */ - struct roc_ie_ot_tls_read_ctx_update_reg ctx; + /* Word10 - Word16 */ + struct roc_ie_ot_tls_1_3_read_ctx_update_reg ctx; } tls_13; struct { diff --git a/drivers/crypto/cnxk/cn10k_tls.c b/drivers/crypto/cnxk/cn10k_tls.c index 3505a71a6c..7b73a58d2a 100644 --- a/drivers/crypto/cnxk/cn10k_tls.c +++ b/drivers/crypto/cnxk/cn10k_tls.c @@ -121,8 +121,8 @@ cnxk_tls_xform_verify(struct rte_security_tls_record_xform *tls_xform, if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) { /* optional padding is not allowed in TLS-1.2 for AEAD */ - if ((tls_xform->ver == RTE_SECURITY_VERSION_TLS_1_2) && - (tls_xform->options.extra_padding_enable == 1)) + if ((tls_xform->options.extra_padding_enable == 1) && + (tls_xform->ver != RTE_SECURITY_VERSION_TLS_1_3)) return -EINVAL; return tls_xform_aead_verify(tls_xform, crypto_xform); @@ -312,7 +312,7 @@ tls_read_ctx_size(struct roc_ie_ot_tls_read_sa *sa, enum rte_security_tls_versio /* Variable based on Anti-replay Window */ if (tls_ver == RTE_SECURITY_VERSION_TLS_1_3) { size = offsetof(struct roc_ie_ot_tls_read_sa, tls_13.ctx) + - offsetof(struct roc_ie_ot_tls_read_ctx_update_reg, ar_winbits); + sizeof(struct roc_ie_ot_tls_1_3_read_ctx_update_reg); } else { size = offsetof(struct roc_ie_ot_tls_read_sa, tls_12.ctx) + offsetof(struct roc_ie_ot_tls_read_ctx_update_reg, ar_winbits);