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 52CBB4301B; Thu, 10 Aug 2023 11:36:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32AD743260; Thu, 10 Aug 2023 11:35:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0E06343261 for ; Thu, 10 Aug 2023 11:35:48 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37A57QG9014710; Thu, 10 Aug 2023 02:35:48 -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=n/gEhMzpNUU0BbdPG/XWwgPW8abwl5ysOtGfrz0Su2k=; b=Y8txYtlbB/MmTigB3za0qbB+N2s7YULCHUoINf3JvVj1rOcrzgO3ZYThZ/MjZsCSzg6a Sfr/z5i+ANiAIxRYwSrNJG5A/8OVUXU/eFKSTdzkCIGU1ElZmouVreUEJTsJbdOTZTKo 79WHLPBH3lHU/AXv5DbljAWATp9p0iemE4bunuelS43g1j6mZwyJK25TEyPAqrL9yQ+E ssVdOomcNGURTdqpMZ4pq0LY4+TuVqdXIBdlZo802EnKV8qc+se6QopPmTlRX8BHw+2/ aMgv0PVASC+b3Uumy+YSnjH909bxx0RJbBQi8i9+2q+BzXuCL7QfqefrtW0qaRVxgQ21 tQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sc57snqrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 02:35:48 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 10 Aug 2023 02:35:46 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 10 Aug 2023 02:35:46 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id 30AD73F705B; Thu, 10 Aug 2023 02:35:43 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , Akhil Goyal , Fan Zhang , Kai Ji , "Gowrishankar Muthukrishnan" Subject: [v1 4/6] cryptodev: use generic EC xform params for SM2 Date: Thu, 10 Aug 2023 15:05:26 +0530 Message-ID: <463ed192eecb0f45116b4487741039d16f5e3aea.1691658879.git.gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: K_I_0RudpivI6Lq3zfFbbFZa7L_VJ-nD X-Proofpoint-ORIG-GUID: K_I_0RudpivI6Lq3zfFbbFZa7L_VJ-nD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_09,2023-08-09_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 Now, generic EC xform parameters include hash algorithm field. Hence, SM2 curve can use this generic struct for setting hash algorithm, which would also require SM2 curve ID enumerated along with other curves, as listed in: https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_cryptodev_asym.c | 12 ++++++++---- app/test/test_cryptodev_sm2_test_vectors.h | 4 +++- doc/guides/rel_notes/release_23_11.rst | 2 ++ drivers/crypto/openssl/rte_openssl_pmd_ops.c | 2 +- lib/cryptodev/rte_crypto_asym.h | 16 ++-------------- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 0ef2642fdd..b08772a9bf 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -1838,7 +1838,8 @@ _test_sm2_sign(bool rnd_secret) /* Setup asym xform */ xform.next = NULL; xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; + xform.ec.curve_id = input_params.curve; + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess); if (ret < 0) { @@ -2019,7 +2020,8 @@ test_sm2_verify(void) /* Setup asym xform */ xform.next = NULL; xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; + xform.ec.curve_id = input_params.curve; + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess); if (ret < 0) { @@ -2120,7 +2122,8 @@ _test_sm2_enc(bool rnd_secret) /* Setup asym xform */ xform.next = NULL; xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; + xform.ec.curve_id = input_params.curve; + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess); if (ret < 0) { @@ -2299,7 +2302,8 @@ test_sm2_dec(void) /* Setup asym xform */ xform.next = NULL; xform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2; - xform.sm2.hash = RTE_CRYPTO_AUTH_SM3; + xform.ec.curve_id = input_params.curve; + xform.ec.hash = RTE_CRYPTO_AUTH_SM3; ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mpool, &sess); if (ret < 0) { diff --git a/app/test/test_cryptodev_sm2_test_vectors.h b/app/test/test_cryptodev_sm2_test_vectors.h index 7a4ce70c10..3d2dba1359 100644 --- a/app/test/test_cryptodev_sm2_test_vectors.h +++ b/app/test/test_cryptodev_sm2_test_vectors.h @@ -17,6 +17,7 @@ struct crypto_testsuite_sm2_params { rte_crypto_param id; rte_crypto_param cipher; rte_crypto_param message; + int curve; }; static uint8_t fp256_pkey[] = { @@ -123,7 +124,8 @@ struct crypto_testsuite_sm2_params sm2_param_fp256 = { .cipher = { .data = fp256_cipher, .length = sizeof(fp256_cipher), - } + }, + .curve = RTE_CRYPTO_EC_GROUP_SM2 }; #endif /* __TEST_CRYPTODEV_SM2_TEST_VECTORS_H__ */ diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst index 4411bb32c1..23c89e8ea9 100644 --- a/doc/guides/rel_notes/release_23_11.rst +++ b/doc/guides/rel_notes/release_23_11.rst @@ -91,6 +91,8 @@ Removed Items * kni: Removed the Kernel Network Interface (KNI) library and driver. +* crypto: Removed SM2 xform parameter in asymmetric xform. + API Changes ----------- diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c index 0b3601db40..e521c0c830 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -1307,7 +1307,7 @@ static int openssl_set_asym_session_parameters( OSSL_PARAM *params = NULL; int ret = -1; - if (xform->sm2.hash != RTE_CRYPTO_AUTH_SM3) + if (xform->ec.hash != RTE_CRYPTO_AUTH_SM3) return -1; param_bld = OSSL_PARAM_BLD_new(); diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h index 51f5476c6e..9b68c3f5e2 100644 --- a/lib/cryptodev/rte_crypto_asym.h +++ b/lib/cryptodev/rte_crypto_asym.h @@ -69,7 +69,8 @@ enum rte_crypto_curve_id { RTE_CRYPTO_EC_GROUP_SECP224R1 = 21, RTE_CRYPTO_EC_GROUP_SECP256R1 = 23, RTE_CRYPTO_EC_GROUP_SECP384R1 = 24, - RTE_CRYPTO_EC_GROUP_SECP521R1 = 25 + RTE_CRYPTO_EC_GROUP_SECP521R1 = 25, + RTE_CRYPTO_EC_GROUP_SM2 = 41, }; /** @@ -382,16 +383,6 @@ struct rte_crypto_ec_xform { /**< Hash algorithm used in EC op. */ }; -/** - * Asymmetric SM2 transform data. - * - * Structure describing SM2 xform params. - */ -struct rte_crypto_sm2_xform { - enum rte_crypto_auth_algorithm hash; - /**< Hash algorithm used in SM2 op. */ -}; - /** * Operations params for modular operations: * exponentiation and multiplicative inverse @@ -649,9 +640,6 @@ struct rte_crypto_asym_xform { /**< EC xform parameters, used by elliptic curve based * operations. */ - - struct rte_crypto_sm2_xform sm2; - /**< SM2 xform parameters */ }; }; -- 2.25.1