From patchwork Thu Jun 20 14:50:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141427 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 0A399454AB; Thu, 20 Jun 2024 16:51:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB98342E69; Thu, 20 Jun 2024 16:51:06 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 47A8642E67 for ; Thu, 20 Jun 2024 16:51:05 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KCgaqd011301; Thu, 20 Jun 2024 07:51:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=g NcpsFYP3y4Ei7Gbho/cX/N22ZGKsoOc2uHkfOTnSa8=; b=T1XojQKFUZJ5ucotD hAeSefaIXBvZnEfwnEfyq82lXWTN66bjCCpTl4WbLoIeQEiaY9xdgE6f+dTqkQYK gomKPqPz38GFNcoZzgHmgTRc7OgER2BvjBsCch9Vl6d+sh9OLqFwhpXvrczSg3Mc gRYfKIVZB8YEnwHkmARqVzLc0U+8IJLEIqTVVq8lN86CZzgEBqEE9X4dJcUY7fxM 4jXzCTSLQbdb9pb8+ecDfrz+aYr1+8WYjx7oYA2S+uYPA9J6VinTUvr5XBlWhrh7 A7vZd6yUGqtCZC601Naz/3hyf38XavR2IRogV7NHQQPCUVMDbLhKxQOh79dCxGkR 9OA1A== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:04 -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.1544.4; Thu, 20 Jun 2024 07:51:03 -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.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:03 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id AE5A83F7043; Thu, 20 Jun 2024 07:51:00 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 1/7] test/crypto: unit tests for padding for TLS-1.3 Date: Thu, 20 Jun 2024 20:20:50 +0530 Message-ID: <20240620145056.3456650-2-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 2b0N393_mSO78Nqx2vj1PEgwB7rkc9up X-Proofpoint-GUID: 2b0N393_mSO78Nqx2vj1PEgwB7rkc9up X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 From: Vidya Sagar Velumuri Add unit tests to verify the padding for TLS-1.3. Signed-off-by: Vidya Sagar Velumuri --- app/test/test_cryptodev.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 94438c587a..61ee43327a 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12740,6 +12740,25 @@ test_tls_1_3_record_proto_zero_len_non_app(void) return test_tls_record_proto_all(&flags); } + +static int +test_tls_1_3_record_proto_dm_opt_padding(void) +{ + return test_tls_record_proto_opt_padding(6, 0, RTE_SECURITY_VERSION_TLS_1_3); +} + +static int +test_tls_1_3_record_proto_sg_opt_padding(void) +{ + return test_tls_record_proto_opt_padding(25, 5, RTE_SECURITY_VERSION_TLS_1_3); +} + +static int +test_tls_1_3_record_proto_sg_opt_padding_1(void) +{ + return test_tls_record_proto_opt_padding(25, 4, RTE_SECURITY_VERSION_TLS_1_3); +} + #endif static int @@ -18168,6 +18187,18 @@ static struct unit_test_suite tls13_record_proto_testsuite = { "TLS-1.3 record with zero len and content type as ctrl", ut_setup_security, ut_teardown, test_tls_1_3_record_proto_zero_len_non_app), + TEST_CASE_NAMED_ST( + "TLS-1.3 record DM mode with optional padding", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_dm_opt_padding), + TEST_CASE_NAMED_ST( + "TLS-1.3 record SG mode with optional padding - 1", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_sg_opt_padding), + TEST_CASE_NAMED_ST( + "TLS-1.3 record SG mode with optional padding", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_sg_opt_padding_1), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Thu Jun 20 14:50:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141428 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 B3E11454AB; Thu, 20 Jun 2024 16:51:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0941F42E71; Thu, 20 Jun 2024 16:51:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3844B42E70 for ; Thu, 20 Jun 2024 16:51:08 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KCTgvB011177; Thu, 20 Jun 2024 07:51:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=s leS61wF44Vvbj8/v+qkqJODRBvW30+J/19tRfFqJBs=; b=Uj6sF0B45LXOLZBmz KkFjL0XxDbM2ebMexzjEp9mgyiWeye9m1zb304PLKF36nOLnReV997PvhyrR7z/N CVtRc5fuKldtGiO53B/aZj5ICH+6RWbIsQl2zhx92e2aS4PBtYRcxZzlagpbbetI 6pET5jmoJyXOWyKE0zOeHP7XjDF76RkDK8N+7f6We2Cm2ZEok8qmGtM75eHWywos kcZYblnMjYWYJBOrlC1yTWVNefbMbe1Z6YNJ/8avMxSu3lBfY145qf9yregPNHXx u5DNKy2kWPmcl2KfpN1vqDYx0FEyKH4MC2P+snIWF9eYf1it6pYiWJZ52MjqeHD5 lFN8Q== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:07 -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.1544.4; Thu, 20 Jun 2024 07:51:06 -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.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:06 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 880133F7043; Thu, 20 Jun 2024 07:51:03 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 2/7] test/crypto: add combined mode cases for TLS 1.3 Date: Thu, 20 Jun 2024 20:20:51 +0530 Message-ID: <20240620145056.3456650-3-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: NXLdwpMS6adqXIuYSwiyAFUPWVxdPpCz X-Proofpoint-GUID: NXLdwpMS6adqXIuYSwiyAFUPWVxdPpCz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 cases to try TLS 1.3 record write(encrypt) + read(decrypt) operations. This is used for testing TLS 1.3 record features with all algorithms supported by the security device. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 61ee43327a..c5244db883 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12680,6 +12680,19 @@ test_dtls_1_2_record_proto_sg_opt_padding_max(void) return test_tls_record_proto_opt_padding(33, 4, RTE_SECURITY_VERSION_DTLS_1_2); } +static int +test_tls_1_3_record_proto_display_list(void) +{ + struct tls_record_test_flags flags; + + memset(&flags, 0, sizeof(flags)); + + flags.display_alg = true; + flags.tls_version = RTE_SECURITY_VERSION_TLS_1_3; + + return test_tls_record_proto_all(&flags); +} + static int test_tls_1_3_record_proto_corrupt_pkt(void) { @@ -18199,6 +18212,10 @@ static struct unit_test_suite tls13_record_proto_testsuite = { "TLS-1.3 record SG mode with optional padding", ut_setup_security, ut_teardown, test_tls_1_3_record_proto_sg_opt_padding_1), + TEST_CASE_NAMED_ST( + "Combined test alg list", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_display_list), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Thu Jun 20 14:50:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141429 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 3F1D8454AB; Thu, 20 Jun 2024 16:51:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F83F42E80; Thu, 20 Jun 2024 16:51:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 016C042E74 for ; Thu, 20 Jun 2024 16:51:10 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KASrG0027629; Thu, 20 Jun 2024 07:51:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=C 00gQSLMy1BiGv+aK72CGpAHDj/XfUp8uWzP1TAur2k=; b=SomAlbFkrLm3seOuy NZhRIIm6K+RVvVbJRrL4Dhni/aNeX37p1pM7j1MBML4rHH2DvHK/Fcqf68x7deZj wovd7C0WclOYDUTcggZAAgy29nZfiFo+ZJawe+iPRgVSNN5DX+zFWcsEHUlRt3iJ NG8ufaHYbHn54PFFcOhj4qnM/j62j4329aTmWwt3NWSo3Qpnh4SSZ8Wvh7aaQ8AV icunrVb50Eyp2dyegnxZ+qQZJncoUaMWDox7loNUkPg/MGxp3NiVnkY6OfFHsmbm X8xur2H8TrwyUViHu/gg3zfq9AWWqJQ2iGDYXPW3XBImoVXQ2K8gsgM4FftAufkK JAqig== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yvjq0h1wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:10 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:51:08 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:08 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 61D7E3F7043; Thu, 20 Jun 2024 07:51:06 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 3/7] test/security: add TLS 1.3 data walkthrough tests Date: Thu, 20 Jun 2024 20:20:52 +0530 Message-ID: <20240620145056.3456650-4-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 6BpOeNFrpSMy_Hl7xC8gNdcGKS98Entm X-Proofpoint-GUID: 6BpOeNFrpSMy_Hl7xC8gNdcGKS98Entm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 combined mode data walkthrough test and multi-segmented packet data walkthrough test for TLS 1.3. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c5244db883..f3145abfee 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12772,6 +12772,39 @@ test_tls_1_3_record_proto_sg_opt_padding_1(void) return test_tls_record_proto_opt_padding(25, 4, RTE_SECURITY_VERSION_TLS_1_3); } +static int +test_tls_1_3_record_proto_data_walkthrough(void) +{ + struct tls_record_test_flags flags; + + memset(&flags, 0, sizeof(flags)); + + flags.data_walkthrough = true; + flags.tls_version = RTE_SECURITY_VERSION_TLS_1_3; + + return test_tls_record_proto_all(&flags); +} + +static int +test_tls_1_3_record_proto_sgl_data_walkthrough(void) +{ + struct tls_record_test_flags flags = { + .nb_segs_in_mbuf = 5, + .tls_version = RTE_SECURITY_VERSION_TLS_1_3, + .data_walkthrough = true + }; + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_cryptodev_info dev_info; + + rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); + if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { + printf("Device doesn't support in-place scatter-gather. Test Skipped.\n"); + return TEST_SKIPPED; + } + + return test_tls_record_proto_all(&flags); +} + #endif static int @@ -18216,6 +18249,14 @@ static struct unit_test_suite tls13_record_proto_testsuite = { "Combined test alg list", ut_setup_security, ut_teardown, test_tls_1_3_record_proto_display_list), + TEST_CASE_NAMED_ST( + "Data walkthrough combined test alg list", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_data_walkthrough), + TEST_CASE_NAMED_ST( + "Multi-segmented mode data walkthrough", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_sgl_data_walkthrough), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Thu Jun 20 14:50:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141430 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 CE443454AB; Thu, 20 Jun 2024 16:51:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF98F42E7E; Thu, 20 Jun 2024 16:51:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7381D42E7A for ; Thu, 20 Jun 2024 16:51:13 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KCTgvD011177; Thu, 20 Jun 2024 07:51:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=w uPKEk77mvumiYzs/rTYKTKo7dH1VzdQW0j5inCQz8Y=; b=Wqpk8JovpYhsZ6AWZ 0gV/cZb3fLTm8sjIy5h5g+dx5b57Fn7593KTVRtfUnRwyUZ012IN7breklJaabGN ZZO4H5g5nj3UwgkmzmOxD6HGfo64eSUrJDyBzO27Nl49/7m0Hx5VU4f9e3HKeeYD 23yM8xHQQ1jkgdb9UMHsQb9JgBt1CHeMHy18UmdhUrOgbx8BGwY6R3Ii9kNSgsAL LhCHjXgz8A2giDZYFi1+1kiJlrFBDZsuC31DY3vIFR/D+n8pDrp+SveWc23mKJ3b ryymIrItGA21JetzkLwag4hrL+ipnFGU6qkKJ8cAZbnHef1RSy/EZrpv/QkX5lgX FNkAQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:12 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:51:11 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:11 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 3EC0C3F7043; Thu, 20 Jun 2024 07:51:09 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 4/7] test/crypto: verify padding corruption in TLS-1.2 Date: Thu, 20 Jun 2024 20:20:53 +0530 Message-ID: <20240620145056.3456650-5-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: e2moYZlcKoZvXale4cPmvWutW5qVzm_S X-Proofpoint-GUID: e2moYZlcKoZvXale4cPmvWutW5qVzm_S X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 From: Vidya Sagar Velumuri Add unit test to verify corrupted padding bytes in TLS-1.2 record Signed-off-by: Vidya Sagar Velumuri Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 18 +++++++++++++++++- app/test/test_cryptodev_security_tls_record.c | 7 +++++++ app/test/test_cryptodev_security_tls_record.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index f3145abfee..da8d7bf109 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12173,7 +12173,7 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) if (ret == TEST_SKIPPED) continue; - if (flags->pkt_corruption) { + if (flags->pkt_corruption || flags->padding_corruption) { if (ret == TEST_SUCCESS) return TEST_FAILED; } else { @@ -12404,6 +12404,18 @@ test_tls_record_proto_sg_opt_padding_max(void) return test_tls_record_proto_opt_padding(33, 4, RTE_SECURITY_VERSION_TLS_1_2); } +static int +test_tls_record_proto_sg_opt_padding_corrupt(void) +{ + struct tls_record_test_flags flags = { + .opt_padding = 8, + .padding_corruption = true, + .nb_segs_in_mbuf = 4, + }; + + return test_tls_record_proto_all(&flags); +} + static int test_dtls_1_2_record_proto_data_walkthrough(void) { @@ -17997,6 +18009,10 @@ static struct unit_test_suite tls12_record_proto_testsuite = { "TLS record SG mode with optional padding > max range", ut_setup_security, ut_teardown, test_tls_record_proto_sg_opt_padding_max), + TEST_CASE_NAMED_ST( + "TLS record SG mode with padding corruption", + ut_setup_security, ut_teardown, + test_tls_record_proto_sg_opt_padding_corrupt), TEST_CASES_END() /**< NULL terminate unit test array */ } }; diff --git a/app/test/test_cryptodev_security_tls_record.c b/app/test/test_cryptodev_security_tls_record.c index 03d9efefc3..1ba9609e1b 100644 --- a/app/test/test_cryptodev_security_tls_record.c +++ b/app/test/test_cryptodev_security_tls_record.c @@ -215,6 +215,13 @@ test_tls_record_td_update(struct tls_record_test_data td_inb[], if (flags->pkt_corruption) td_inb[i].input_text.data[0] = ~td_inb[i].input_text.data[0]; + /* Corrupt a byte in the last but one block */ + if (flags->padding_corruption) { + int offset = td_inb[i].input_text.len - TLS_RECORD_PAD_CORRUPT_OFFSET; + + td_inb[i].input_text.data[offset] = ~td_inb[i].input_text.data[offset]; + } + /* Clear outbound specific flags */ td_inb[i].tls_record_xform.options.iv_gen_disable = 0; } diff --git a/app/test/test_cryptodev_security_tls_record.h b/app/test/test_cryptodev_security_tls_record.h index 18a90c6ff6..acb7f15f1c 100644 --- a/app/test/test_cryptodev_security_tls_record.h +++ b/app/test/test_cryptodev_security_tls_record.h @@ -41,6 +41,7 @@ static_assert(TLS_1_3_RECORD_PLAINTEXT_MAX_LEN <= TEST_SEC_CLEARTEXT_MAX_LEN, "TEST_SEC_CLEARTEXT_MAX_LEN should be at least RECORD MAX LEN!"); #define TLS_RECORD_PLAINTEXT_MIN_LEN (1u) +#define TLS_RECORD_PAD_CORRUPT_OFFSET 20 enum tls_record_test_content_type { TLS_RECORD_TEST_CONTENT_TYPE_APP, From patchwork Thu Jun 20 14:50:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141431 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 54390454AB; Thu, 20 Jun 2024 16:51:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB7A742E91; Thu, 20 Jun 2024 16:51:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7C20242E74 for ; Thu, 20 Jun 2024 16:51:16 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KASfsw027294; Thu, 20 Jun 2024 07:51:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=X ufv25tnPDHyKfuw3ml+oevvUlzlZiyUPzuXt0pBcvQ=; b=fvHqd7xI/ogoJBpQm PG/wEFRKOqEVckLKm/7iz9j7ntYrnZd2mREpRp5x/VgkKmt4PapALRMryunWsj4V t55AKbnJrmYnGfTi0rntxTkRQaEsSUV6z4EQn0vYRdf4aZpFiwrHV14sKIQ+mxK/ SXBHXqj5JMiGCk69E86/yYaiWd6o25SvDxy1lRRHYINu0WmzumMaYm3l/PxFAJ/Y pv0/FPAmZSD8RwWqio6xmcWoRlNHJheI6mfHcVIY2d6qQ+jtKYDMO7+LdOGvQP0v cDrQbIzWvrhSfi0Ev4yAb6NV1Oz1LQt8mUS39HfJ4JgHmBs6XtkyEqKoIzKa/PId b92rw== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yvjq0h1y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:15 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:51:14 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:14 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 168BA3F7081; Thu, 20 Jun 2024 07:51:11 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 5/7] test/crypto: verify padding corruption in DTLS-1.2 Date: Thu, 20 Jun 2024 20:20:54 +0530 Message-ID: <20240620145056.3456650-6-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: LyxJhBtqW6ovda9USVoq9lSnoJTmRjLo X-Proofpoint-GUID: LyxJhBtqW6ovda9USVoq9lSnoJTmRjLo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 From: Vidya Sagar Velumuri Add unit test to verify corrupted padding bytes in DTLS-1.2 record Signed-off-by: Vidya Sagar Velumuri Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index da8d7bf109..dd8880ed87 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12705,6 +12705,19 @@ test_tls_1_3_record_proto_display_list(void) return test_tls_record_proto_all(&flags); } +static int +test_dtls_1_2_record_proto_sg_opt_padding_corrupt(void) +{ + struct tls_record_test_flags flags = { + .opt_padding = 8, + .padding_corruption = true, + .nb_segs_in_mbuf = 4, + .tls_version = RTE_SECURITY_VERSION_DTLS_1_2 + }; + + return test_tls_record_proto_all(&flags); +} + static int test_tls_1_3_record_proto_corrupt_pkt(void) { @@ -18200,6 +18213,10 @@ static struct unit_test_suite dtls12_record_proto_testsuite = { "DTLS record SG mode with optional padding > max range", ut_setup_security, ut_teardown, test_dtls_1_2_record_proto_sg_opt_padding_max), + TEST_CASE_NAMED_ST( + "DTLS record SG mode with padding corruption", + ut_setup_security, ut_teardown, + test_dtls_1_2_record_proto_sg_opt_padding_corrupt), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Thu Jun 20 14:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141432 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 9A1E5454AB; Thu, 20 Jun 2024 16:51:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EF0D42E7A; Thu, 20 Jun 2024 16:51:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9013242E7E for ; Thu, 20 Jun 2024 16:51:19 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KCTgvF011177; Thu, 20 Jun 2024 07:51:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=F o5zPhj6tWar6ZlTL7tHVYHAwyS9gHq3MJtp40J2fxc=; b=GS10QQq0DSYg3wOUO 7zZnT1tzDMvHZcIWi3YS3iSQPeUL4Zlt8uv25UMhC45G/qfVKjtgDgnmylp7bsG+ ec/6laEv97v5Y+XAgUzM48VNZLdh4WGIcAFbZYtLejfFLh/dsgzWTsTAAmBDZhTM qqxwE1OUDZPLf57pkdr7gEZiDIbKdlRzctH4DOalxOzD3kZmROwmqAOt5FQABKbe qcUYZEgmjApcikg6wIZrknrLAVRFhSfHel6aM/zQBlUKYfDHjx4uRV8IvZUutFKc /ntkYIrNzFesyI5HD80HK9f4UgfFvIvMHOOpidsOv6RNYIN4bT+CDso7qcZ+ES2G ZxPmA== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:18 -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.1544.4; Thu, 20 Jun 2024 07:51:17 -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.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:17 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id E46763F708C; Thu, 20 Jun 2024 07:51:14 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 6/7] test/security: add out of place sgl tests for TLS Date: Thu, 20 Jun 2024 20:20:55 +0530 Message-ID: <20240620145056.3456650-7-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: LMHawNh5ZzMbX1e1rk40GGlLXwhcwIqa X-Proofpoint-GUID: LMHawNh5ZzMbX1e1rk40GGlLXwhcwIqa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 multi segmented test for TLS 1.3 and multi segmented out of place tests for DTLS 1.2 and TLS 1.3. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 69 ++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index dd8880ed87..e6ef5a13e0 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12224,11 +12224,11 @@ test_tls_1_2_record_proto_display_list(void) } static int -test_tls_1_2_record_proto_sgl(void) +test_tls_record_proto_sgl(enum rte_security_tls_version tls_version) { struct tls_record_test_flags flags = { .nb_segs_in_mbuf = 5, - .tls_version = RTE_SECURITY_VERSION_TLS_1_2 + .tls_version = tls_version }; struct crypto_testsuite_params *ts_params = &testsuite_params; struct rte_cryptodev_info dev_info; @@ -12242,6 +12242,12 @@ test_tls_1_2_record_proto_sgl(void) return test_tls_record_proto_all(&flags); } +static int +test_tls_1_2_record_proto_sgl(void) +{ + return test_tls_record_proto_sgl(RTE_SECURITY_VERSION_TLS_1_2); +} + static int test_tls_record_proto_sgl_data_walkthrough(enum rte_security_tls_version tls_version) { @@ -12573,20 +12579,7 @@ test_dtls_1_2_record_proto_antireplay4096(void) static int test_dtls_1_2_record_proto_sgl(void) { - struct tls_record_test_flags flags = { - .nb_segs_in_mbuf = 5, - .tls_version = RTE_SECURITY_VERSION_DTLS_1_2 - }; - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_cryptodev_info dev_info; - - rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { - printf("Device doesn't support in-place scatter-gather. Test Skipped.\n"); - return TEST_SKIPPED; - } - - return test_tls_record_proto_all(&flags); + return test_tls_record_proto_sgl(RTE_SECURITY_VERSION_DTLS_1_2); } static int @@ -12595,6 +12588,12 @@ test_dtls_1_2_record_proto_sgl_data_walkthrough(void) return test_tls_record_proto_sgl_data_walkthrough(RTE_SECURITY_VERSION_DTLS_1_2); } +static int +test_dtls_1_2_record_proto_sgl_oop(void) +{ + return test_tls_record_proto_sgl_oop(RTE_SECURITY_VERSION_DTLS_1_2); +} + static int test_dtls_1_2_record_proto_corrupt_pkt(void) { @@ -12811,23 +12810,21 @@ test_tls_1_3_record_proto_data_walkthrough(void) } static int -test_tls_1_3_record_proto_sgl_data_walkthrough(void) +test_tls_1_3_record_proto_sgl(void) { - struct tls_record_test_flags flags = { - .nb_segs_in_mbuf = 5, - .tls_version = RTE_SECURITY_VERSION_TLS_1_3, - .data_walkthrough = true - }; - struct crypto_testsuite_params *ts_params = &testsuite_params; - struct rte_cryptodev_info dev_info; + return test_tls_record_proto_sgl(RTE_SECURITY_VERSION_TLS_1_3); +} - rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { - printf("Device doesn't support in-place scatter-gather. Test Skipped.\n"); - return TEST_SKIPPED; - } +static int +test_tls_1_3_record_proto_sgl_data_walkthrough(void) +{ + return test_tls_record_proto_sgl_data_walkthrough(RTE_SECURITY_VERSION_TLS_1_3); +} - return test_tls_record_proto_all(&flags); +static int +test_tls_1_3_record_proto_sgl_oop(void) +{ + return test_tls_record_proto_sgl_oop(RTE_SECURITY_VERSION_TLS_1_3); } #endif @@ -18145,6 +18142,10 @@ static struct unit_test_suite dtls12_record_proto_testsuite = { "Multi-segmented mode data walkthrough", ut_setup_security, ut_teardown, test_dtls_1_2_record_proto_sgl_data_walkthrough), + TEST_CASE_NAMED_ST( + "Multi-segmented mode out of place", + ut_setup_security, ut_teardown, + test_dtls_1_2_record_proto_sgl_oop), TEST_CASE_NAMED_ST( "Packet corruption", ut_setup_security, ut_teardown, @@ -18286,10 +18287,18 @@ static struct unit_test_suite tls13_record_proto_testsuite = { "Data walkthrough combined test alg list", ut_setup_security, ut_teardown, test_tls_1_3_record_proto_data_walkthrough), + TEST_CASE_NAMED_ST( + "Multi-segmented mode", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_sgl), TEST_CASE_NAMED_ST( "Multi-segmented mode data walkthrough", ut_setup_security, ut_teardown, test_tls_1_3_record_proto_sgl_data_walkthrough), + TEST_CASE_NAMED_ST( + "Multi-segmented mode out of place", + ut_setup_security, ut_teardown, + test_tls_1_3_record_proto_sgl_oop), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Thu Jun 20 14:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 141433 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 47146454AB; Thu, 20 Jun 2024 16:51:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3760842E84; Thu, 20 Jun 2024 16:51:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D39F742E7D for ; Thu, 20 Jun 2024 16:51:21 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45KCTgvG011177; Thu, 20 Jun 2024 07:51:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=k TK0v0lAP5QBOva2PJdg3mK9kmijptzyhns8hg93jhg=; b=hxOqJdv6TKLZwLUbI YubEyUPEKuGDl7snAuSXRdYSZhSBhprNPSOiVkW+twD84H4WFyjzMWv04WrDl9oy /faquhys1oHFJkb/ZgPCgr2SxHmqBAwk4p19qCPohNmg7+wUYpZQUFACynQi7TWC lOOmHwaWlCdP41gMPF9KveKuaACkF/AXqb1UuHUtv1jyQic7eA1pJzhH9J15mZpJ 27vi4E1o0g11cISoGWk/20XoS3yxpg988swguKWdweoD6a/QmeNhyZvYeccNbauI 7bGwM0oyaYIOflInG+Aey6sIxLxp2gktIdNYIDb3NWZeiHIiH4XN0schWAYu0EgL 4D3xg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:20 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 20 Jun 2024 07:51:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 20 Jun 2024 07:51:20 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id C1DE23F7043; Thu, 20 Jun 2024 07:51:17 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 7/7] test/security: use single session in data walkthrough test Date: Thu, 20 Jun 2024 20:20:56 +0530 Message-ID: <20240620145056.3456650-8-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: mFAyOnX8yb24TVZMjyjvcBRX28vEvFIz X-Proofpoint-GUID: mFAyOnX8yb24TVZMjyjvcBRX28vEvFIz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-20_07,2024-06-20_04,2024-05-17_01 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 Existing data walkthrough test creates a new session per each test packet size. Enhance the test to use single session instead. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 49 +++++++++++++++++-- app/test/test_cryptodev_security_tls_record.h | 1 + 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index e6ef5a13e0..75f98b6744 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -11968,9 +11968,12 @@ test_tls_record_proto_process(const struct tls_record_test_data td[], } } - /* Create security session */ - ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, - ts_params->session_mpool); + if (ut_params->sec_session == NULL) { + /* Create security session */ + ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, + ts_params->session_mpool); + } + if (ut_params->sec_session == NULL) return TEST_SKIPPED; @@ -12075,9 +12078,10 @@ test_tls_record_proto_process(const struct tls_record_test_data td[], rte_pktmbuf_free(ut_params->ibuf); ut_params->ibuf = NULL; - if (ut_params->sec_session) + if (ut_params->sec_session != NULL && !flags->skip_sess_destroy) { rte_security_session_destroy(ctx, ut_params->sec_session); - ut_params->sec_session = NULL; + ut_params->sec_session = NULL; + } RTE_SET_USED(flags); @@ -12121,8 +12125,11 @@ static int test_tls_record_proto_all(const struct tls_record_test_flags *flags) { unsigned int i, nb_pkts = 1, pass_cnt = 0, payload_len, max_payload_len; + struct crypto_unittest_params *ut_params = &unittest_params; struct tls_record_test_data td_outb[TEST_SEC_PKTS_MAX]; struct tls_record_test_data td_inb[TEST_SEC_PKTS_MAX]; + void *sec_session_outb = NULL; + void *sec_session_inb = NULL; int ret; switch (flags->tls_version) { @@ -12152,10 +12159,16 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy) + ut_params->sec_session = sec_session_outb; + ret = test_tls_record_proto_process(td_outb, td_inb, nb_pkts, true, flags); if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy && sec_session_outb == NULL) + sec_session_outb = ut_params->sec_session; + if (flags->zero_len && ((flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) || (flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) || @@ -12169,10 +12182,16 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) test_tls_record_td_update(td_inb, td_outb, nb_pkts, flags); + if (flags->skip_sess_destroy) + ut_params->sec_session = sec_session_inb; + ret = test_tls_record_proto_process(td_inb, NULL, nb_pkts, true, flags); if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy && sec_session_inb == NULL) + sec_session_inb = ut_params->sec_session; + if (flags->pkt_corruption || flags->padding_corruption) { if (ret == TEST_SUCCESS) return TEST_FAILED; @@ -12188,6 +12207,22 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) if (flags->display_alg) test_sec_alg_display(sec_alg_list[i].param1, sec_alg_list[i].param2); + if (flags->skip_sess_destroy) { + uint8_t dev_id = testsuite_params.valid_devs[0]; + struct rte_security_ctx *ctx; + + ctx = rte_cryptodev_get_sec_ctx(dev_id); + if (sec_session_inb != NULL) { + rte_security_session_destroy(ctx, sec_session_inb); + sec_session_inb = NULL; + } + if (sec_session_outb != NULL) { + rte_security_session_destroy(ctx, sec_session_outb); + sec_session_outb = NULL; + } + ut_params->sec_session = NULL; + } + pass_cnt++; } @@ -12205,6 +12240,7 @@ test_tls_1_2_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_TLS_1_2; return test_tls_record_proto_all(&flags); @@ -12254,6 +12290,7 @@ test_tls_record_proto_sgl_data_walkthrough(enum rte_security_tls_version tls_ver struct tls_record_test_flags flags = { .nb_segs_in_mbuf = 5, .tls_version = tls_version, + .skip_sess_destroy = true, .data_walkthrough = true }; struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -12430,6 +12467,7 @@ test_dtls_1_2_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_DTLS_1_2; return test_tls_record_proto_all(&flags); @@ -12804,6 +12842,7 @@ test_tls_1_3_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_TLS_1_3; return test_tls_record_proto_all(&flags); diff --git a/app/test/test_cryptodev_security_tls_record.h b/app/test/test_cryptodev_security_tls_record.h index acb7f15f1c..e4a291c153 100644 --- a/app/test/test_cryptodev_security_tls_record.h +++ b/app/test/test_cryptodev_security_tls_record.h @@ -100,6 +100,7 @@ struct tls_record_test_flags { bool zero_len; bool padding_corruption; bool out_of_place; + bool skip_sess_destroy; uint8_t nb_segs_in_mbuf; uint8_t opt_padding; enum rte_security_tls_version tls_version;