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 AE70B4590E; Thu, 5 Sep 2024 16:58:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90AAE42EA7; Thu, 5 Sep 2024 16:58: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 CA0BD42EB6 for ; Thu, 5 Sep 2024 16:58:07 +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 485AWP0D018438; Thu, 5 Sep 2024 07:57:59 -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=e 7qYIlzwzknnjSwCM40dp2k2+c/RK0bQts+cMYks6c8=; b=aZX0tVV9Ri0S3DuHR ZNUVbiQrgtDyikOW36uYjmvH15CoVHGiJ/GX7Nz8zejc95rwpq1f23FR67qJDzq0 9/xw0eUad5hABTlHZT4mbtNzexFCB9B5wEiPhoqWuIQ+ojrkQiYCxg49Amibwow4 GPgkHzaFDMafmg3K2sZseN4bSNntETk4qOcw3ML3aWrWVXH92XrQVpknXKuxScJ9 l0txEXxocm3Gyj1tUrBK881wnHx7Oj1kHA0qSb6R7BgrMzmUYKHCln7zsu7BszFo eWvTTrXe3RrDuoJPZPwdaeJpHGOOtJzSJYViWO8FJDsoVeiAC37+mSoTDqLuzuVH HMBNg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 41faywh1cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Sep 2024 07:57:59 -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, 5 Sep 2024 07:57:58 -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, 5 Sep 2024 07:57:57 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id C2D6D5B6973; Thu, 5 Sep 2024 07:57:47 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Fan Zhang CC: Anoob Joseph , , , , , , , , , , , , , , , , , , , , , , , , , , Brian Dooley , Gowrishankar Muthukrishnan Subject: [PATCH 6/6] app/test: add asymmetric tests for virtio pmd Date: Thu, 5 Sep 2024 20:26:10 +0530 Message-ID: <20240905145612.1732-7-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240905145612.1732-1-gmuthukrishn@marvell.com> References: <20240905145612.1732-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: etF_coo6sVaGwlX3orDhSd9GdmioOlKo X-Proofpoint-GUID: etF_coo6sVaGwlX3orDhSd9GdmioOlKo 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-05_10,2024-09-04_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 Add asymmetric tests for Virtio PMD. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_cryptodev_asym.c | 42 +++++++++++++++++++--- app/test/test_cryptodev_rsa_test_vectors.h | 26 ++++++++++++++ 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 0928367cb0..b425643211 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -475,7 +475,7 @@ testsuite_setup(void) for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( dev_id, qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(dev_id)), + (int8_t)rte_cryptodev_socket_id(dev_id)), "Failed to setup queue pair %u on cryptodev %u ASYM", qp_id, dev_id); } @@ -538,7 +538,7 @@ ut_setup_asym(void) TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, &ts_params->qp_conf, - rte_cryptodev_socket_id(ts_params->valid_devs[0])), + (int8_t)rte_cryptodev_socket_id(ts_params->valid_devs[0])), "Failed to setup queue pair %u on cryptodev %u", qp_id, ts_params->valid_devs[0]); } @@ -3319,7 +3319,6 @@ rsa_encrypt(const struct rsa_test_data_2 *vector, uint8_t *cipher_buf) self->op->asym->rsa.cipher.data = cipher_buf; self->op->asym->rsa.cipher.length = 0; SET_RSA_PARAM(self->op->asym->rsa, vector, message); - self->op->asym->rsa.padding.type = vector->padding; rte_crypto_op_attach_asym_session(self->op, self->sess); TEST_ASSERT_SUCCESS(send_one(), @@ -3343,7 +3342,6 @@ rsa_decrypt(const struct rsa_test_data_2 *vector, uint8_t *plaintext, self->op->asym->rsa.message.data = plaintext; self->op->asym->rsa.message.length = 0; self->op->asym->rsa.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT; - self->op->asym->rsa.padding.type = vector->padding; rte_crypto_op_attach_asym_session(self->op, self->sess); TEST_ASSERT_SUCCESS(send_one(), "Failed to process crypto op (Decryption)"); @@ -3385,6 +3383,7 @@ kat_rsa_encrypt(const void *data) SET_RSA_PARAM(xform.rsa, vector, n); SET_RSA_PARAM(xform.rsa, vector, e); SET_RSA_PARAM(xform.rsa, vector, d); + xform.rsa.padding.type = vector->padding; xform.rsa.key_type = RTE_RSA_KEY_TYPE_EXP; int ret = rsa_init_session(&xform); @@ -3415,6 +3414,7 @@ kat_rsa_encrypt_crt(const void *data) SET_RSA_PARAM_QT(xform.rsa, vector, dP); SET_RSA_PARAM_QT(xform.rsa, vector, dQ); SET_RSA_PARAM_QT(xform.rsa, vector, qInv); + xform.rsa.padding.type = vector->padding; xform.rsa.key_type = RTE_RSA_KEY_TYPE_QT; int ret = rsa_init_session(&xform); if (ret) { @@ -3440,6 +3440,7 @@ kat_rsa_decrypt(const void *data) SET_RSA_PARAM(xform.rsa, vector, n); SET_RSA_PARAM(xform.rsa, vector, e); SET_RSA_PARAM(xform.rsa, vector, d); + xform.rsa.padding.type = vector->padding; xform.rsa.key_type = RTE_RSA_KEY_TYPE_EXP; int ret = rsa_init_session(&xform); @@ -3470,6 +3471,7 @@ kat_rsa_decrypt_crt(const void *data) SET_RSA_PARAM_QT(xform.rsa, vector, dP); SET_RSA_PARAM_QT(xform.rsa, vector, dQ); SET_RSA_PARAM_QT(xform.rsa, vector, qInv); + xform.rsa.padding.type = vector->padding; xform.rsa.key_type = RTE_RSA_KEY_TYPE_QT; int ret = rsa_init_session(&xform); if (ret) { @@ -3634,6 +3636,22 @@ static struct unit_test_suite cryptodev_octeontx_asym_testsuite = { } }; +static struct unit_test_suite cryptodev_virtio_asym_testsuite = { + .suite_name = "Crypto Device VIRTIO ASYM Unit Test Suite", + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { + TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability), + TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, + test_rsa_sign_verify), + TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, + test_rsa_sign_verify_crt), + TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec), + TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec_crt), + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; + static int test_cryptodev_openssl_asym(void) { @@ -3702,6 +3720,22 @@ test_cryptodev_cn10k_asym(void) return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite); } +static int +test_cryptodev_virtio_asym(void) +{ + gbl_driver_id = rte_cryptodev_driver_id_get( + RTE_STR(CRYPTODEV_NAME_VIRTIO_PMD)); + if (gbl_driver_id == -1) { + RTE_LOG(ERR, USER1, "virtio PMD must be loaded.\n"); + return TEST_FAILED; + } + + /* Use test suite registered for crypto_virtio PMD */ + return unit_test_suite_runner(&cryptodev_virtio_asym_testsuite); +} + +REGISTER_DRIVER_TEST(cryptodev_virtio_asym_autotest, test_cryptodev_virtio_asym); + REGISTER_DRIVER_TEST(cryptodev_openssl_asym_autotest, test_cryptodev_openssl_asym); REGISTER_DRIVER_TEST(cryptodev_qat_asym_autotest, test_cryptodev_qat_asym); REGISTER_DRIVER_TEST(cryptodev_octeontx_asym_autotest, test_cryptodev_octeontx_asym); diff --git a/app/test/test_cryptodev_rsa_test_vectors.h b/app/test/test_cryptodev_rsa_test_vectors.h index 1b7b451387..1c46a8117a 100644 --- a/app/test/test_cryptodev_rsa_test_vectors.h +++ b/app/test/test_cryptodev_rsa_test_vectors.h @@ -358,6 +358,28 @@ struct rte_crypto_asym_xform rsa_xform = { .d = { .data = rsa_d, .length = sizeof(rsa_d) + }, + .qt = { + .p = { + .data = rsa_p, + .length = sizeof(rsa_p) + }, + .q = { + .data = rsa_q, + .length = sizeof(rsa_q) + }, + .dP = { + .data = rsa_dP, + .length = sizeof(rsa_dP) + }, + .dQ = { + .data = rsa_dQ, + .length = sizeof(rsa_dQ) + }, + .qInv = { + .data = rsa_qInv, + .length = sizeof(rsa_qInv) + }, } } }; @@ -377,6 +399,10 @@ struct rte_crypto_asym_xform rsa_xform_crt = { .length = sizeof(rsa_e) }, .key_type = RTE_RSA_KEY_TYPE_QT, + .d = { + .data = rsa_d, + .length = sizeof(rsa_d) + }, .qt = { .p = { .data = rsa_p, -- 2.21.0