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 692D0454B2; Fri, 21 Jun 2024 04:39:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 43E1D42ECC; Fri, 21 Jun 2024 04:39:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 61ADD42EC8 for ; Fri, 21 Jun 2024 04:39:01 +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 45KH7kkS024744; Thu, 20 Jun 2024 19:39:00 -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=A kC2aRnbZOuZm4JAontR7iyQXICb7Oxt8VlRyRGqdJo=; b=Ta4cAI6+lSLiz/7gY NlqCg14HtqN8mMdsMxKAoH6q7R8qNJEERFK+xU9GjyMZb1LbW4eWNTit8brJqhTa MGpRI0S/+ALCb6xKt7AtWRTzQWH4BXImoi7zTGVXkWqtEUpmkU3OUXNtvMIA7Qwi 84E4zQWHHosovVnVknlIlLmGbKj6dio2W8P7ox0kV68YcLZhGSvQq4lUVoje4UcF Yw5JJY6u9R1xoil/kasDhQ/iDcBPIccqfl15lobaEihnvvKaDpEOvkY9hakNaqLv 6F6tBVno2i5j+Crjfwfwb+3pE7fakZ5Rwo1+MWCyvXsuUtj0NjATGs8mW++9hbCn ZIorg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvrj7a04h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 19:39:00 -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 19:38:59 -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 19:38:59 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id 1FA2C3F7082; Thu, 20 Jun 2024 19:38:56 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Fan Zhang CC: Anoob Joseph , Gowrishankar Muthukrishnan Subject: [PATCH v2 4/4] test/crypto: add modex tests for zero padded operands Date: Fri, 21 Jun 2024 08:08:29 +0530 Message-ID: <20240621023832.1707-5-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240621023832.1707-1-gmuthukrishn@marvell.com> References: <20240616044223.2841-1-gmuthukrishn@marvell.com> <20240621023832.1707-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: DLbR8x9lSHNs16Bnnorj296aUaQZ9Lu_ X-Proofpoint-ORIG-GUID: DLbR8x9lSHNs16Bnnorj296aUaQZ9Lu_ 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_12,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 modex tests for zero padded operands, as in ASN encoding. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_cryptodev_asym.c | 16 +++++ app/test/test_cryptodev_mod_test_vectors.h | 71 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 32fb198f96..26afa082af 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -3518,6 +3518,14 @@ static struct unit_test_suite cryptodev_openssl_asym_testsuite = { "Modex test", ut_setup_asym, ut_teardown_asym, modular_exponentiation, &modex_test_cases[0]), + TEST_CASE_NAMED_WITH_DATA( + "Modex test for zero padding", + ut_setup_asym, ut_teardown_asym, + modular_exponentiation, &modex_test_cases[1]), + TEST_CASE_NAMED_WITH_DATA( + "Modex test for zero padding (2)", + ut_setup_asym, ut_teardown_asym, + modular_exponentiation, &modex_test_cases[2]), TEST_CASE_NAMED_WITH_DATA( "Modex Group 5 test", ut_setup_asym, ut_teardown_asym, @@ -3596,6 +3604,14 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { "Modex test", ut_setup_asym, ut_teardown_asym, modular_exponentiation, &modex_test_cases[0]), + TEST_CASE_NAMED_WITH_DATA( + "Modex test for zero padding", + ut_setup_asym, ut_teardown_asym, + modular_exponentiation, &modex_test_cases[1]), + TEST_CASE_NAMED_WITH_DATA( + "Modex test for zero padding (2)", + ut_setup_asym, ut_teardown_asym, + modular_exponentiation, &modex_test_cases[2]), TEST_CASE_NAMED_WITH_DATA( "Modex Group 5 test", ut_setup_asym, ut_teardown_asym, diff --git a/app/test/test_cryptodev_mod_test_vectors.h b/app/test/test_cryptodev_mod_test_vectors.h index e7b930b765..9a7f3e710b 100644 --- a/app/test/test_cryptodev_mod_test_vectors.h +++ b/app/test/test_cryptodev_mod_test_vectors.h @@ -327,6 +327,77 @@ modex_test_data modex_test_cases[] = { }, .len = 129 } +}, +{ + .description = "Modular Exponentiation (mod=20, base=20, exp=12, res=18)", + .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, + .base = { + .data = { + 0x00, 0x00, 0x45, 0xCA, 0x2C, 0x5C, 0x3A, 0x90, + 0x00, 0xC4, 0xD7, 0x47, 0xA8, 0x2B, 0x12, 0x07, + 0xBD, 0x1F, 0xD7, 0x81 + }, + .len = 20 + }, + .exponent = { + .data = { + 0x00, 0x00, 0x00, 0x75, 0x74, 0x19, 0x19, 0x69, + 0xBF, 0x15, 0x2A, 0xAC + }, + .len = 12 + }, + .reminder = { + .data = { + 0x5c, 0x94, 0x8f, 0x00, 0x79, 0xe3, 0xe1, 0x0b, + 0x3f, 0x3e, 0x36, 0x75, 0xed, 0x1d, 0x84, 0xc6, + 0x36, 0x9e + }, + .len = 18 + }, + .modulus = { + .data = { + 0x00, 0x00, 0x99, 0x28, 0x09, 0x8A, 0xE9, 0x89, + 0xBB, 0x81, 0x3B, 0x07, 0x0E, 0x31, 0x00, 0x7F, + 0x79, 0x97, 0xED, 0x35 + }, + .len = 20 + } +}, +{ + .description = "Modular Exponentiation (mod=32, base=20, exp=12, res=17)", + .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX, + .base = { + .data = { + 0x01, 0x31, 0x72, 0xFB, 0x81, 0x9D, 0x81, 0x7A, + 0x91, 0xDC, 0xE6, 0x6C, 0x2D, 0x55, 0xD9, 0x25, + 0x7A, 0xB2, 0xFF, 0xFF + }, + .len = 20 + }, + .exponent = { + .data = { + 0x00, 0x00, 0x00, 0x02, 0x36, 0x38, 0x31, 0x47, + 0x3C, 0x07, 0x36, 0x21 + }, + .len = 12 + }, + .reminder = { + .data = { + 0x02, 0x99, 0x2F, 0xE3, 0x00, 0x9F, 0xF0, 0x9E, + 0x65, 0x3C, 0x0B, 0x4A, 0xD3, 0x1B, 0x7C, 0x7F, + 0x1C + }, + .len = 17 + }, + .modulus = { + .data = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0xCE, 0xF0, 0x7C, 0x13, 0x26, 0x90, 0xAF, 0x49, + 0x06, 0x4D, 0xA4, 0x5C, 0xB2, 0x43, 0x13, 0x25, + }, + .len = 32 + } } }; -- 2.25.1