From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 79D7A1B05D for ; Tue, 10 Jul 2018 00:14:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jul 2018 15:14:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,330,1526367600"; d="scan'208";a="70911241" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga001.fm.intel.com with ESMTP; 09 Jul 2018 15:14:09 -0700 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by IRSMSX151.ger.corp.intel.com (163.33.192.59) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 9 Jul 2018 23:14:08 +0100 Received: from irsmsx107.ger.corp.intel.com ([169.254.10.193]) by irsmsx111.ger.corp.intel.com ([169.254.2.118]) with mapi id 14.03.0319.002; Mon, 9 Jul 2018 23:14:08 +0100 From: "De Lara Guarch, Pablo" To: Shally Verma CC: "dev@dpdk.org" , "pathreya@caviumnetworks.com" , Sunila Sahu , Ashish Gupta Thread-Topic: [PATCH v4 1/2] test/crypto: add rsa and mod test application Thread-Index: AQHUFHiIEpCEzho5DUKuSOWODVbyzaSHQDOA Date: Mon, 9 Jul 2018 22:14:07 +0000 Message-ID: References: <1530806060-31227-1-git-send-email-shally.verma@caviumnetworks.com> <1530806060-31227-2-git-send-email-shally.verma@caviumnetworks.com> In-Reply-To: <1530806060-31227-2-git-send-email-shally.verma@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTQwNTc5ZjItMzNhZi00NDhlLWE1MmQtMGYxMWRhYTBmODc5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWW5UZ1JQUFF4ZTZOa2NkeE4wS0lMMWpxa2I0d3l5dEV3S044M2RrZnM3ZGV5YkdzU3VBc1pCaUwyMXNoWUl3WSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 1/2] test/crypto: add rsa and mod test application X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2018 22:14:15 -0000 > -----Original Message----- > From: Shally Verma [mailto:shally.verma@caviumnetworks.com] > Sent: Thursday, July 5, 2018 4:54 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org; pathreya@caviumnetworks.com; Sunila Sahu > ; Ashish Gupta > > Subject: [PATCH v4 1/2] test/crypto: add rsa and mod test application >=20 > From: Sunila Sahu >=20 > Test application include test case for : > - RSA encrypt, decrypt, sign and verify > - Modular Inversion and Exponentiation >=20 > Test cases uses predefined test vectors. >=20 > Signed-off-by: Sunila Sahu > Signed-off-by: Shally Verma > Signed-off-by: Ashish Gupta > --- > test/test/Makefile | 1 + > test/test/meson.build | 1 + > test/test/test_cryptodev_asym.c | 836 > ++++++++++++++++++++++++++++ > test/test/test_cryptodev_asym_util.h | 45 ++ > test/test/test_cryptodev_mod_test_vectors.h | 103 ++++ > test/test/test_cryptodev_rsa_test_vectors.h | 90 +++ > 6 files changed, 1076 insertions(+) >=20 > diff --git a/test/test/Makefile b/test/test/Makefile index eccc8ef..d6fb8= 8f > 100644 > --- a/test/test/Makefile > +++ b/test/test/Makefile > @@ -179,6 +179,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) +=3D > test_pmd_ring_perf.c >=20 > SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) +=3D test_cryptodev_blockcipher.c > SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) +=3D test_cryptodev.c > +SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) +=3D test_cryptodev_asym.c >=20 > ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y) > SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) +=3D test_compressdev.c diff --git > a/test/test/meson.build b/test/test/meson.build index a907fd2..06cd6f7 10= 0644 > --- a/test/test/meson.build > +++ b/test/test/meson.build > @@ -22,6 +22,7 @@ test_sources =3D files('commands.c', > 'test_cpuflags.c', > 'test_crc.c', > 'test_cryptodev.c', > + 'test_cryptodev_asym.c', > 'test_cryptodev_blockcipher.c', > 'test_cycles.c', > 'test_debug.c', > diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_a= sym.c > new file mode 100644 index 0000000..9b6ffac > --- /dev/null > +++ b/test/test/test_cryptodev_asym.c > @@ -0,0 +1,836 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2018 Cavium Networks > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include "test_cryptodev.h" > +#include "test_cryptodev_mod_test_vectors.h" > +#include "test_cryptodev_rsa_test_vectors.h" > +#include "test_cryptodev_asym_util.h" > +#include "test.h" > + > +#define TEST_NUM_BUFS 10 > +#define TEST_NUM_SESSIONS 4 > +#define ASYM_TEST_MSG_LEN 256 > + > +static int gbl_driver_id; > +struct crypto_testsuite_params { > + struct rte_mempool *op_mpool; > + struct rte_mempool *session_mpool; > + struct rte_cryptodev_config conf; > + struct rte_cryptodev_qp_conf qp_conf; > + uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS]; > + uint8_t valid_dev_count; > +}; > + > +struct crypto_unittest_params { > + struct rte_cryptodev_asym_session *sess; > + struct rte_crypto_op *op; > +}; > + > +static struct crypto_testsuite_params testsuite_params =3D { NULL }; > + > +static int > +test_rsa_sign_verify(void) > +{ > + struct crypto_testsuite_params *ts_params =3D &testsuite_params; > + struct rte_mempool *op_mpool =3D ts_params->op_mpool; > + struct rte_mempool *sess_mpool =3D ts_params->session_mpool; > + uint8_t dev_id =3D ts_params->valid_devs[0]; > + struct rte_crypto_asym_op *asym_op =3D NULL; > + struct rte_crypto_op *op =3D NULL, *result_op =3D NULL; > + struct rte_cryptodev_asym_session *sess =3D NULL; > + int status =3D TEST_SUCCESS; > + uint8_t output_buf[TEST_DATA_SIZE] =3D {0}; > + uint8_t input_buf[TEST_DATA_SIZE] =3D {0}; > + char test_msg[ASYM_TEST_MSG_LEN + 1]; > + > + sess =3D rte_cryptodev_asym_session_create(sess_mpool); > + > + if (!sess) { > + snprintf(test_msg, ASYM_TEST_MSG_LEN, "line %u " > + "FAILED: %s", __LINE__, > + "Session creation failed"); Shouldn't this be printf/RTE_LOG? Afaik, you are just printing into test_ms= g, but not showing that in the screen. > + status =3D TEST_FAILED; > + goto error_exit; > + } ... > + } > + > + /* print xfrm capability */ Use "xform". ... > +++ b/test/test/test_cryptodev_asym_util.h ... > + > +static inline int verify_modexp(uint8_t *mod_exp, > + struct rte_crypto_op *result_op) > +{ > + int ret =3D 0; > + if (memcmp(mod_exp, result_op->asym->modex.base.data, > + result_op->asym->modex.base.length)) > + ret =3D -1; > + return ret; Ret variable is not required. Just return -1 inside if, and 0 outside. ... > diff --git a/test/test/test_cryptodev_rsa_test_vectors.h > b/test/test/test_cryptodev_rsa_test_vectors.h ... > + { > + .d =3D { > + .data =3D rsa_d, > + .length =3D sizeof(rsa_d) > + }, > + } These outer braces are not needed.