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 148FE45AE4; Tue, 8 Oct 2024 17:40:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE1244025C; Tue, 8 Oct 2024 17:40:42 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mails.dpdk.org (Postfix) with ESMTP id C0F0E4021E for ; Tue, 8 Oct 2024 17:40:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728402042; x=1759938042; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=1aaf3BWlhaaQKs3AY7QMmVphnFLl8ll1LGBJARw2OLA=; b=OodEyMBKOAMkkDQ1KF6Qf75rhJh2hs6h9dao5le4G7fluO3Mji8z+6hJ V2fehrQ7VQCKmXU1Qy0KsM48l05WL+ePF5qEG7BrgFbKKhwUVHGGT4oBJ EOWBxm8JjRLxPm2pMjq88qwviUJCX1MiCi5ewzBjgTKKpDAo58zPGvBBh +U9chzSVmbpjICz2fiYFpr3mFs+MpGOnPAM6cxfTeAaWkJVL8EJwRnLpB vngJRGdgogLc0VKksVqY5pUeNX+jnwT/MInSuhSoXSXNqUcCF809S8aFE tU83pZg0ZjLveLm5eT23VfVEizdEqWZp/DpikOWjddZWUhnp4U4664ISG A==; X-CSE-ConnectionGUID: SRSD2ocqQUeiZm5tJ9+ORQ== X-CSE-MsgGUID: lYvRObnCSmm+mSTCcUgTUw== X-IronPort-AV: E=McAfee;i="6700,10204,11219"; a="27496122" X-IronPort-AV: E=Sophos;i="6.11,187,1725346800"; d="scan'208";a="27496122" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2024 08:40:40 -0700 X-CSE-ConnectionGUID: uCeyGRplQX+NHKhxBf8Rpg== X-CSE-MsgGUID: vy/IQCWpRGedm3v48k+GPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,187,1725346800"; d="scan'208";a="75559482" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Oct 2024 08:40:40 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 8 Oct 2024 08:40:39 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 8 Oct 2024 08:40:39 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 8 Oct 2024 08:40:39 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 8 Oct 2024 08:40:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H+HQZGFQ5DPjdFP98t4m+2RUYE/xf4cCpG93DxSbAx+qIzIYPTOcgutNfzCS9rmcZ/DMeAgrjTMObR76DAGlvLzmdeoP8dKFB17pAa1gztyijeuO6LuZ4oifj+ay53/wETFsGT962ZE5mxwWuBtPbxIv30r5EXb3kH0lDeigGk5CZjavPPNUvEuTrt+dcI8PFljqrIzXrJnvlZPOQNgyl10d+aROYugHVwVce4nQEce1EO+e96OoqpYGkYfE0jjsb9BtSEmEDKYAvttPSuRD9E7eu/vLy1MKsOgkJ9QH5lBN0cOSvyCbP0wugA8YVC1259sCieJEu/R7SuSB+0up+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QaqxMu82tcxqklNNDlyenazvm74C/mFLUjnUxw1Zwqo=; b=vCt/s2D4Cjhy973PkHXCBWXNxEicd1o0wGkh/jIOg1ke6c4V7hTGVyVkLd/BSqJix/arNYTuxv6THyw9js9lnWOBCDmwHwqJx8V18FFMTFtKgOgp19XdKt4Gk7wns8UE/OTNfpGAflgIOJEn1Atk4LG+BFL0QcVAF6MOwJhrTfiOANmrNElBq1K75RsFDqd6C6MrhLKyES+MfcZQfO9WVmUDi2j+0VRVzyTc60H1l+H4QAKw74udf+3e0kcs1c/h4K6Y8flBNtkC0ptKiiASvL6FBv9iKikzjvaO8WyvLic9HASw3udSDfBZ5kgoOkAm66FF4MOZSu4yeZhZ34nxYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SJ0PR11MB5056.namprd11.prod.outlook.com (2603:10b6:a03:2d5::6) by SA0PR11MB4622.namprd11.prod.outlook.com (2603:10b6:806:9c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 15:40:36 +0000 Received: from SJ0PR11MB5056.namprd11.prod.outlook.com ([fe80::4f35:279e:a725:ad08]) by SJ0PR11MB5056.namprd11.prod.outlook.com ([fe80::4f35:279e:a725:ad08%3]) with mapi id 15.20.8048.013; Tue, 8 Oct 2024 15:40:35 +0000 From: "Dooley, Brian" To: "Kusztal, ArkadiuszX" , "dev@dpdk.org" CC: "gakhil@marvell.com" Subject: RE: [PATCH v3 4/4] app/test: add test sm2 C1/Kp test cases Thread-Topic: [PATCH v3 4/4] app/test: add test sm2 C1/Kp test cases Thread-Index: AQHbGVXcBy0JYLvMckCamtxcPGhd6LJ8/YgQ Date: Tue, 8 Oct 2024 15:40:35 +0000 Message-ID: References: <20240929172912.87859-1-arkadiuszx.kusztal@intel.com> <20241008062845.11071-1-arkadiuszx.kusztal@intel.com> <20241008062845.11071-4-arkadiuszx.kusztal@intel.com> In-Reply-To: <20241008062845.11071-4-arkadiuszx.kusztal@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR11MB5056:EE_|SA0PR11MB4622:EE_ x-ms-office365-filtering-correlation-id: 2b8a7a31-e71e-422e-f39f-08dce7af8d7c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?smB4XrOqccMX1TYfdD84mJJK97rjqxHjDXVgkuX8gWJZPQEgwSf3N81CrUfH?= =?us-ascii?Q?kfhk7mAG/nE3WxZ0URWMk7H6tpZvVZ9ZT0tUoD1JEghQT/+8HX2+ozIkYCqY?= =?us-ascii?Q?cD54zNLa/oimeFhtZAAk3G3Tq8XhNJJG6OPly+EN/fvyC3v9QKpQNMcyWQVe?= =?us-ascii?Q?VirMnvShvClJLcdE8Q5zsaEteOTwuirIaIiDQvoXrd1uuziem8dUkazuExVo?= =?us-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kEu2zNnT7ZdFNLJ3/hr1Oh?= =?us-ascii?Q?N/2xjoirl5r/gHdYeWpLMepwpSV+99ONlOgswQR5K/BrCE4QpQxOD8SZ0pmM?= =?us-ascii?Q?YqMECn69yx/4714zg03Q4Js1eKP0EGAPRUuRICX/FQDIIDxxX+HpAxZ4GmlS?= =?us-ascii?Q?GrEM5jI2IYCDKydF5jzi9EAPm84cqXV0S2BITNaIi6drbmai2GExT/EiEe2X?= =?us-ascii?Q?yVciFSCVWVU9qHYmczklNv1c2z73Mkx04giwf++CeeB01g=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5056.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uJKHogrlZYEba3BFW/VdLjNj4dvBcTOFxFTBDsETYkNFVjCsKaBjEVJJ5tgk?= =?us-ascii?Q?MAloGSx8X3AjH2OVYerb5iMc2flDvPQ8qF7nx3cCaNzZp4uy0mXHDPjyof8o?= =?us-ascii?Q?7quH87+4nB58Yz4fclUsLCR6TPffc+091sCcQmjCz6bS/naylkR5F47T73uO?= =?us-ascii?Q?/REnPiCU8fgJJMiL1G9JOeDOJnQaC++w4At7FK2JYVO0bOU0dY5NH24DpM4Y?= =?us-ascii?Q?+D2VFrZ+rTMbkBqCzaHQ9mtYb67SK7CkyHt+cSVvd6WNjKFHKf/RVIS38Zs5?= =?us-ascii?Q?c1AtPptt+SVyDuiwWnPNkyM1ajW0FzqtB1I9CeVLmocGuG11zYxVCsbGYpzy?= =?us-ascii?Q?xlRZuiiPOuC9F4vos9k/nKdW+nYooTO5ooehlcnD80xbHy0yKrnspbwdwPgU?= =?us-ascii?Q?B8bdZF409nTQFtFvyEsjp8GLkM+rrVtXa0TYV2l3y/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Gzw6Dwz76Oj/yA4dpnJeCEdJgOtTTIpmCbkei7Etupl1eOX6J?= =?us-ascii?Q?+Huo9KOAYLw9W+jZAK/7XBw5a6IHUmrSM4L29VuDc9hvO+dsKyXLAJQilo2k?= =?us-ascii?Q?94WA0AITc74Q0Evl9ql4gVY5Y+rQz9wfVUcEwNphxiHRFO+XhshpUHEDni7l?= =?us-ascii?Q?zLu+6Qd2IecZKO+KdlVcz5/7WVHJxbkR/6QTEZGb+o1/sjNMp0BCbO7RxSAy?= =?us-ascii?Q?84SWnSf5n+wmweijEcDpjbajUVzVotC0JyzB1Sg0?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5056.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b8a7a31-e71e-422e-f39f-08dce7af8d7c X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2024 15:40:35.8620 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QS3c6D6wSec8wrVL0v7FTq1Ut3z9M4NSCTnd4NWh/e+xlsIIVzG4OvIe6S+Ex9ZVJYvJ3fQHvX+U2c8SuSVwWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4622 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Kusztal, ArkadiuszX > Sent: Tuesday, October 8, 2024 7:29 AM > To: dev@dpdk.org > Cc: gakhil@marvell.com; Dooley, Brian ; Kusztal, > ArkadiuszX > Subject: [PATCH v3 4/4] app/test: add test sm2 C1/Kp test cases >=20 > This commit adds tests cases to be used when C1 or kP elliptic curve poin= ts > need to be computed. >=20 > Signed-off-by: Arkadiusz Kusztal > --- > app/test/test_cryptodev_asym.c | 148 > ++++++++++++++++++++++++++++- > app/test/test_cryptodev_sm2_test_vectors.h | 112 > +++++++++++++++++++++- > 2 files changed, 256 insertions(+), 4 deletions(-) >=20 > diff --git a/app/test/test_cryptodev_asym.c > b/app/test/test_cryptodev_asym.c index f0b5d38543..cb28179562 100644 > --- a/app/test/test_cryptodev_asym.c > +++ b/app/test/test_cryptodev_asym.c > @@ -2635,6 +2635,8 @@ test_sm2_sign(void) > asym_op->sm2.k.data =3D input_params.k.data; > asym_op->sm2.k.length =3D input_params.k.length; > } > + asym_op->sm2.k.data =3D input_params.k.data; > + asym_op->sm2.k.length =3D input_params.k.length; >=20 > /* Init out buf */ > asym_op->sm2.r.data =3D output_buf_r; > @@ -3184,7 +3186,7 @@ static int send_one(void) > ticks++; > if (ticks >=3D DEQ_TIMEOUT) { > RTE_LOG(ERR, USER1, > - "line %u FAILED: Cannot dequeue the crypto > op on device %d", > + "line %u FAILED: Cannot dequeue the crypto > op on device, timeout > +%d", > __LINE__, params->valid_devs[0]); > return TEST_FAILED; > } > @@ -3489,6 +3491,142 @@ kat_rsa_decrypt_crt(const void *data) > return 0; > } >=20 > +static int > +test_sm2_partial_encryption(const void *data) { > + struct rte_crypto_asym_xform xform =3D { 0 }; > + const uint8_t dev_id =3D params->valid_devs[0]; > + const struct crypto_testsuite_sm2_params *test_vector =3D data; > + uint8_t result_C1_x1[TEST_DATA_SIZE] =3D { 0 }; > + uint8_t result_C1_y1[TEST_DATA_SIZE] =3D { 0 }; > + uint8_t result_kP_x1[TEST_DATA_SIZE] =3D { 0 }; > + uint8_t result_kP_y1[TEST_DATA_SIZE] =3D { 0 }; > + const struct rte_cryptodev_asymmetric_xform_capability *capa; > + struct rte_cryptodev_asym_capability_idx idx; > + struct rte_cryptodev_info dev_info; > + > + rte_cryptodev_info_get(dev_id, &dev_info); > + if (!(dev_info.feature_flags & > + RTE_CRYPTODEV_FF_ASYM_PARTIAL_SM2)) { > + RTE_LOG(INFO, USER1, > + "Device doesn't support partial SM2. Test > Skipped\n"); > + return TEST_SKIPPED; > + } > + > + idx.type =3D RTE_CRYPTO_ASYM_XFORM_SM2; > + capa =3D rte_cryptodev_asym_capability_get(dev_id, &idx); > + if (capa =3D=3D NULL) > + return TEST_SKIPPED; > + > + xform.xform_type =3D RTE_CRYPTO_ASYM_XFORM_SM2; > + xform.ec.curve_id =3D RTE_CRYPTO_EC_GROUP_SM2; > + xform.ec.q =3D test_vector->pubkey; > + self->op->asym->sm2.op_type =3D RTE_CRYPTO_ASYM_OP_ENCRYPT; > + self->op->asym->sm2.k =3D test_vector->k; > + if (rte_cryptodev_asym_session_create(dev_id, &xform, > + params->session_mpool, &self->sess) < 0) { > + RTE_LOG(ERR, USER1, "line %u FAILED: Session creation > failed", > + __LINE__); > + return TEST_FAILED; > + } > + rte_crypto_op_attach_asym_session(self->op, self->sess); > + > + self->op->asym->sm2.C1.x.data =3D result_C1_x1; > + self->op->asym->sm2.C1.y.data =3D result_C1_y1; > + self->op->asym->sm2.kP.x.data =3D result_kP_x1; > + self->op->asym->sm2.kP.y.data =3D result_kP_y1; > + TEST_ASSERT_SUCCESS(send_one(), > + "Failed to process crypto op"); > + > + debug_hexdump(stdout, "C1[x]", self->op->asym->sm2.C1.x.data, > + self->op->asym->sm2.C1.x.length); > + debug_hexdump(stdout, "C1[y]", self->op->asym->sm2.C1.y.data, > + self->op->asym->sm2.C1.y.length); > + debug_hexdump(stdout, "kP[x]", self->op->asym->sm2.kP.x.data, > + self->op->asym->sm2.kP.x.length); > + debug_hexdump(stdout, "kP[y]", self->op->asym->sm2.kP.y.data, > + self->op->asym->sm2.kP.y.length); > + > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->C1.x.data, > + self->op->asym->sm2.C1.x.data, > + test_vector->C1.x.length, > + "Incorrect value of C1[x]\n"); > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->C1.y.data, > + self->op->asym->sm2.C1.y.data, > + test_vector->C1.y.length, > + "Incorrect value of C1[y]\n"); > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.x.data, > + self->op->asym->sm2.kP.x.data, > + test_vector->kP.x.length, > + "Incorrect value of kP[x]\n"); > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.y.data, > + self->op->asym->sm2.kP.y.data, > + test_vector->kP.y.length, > + "Incorrect value of kP[y]\n"); > + > + return TEST_SUCCESS; > +} > + > +static int > +test_sm2_partial_decryption(const void *data) { > + struct rte_crypto_asym_xform xform =3D {}; > + const uint8_t dev_id =3D params->valid_devs[0]; > + const struct crypto_testsuite_sm2_params *test_vector =3D data; > + uint8_t result_kP_x1[TEST_DATA_SIZE] =3D { 0 }; > + uint8_t result_kP_y1[TEST_DATA_SIZE] =3D { 0 }; > + const struct rte_cryptodev_asymmetric_xform_capability *capa; > + struct rte_cryptodev_asym_capability_idx idx; > + struct rte_cryptodev_info dev_info; > + > + rte_cryptodev_info_get(dev_id, &dev_info); > + if (!(dev_info.feature_flags & > + RTE_CRYPTODEV_FF_ASYM_PARTIAL_SM2)) { > + RTE_LOG(INFO, USER1, > + "Device doesn't support partial SM2. Test > Skipped\n"); > + return TEST_SKIPPED; > + } > + > + idx.type =3D RTE_CRYPTO_ASYM_XFORM_SM2; > + capa =3D rte_cryptodev_asym_capability_get(dev_id, &idx); > + if (capa =3D=3D NULL) > + return TEST_SKIPPED; > + > + xform.xform_type =3D RTE_CRYPTO_ASYM_XFORM_SM2; > + xform.ec.pkey =3D test_vector->pkey; > + self->op->asym->sm2.op_type =3D RTE_CRYPTO_ASYM_OP_DECRYPT; > + self->op->asym->sm2.C1 =3D test_vector->C1; > + > + if (rte_cryptodev_asym_session_create(dev_id, &xform, > + params->session_mpool, &self->sess) < 0) { > + RTE_LOG(ERR, USER1, "line %u FAILED: Session creation > failed", > + __LINE__); > + return TEST_FAILED; > + } > + rte_crypto_op_attach_asym_session(self->op, self->sess); > + > + self->op->asym->sm2.kP.x.data =3D result_kP_x1; > + self->op->asym->sm2.kP.y.data =3D result_kP_y1; > + TEST_ASSERT_SUCCESS(send_one(), > + "Failed to process crypto op"); > + > + debug_hexdump(stdout, "kP[x]", self->op->asym->sm2.kP.x.data, > + self->op->asym->sm2.C1.x.length); > + debug_hexdump(stdout, "kP[y]", self->op->asym->sm2.kP.y.data, > + self->op->asym->sm2.C1.y.length); > + > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.x.data, > + self->op->asym->sm2.kP.x.data, > + test_vector->kP.x.length, > + "Incorrect value of kP[x]\n"); > + TEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.y.data, > + self->op->asym->sm2.kP.y.data, > + test_vector->kP.y.length, > + "Incorrect value of kP[y]\n"); > + > + return 0; > +} > + > static struct unit_test_suite cryptodev_openssl_asym_testsuite =3D { > .suite_name =3D "Crypto Device OPENSSL ASYM Unit Test Suite", > .setup =3D testsuite_setup, > @@ -3553,6 +3691,14 @@ static struct unit_test_suite > cryptodev_qat_asym_testsuite =3D { > .teardown =3D testsuite_teardown, > .unit_test_cases =3D { > TEST_CASE_NAMED_WITH_DATA( > + "SM2 encryption - test case 1", > + ut_setup_asym, ut_teardown_asym, > + test_sm2_partial_encryption, &sm2_enc_hw_t1), > + TEST_CASE_NAMED_WITH_DATA( > + "SM2 decryption - test case 1", > + ut_setup_asym, ut_teardown_asym, > + test_sm2_partial_decryption, &sm2_enc_hw_t1), > + TEST_CASE_NAMED_WITH_DATA( > "Modular Exponentiation (mod=3D128, base=3D20, exp=3D3, > res=3D128)", > ut_setup_asym, ut_teardown_asym, > modular_exponentiation, > &modex_test_case_m128_b20_e3), diff --git > a/app/test/test_cryptodev_sm2_test_vectors.h > b/app/test/test_cryptodev_sm2_test_vectors.h > index 41f5f7074a..92f7e77671 100644 > --- a/app/test/test_cryptodev_sm2_test_vectors.h > +++ b/app/test/test_cryptodev_sm2_test_vectors.h > @@ -8,19 +8,125 @@ > #include "rte_crypto_asym.h" >=20 > struct crypto_testsuite_sm2_params { > - rte_crypto_param pubkey_qx; > - rte_crypto_param pubkey_qy; > + union { > + struct { > + rte_crypto_param pubkey_qx; > + rte_crypto_param pubkey_qy; > + }; > + struct rte_crypto_ec_point pubkey; > + }; > rte_crypto_param pkey; > rte_crypto_param k; > rte_crypto_param sign_r; > rte_crypto_param sign_s; > rte_crypto_param id; > - rte_crypto_param cipher; > + union { > + rte_crypto_param cipher; > + struct { > + struct rte_crypto_ec_point C1; > + struct rte_crypto_ec_point kP; > + }; > + }; > rte_crypto_param message; > rte_crypto_param digest; > int curve; > }; >=20 > +uint8_t sm2_enc_pub_x_t1[] =3D { > + 0x26, 0xf1, 0xf3, 0xef, 0x12, 0x27, 0x85, 0xd1, > + 0x7d, 0x38, 0x70, 0xc2, 0x43, 0x46, 0x50, 0x36, > + 0x3f, 0xdf, 0x4b, 0x2f, 0x45, 0x0e, 0x8e, 0xd1, > + 0xb6, 0x0f, 0xdc, 0x1f, 0xc6, 0xf0, 0x19, 0xab }; uint8_t > +sm2_enc_pub_y_t1[] =3D { > + 0xd9, 0x19, 0x8b, 0xdb, 0xef, 0xa5, 0x84, 0x76, > + 0xec, 0x82, 0x25, 0x12, 0x5b, 0x8c, 0xe3, 0xe1, > + 0x0a, 0x10, 0x0d, 0xc6, 0x97, 0x6c, 0xc1, 0x89, > + 0xd9, 0x6d, 0xa6, 0x88, 0x9e, 0xbc, 0xd3, 0x7a }; uint8_t sm2_k_t1[] > =3D > +{ > + 0x12, 0x34, 0x56, 0x78, 0xB9, 0x6E, 0x5A, 0xF7, > + 0x0B, 0xD4, 0x80, 0xB4, 0x72, 0x40, 0x9A, 0x9A, > + 0x32, 0x72, 0x57, 0xF1, 0xEB, 0xB7, 0x3F, 0x5B, > + 0x07, 0x33, 0x54, 0xB2, 0x48, 0x66, 0x85, 0x63 }; > + > +uint8_t sm2_C1_x_t1[] =3D { > + 0x15, 0xf6, 0xb7, 0x49, 0x00, 0x39, 0x73, 0x9d, > + 0x5b, 0xb3, 0xd3, 0xe9, 0x1d, 0xe4, 0xc8, 0xbd, > + 0x08, 0xe3, 0x6a, 0x22, 0xff, 0x1a, 0xbf, 0xdc, > + 0x75, 0x6b, 0x12, 0x85, 0x81, 0xc5, 0x8b, 0xcf }; > + > +uint8_t sm2_C1_y_t1[] =3D { > + 0x6a, 0x92, 0xd4, 0xd8, 0x13, 0xec, 0x8f, 0x9a, > + 0x9d, 0xbe, 0x51, 0x47, 0x6f, 0x54, 0xc5, 0x41, > + 0x98, 0xf5, 0x5f, 0x83, 0xce, 0x1c, 0x18, 0x1a, > + 0x48, 0xbd, 0xeb, 0x38, 0x13, 0x67, 0x0d, 0x06 }; > + > +uint8_t sm2_kP_x_t1[] =3D { > + 0x6b, 0xfb, 0x9a, 0xcb, 0xc6, 0xb6, 0x36, 0x31, > + 0x0f, 0xd1, 0xdd, 0x9c, 0x9f, 0x17, 0x5f, 0x3f, > + 0x68, 0x13, 0x96, 0xd2, 0x54, 0x5b, 0xa6, 0x19, > + 0x78, 0x1f, 0x87, 0x3d, 0x81, 0xc3, 0x21, 0x01 }; > + > +uint8_t sm2_kP_y_t1[] =3D { > + 0xa4, 0x08, 0xf3, 0x74, 0x35, 0x51, 0x8c, 0x81, > + 0x06, 0x4c, 0x8f, 0x31, 0x49, 0xe3, 0x5b, 0x4d, > + 0xfc, 0x3d, 0x19, 0xac, 0x7d, 0x07, 0xd0, 0x9a, > + 0x99, 0x5a, 0x25, 0x16, 0x66, 0xff, 0x41, 0x3c }; > + > +uint8_t sm2_kP_d_t1[] =3D { > + 0x6F, 0xCB, 0xA2, 0xEF, 0x9A, 0xE0, 0xAB, 0x90, > + 0x2B, 0xC3, 0xBD, 0xE3, 0xFF, 0x91, 0x5D, 0x44, > + 0xBA, 0x4C, 0xC7, 0x8F, 0x88, 0xE2, 0xF8, 0xE7, > + 0xF8, 0x99, 0x6D, 0x3B, 0x8C, 0xCE, 0xED, 0xEE }; > + > +struct crypto_testsuite_sm2_params sm2_enc_hw_t1 =3D { > + .k =3D { > + .data =3D sm2_k_t1, > + .length =3D sizeof(sm2_k_t1) > + }, > + .pubkey =3D { > + .x =3D { > + .data =3D sm2_enc_pub_x_t1, > + .length =3D sizeof(sm2_enc_pub_x_t1) > + }, > + .y =3D { > + .data =3D sm2_enc_pub_y_t1, > + .length =3D sizeof(sm2_enc_pub_y_t1) > + } > + }, > + .C1 =3D { > + .x =3D { > + .data =3D sm2_C1_x_t1, > + .length =3D sizeof(sm2_C1_x_t1) > + }, > + .y =3D { > + .data =3D sm2_C1_y_t1, > + .length =3D sizeof(sm2_C1_y_t1) > + } > + }, > + .kP =3D { > + .x =3D { > + .data =3D sm2_kP_x_t1, > + .length =3D sizeof(sm2_kP_x_t1) > + }, > + .y =3D { > + .data =3D sm2_kP_y_t1, > + .length =3D sizeof(sm2_kP_y_t1) > + } > + }, > + .pkey =3D { > + .data =3D sm2_kP_d_t1, > + .length =3D sizeof(sm2_kP_d_t1) > + } > +}; > + > static uint8_t fp256_pkey[] =3D { > 0x77, 0x84, 0x35, 0x65, 0x4c, 0x7a, 0x6d, 0xb1, > 0x1e, 0x63, 0x0b, 0x41, 0x97, 0x36, 0x04, 0xf4, > -- > 2.13.6 Series-Acked-by: Brian Dooley