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 BD72C45AEE; Wed, 9 Oct 2024 09:12:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2445940DD6; Wed, 9 Oct 2024 09:12:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DDC7740DCB for ; Wed, 9 Oct 2024 09:12:07 +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 498JMA1k007557; Wed, 9 Oct 2024 00:12:06 -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 dNjw+6OagceSNQ/NYGOIYiWtbI0Wrm3TPe3ON/DPj4=; b=c9DnGVxOsaWpj4cx8 yGuE71Xn1AqKiDVlQt5/2tSGPwc4INqCzBKdhAxrFqsEWhbLNg4PRdLsFD+gRqBB sXeXiAH+NI36fARy54y3bm63iBV366/jDniPT9yZAmSITDHH+YV5oa69/zr/Qp1A g5nt/kFMbIP4WvgomlGTz4ORo+KQ8d3HD92zrehI9sTSnnNZEPvQVPzlb+SxoR4d P4a2ERlsn+AbcjRwPBFfDvDqBGfjz3AULp/3tXWYEIgHxDh26iblhKCvGTufYCJu vcR844AdkdsTffijgdRXzbSLndWGBTJvG29z5Bd9x9ocr0+veVTeQRlkPXk0wZ4U pfyNg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 425ats12n7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Oct 2024 00:12:06 -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; Wed, 9 Oct 2024 00:12:05 -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; Wed, 9 Oct 2024 00:12:05 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id 5B98F5B693B; Wed, 9 Oct 2024 00:12:02 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , , Akhil Goyal , Fan Zhang CC: Anoob Joseph , , "Kai Ji" , , Gowrishankar Muthukrishnan Subject: [PATCH v3 2/3] test/crypto: check op capabilities in SM2 tests Date: Wed, 9 Oct 2024 12:41:48 +0530 Message-ID: <20241009071151.1106-2-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20241009071151.1106-1-gmuthukrishn@marvell.com> References: <20241004181255.916-1-gmuthukrishn@marvell.com> <20241009071151.1106-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: VU_p-kT_jhujwUILdl8R9c0J4ekWMBf5 X-Proofpoint-ORIG-GUID: VU_p-kT_jhujwUILdl8R9c0J4ekWMBf5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_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 Check crypto op capabilities (prehash and RNG support) in SM2 tests. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_cryptodev_asym.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index f0b5d38543..d9b260d50e 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -2611,7 +2611,8 @@ test_sm2_sign(void) /* Populate op with operational details */ asym_op->sm2.op_type = RTE_CRYPTO_ASYM_OP_SIGN; - if (rte_cryptodev_asym_xform_capability_check_hash(capa, RTE_CRYPTO_AUTH_SM3)) + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_SIGN, RTE_CRYPTO_SM2_PH)) asym_op->sm2.hash = RTE_CRYPTO_AUTH_SM3; else asym_op->sm2.hash = RTE_CRYPTO_AUTH_NULL; @@ -2628,7 +2629,8 @@ test_sm2_sign(void) asym_op->sm2.id.length = 0; } - if (capa->internal_rng != 0) { + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_ENCRYPT, RTE_CRYPTO_SM2_RNG)) { asym_op->sm2.k.data = NULL; asym_op->sm2.k.length = 0; } else { @@ -2677,7 +2679,8 @@ test_sm2_sign(void) debug_hexdump(stdout, "s:", asym_op->sm2.s.data, asym_op->sm2.s.length); - if (capa->internal_rng == 0) { + if (!rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_SIGN, RTE_CRYPTO_SM2_RNG)) { /* Verify sign (by comparison). */ if (memcmp(input_params.sign_r.data, asym_op->sm2.r.data, asym_op->sm2.r.length) != 0) { @@ -2802,7 +2805,8 @@ test_sm2_verify(void) /* Populate op with operational details */ asym_op->sm2.op_type = RTE_CRYPTO_ASYM_OP_VERIFY; - if (rte_cryptodev_asym_xform_capability_check_hash(capa, RTE_CRYPTO_AUTH_SM3)) + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_VERIFY, RTE_CRYPTO_SM2_PH)) asym_op->sm2.hash = RTE_CRYPTO_AUTH_SM3; else asym_op->sm2.hash = RTE_CRYPTO_AUTH_NULL; @@ -2924,7 +2928,8 @@ test_sm2_enc(void) /* Populate op with operational details */ asym_op->sm2.op_type = RTE_CRYPTO_ASYM_OP_ENCRYPT; - if (rte_cryptodev_asym_xform_capability_check_hash(capa, RTE_CRYPTO_AUTH_SM3)) + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_ENCRYPT, RTE_CRYPTO_SM2_PH)) asym_op->sm2.hash = RTE_CRYPTO_AUTH_SM3; else asym_op->sm2.hash = RTE_CRYPTO_AUTH_NULL; @@ -2932,7 +2937,8 @@ test_sm2_enc(void) asym_op->sm2.message.data = input_params.message.data; asym_op->sm2.message.length = input_params.message.length; - if (capa->internal_rng != 0) { + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_ENCRYPT, RTE_CRYPTO_SM2_RNG)) { asym_op->sm2.k.data = NULL; asym_op->sm2.k.length = 0; } else { @@ -2978,7 +2984,8 @@ test_sm2_enc(void) debug_hexdump(stdout, "cipher:", asym_op->sm2.cipher.data, asym_op->sm2.cipher.length); - if (capa->internal_rng == 0) { + if (!rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_ENCRYPT, RTE_CRYPTO_SM2_RNG)) { if (memcmp(input_params.cipher.data, asym_op->sm2.cipher.data, asym_op->sm2.cipher.length) != 0) { status = TEST_FAILED; @@ -3105,7 +3112,8 @@ test_sm2_dec(void) /* Populate op with operational details */ asym_op->sm2.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT; - if (rte_cryptodev_asym_xform_capability_check_hash(capa, RTE_CRYPTO_AUTH_SM3)) + if (rte_cryptodev_asym_xform_capability_check_opcap(capa, + RTE_CRYPTO_ASYM_OP_DECRYPT, RTE_CRYPTO_SM2_PH)) asym_op->sm2.hash = RTE_CRYPTO_AUTH_SM3; else asym_op->sm2.hash = RTE_CRYPTO_AUTH_NULL; -- 2.21.0