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 E38A4A0093; Fri, 29 Apr 2022 08:23:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CCA2410E3; Fri, 29 Apr 2022 08:23:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5E81F40E50 for ; Fri, 29 Apr 2022 08:23:26 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 23SN4wwJ010555; Thu, 28 Apr 2022 23:23:25 -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=KhabuJxn2TNqmqLkVua1Zi2YejymT/9c7dOKa4PpENY=; b=FpwNCkOWln9KL8ybwCkcz2GhBZLoDnlzsHonz2Gn2d12nw8PbcWEC2ozRU66ewx17OLX x6LUbYW0v58pMrR90EDNadZiqesOyFyrHVBOVSKwXkIvhj82DHv93Nd8fuf7YQ0Tp6Ln 7KK1yIPU+WNrcVrpRdVHKZuubHii7l5AYppvQVhIkNH2I6HlRMZe4Oq3gB4FW2nt4aCC eL/2AgfzkPVqnbOTWImBlXqG/iU7HOpE+41LWIw9Xw7T+OfcW2kMLih49A9RfpqcYTAE /zcoI33B9F7RnjxdU+FlGa11TiRXhRwDFzp7rMHOAHdAC/VR/q7YlJsEoJNuQK7f+xUZ 3w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fr49gsk10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 28 Apr 2022 23:23:25 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 28 Apr 2022 23:23:23 -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.18 via Frontend Transport; Thu, 28 Apr 2022 23:23:23 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 9442B3F7074; Thu, 28 Apr 2022 23:23:22 -0700 (PDT) From: To: Ciara Power CC: , Kiran Kumar K Subject: [dpdk-dev][PATCH] test/crypto-perf: extend asymmetric crypto throughput test Date: Fri, 29 Apr 2022 11:53:15 +0530 Message-ID: <20220429062315.2262883-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220316083412.1225979-1-kirankumark@marvell.com> References: <20220316083412.1225979-1-kirankumark@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: dXqRrBCPFTtav6BvN6wj1wqHdOvH3OtA X-Proofpoint-GUID: dXqRrBCPFTtav6BvN6wj1wqHdOvH3OtA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-29_05,2022-04-28_01,2022-02-23_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 From: Kiran Kumar K Extended support for asymmetric crypto perf throughput test. Added support for new modulus lengths. Added new parameter --modex-len. Supported lengths are 60, 128, 255, 448. Default length is 128. Signed-off-by: Kiran Kumar K --- app/test-crypto-perf/cperf_ops.c | 18 +- app/test-crypto-perf/cperf_options.h | 3 + app/test-crypto-perf/cperf_options_parsing.c | 42 +++ app/test-crypto-perf/cperf_test_vectors.c | 264 ++++++++++++++++--- app/test-crypto-perf/cperf_test_vectors.h | 25 +- app/test-crypto-perf/main.c | 2 +- doc/guides/tools/cryptoperf.rst | 5 + 7 files changed, 312 insertions(+), 47 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index 8baee12e45..7bb7a2611d 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -14,7 +14,7 @@ cperf_set_ops_asym(struct rte_crypto_op **ops, uint32_t src_buf_offset __rte_unused, uint32_t dst_buf_offset __rte_unused, uint16_t nb_ops, struct rte_cryptodev_sym_session *sess, - const struct cperf_options *options __rte_unused, + const struct cperf_options *options, const struct cperf_test_vector *test_vector __rte_unused, uint16_t iv_offset __rte_unused, uint32_t *imix_idx __rte_unused, @@ -27,10 +27,10 @@ cperf_set_ops_asym(struct rte_crypto_op **ops, struct rte_crypto_asym_op *asym_op = ops[i]->asym; ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; - asym_op->modex.base.data = perf_base; - asym_op->modex.base.length = sizeof(perf_base); - asym_op->modex.result.data = perf_mod_result; - asym_op->modex.result.length = sizeof(perf_mod_result); + asym_op->modex.base.data = options->modex_data->base.data; + asym_op->modex.base.length = options->modex_data->base.len; + asym_op->modex.result.data = options->modex_data->result.data; + asym_op->modex.result.length = options->modex_data->result.len; rte_crypto_op_attach_asym_session(ops[i], asym_sess); } return 0; @@ -787,10 +787,10 @@ cperf_create_session(struct rte_mempool *sess_mp, if (options->op_type == CPERF_ASYM_MODEX) { xform.next = NULL; xform.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX; - xform.modex.modulus.data = perf_mod_p; - xform.modex.modulus.length = sizeof(perf_mod_p); - xform.modex.exponent.data = perf_mod_e; - xform.modex.exponent.length = sizeof(perf_mod_e); + xform.modex.modulus.data = options->modex_data->modulus.data; + xform.modex.modulus.length = options->modex_data->modulus.len; + xform.modex.exponent.data = options->modex_data->exponent.data; + xform.modex.exponent.length = options->modex_data->exponent.len; ret = rte_cryptodev_asym_session_create(dev_id, &xform, sess_mp, &asym_sess); diff --git a/app/test-crypto-perf/cperf_options.h b/app/test-crypto-perf/cperf_options.h index 031b238b20..09caefde22 100644 --- a/app/test-crypto-perf/cperf_options.h +++ b/app/test-crypto-perf/cperf_options.h @@ -12,6 +12,7 @@ #endif #define CPERF_PTEST_TYPE ("ptest") +#define CPERF_MODEX_LEN ("modex-len") #define CPERF_SILENT ("silent") #define CPERF_POOL_SIZE ("pool-sz") @@ -153,6 +154,8 @@ struct cperf_options { uint32_t pmdcc_delay; uint32_t imix_distribution_list[MAX_LIST]; uint8_t imix_distribution_count; + struct cperf_modex_test_data *modex_data; + uint16_t modex_len; }; void diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 59a9dc596a..09c98121c8 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -10,6 +10,7 @@ #include #include "cperf_options.h" +#include "cperf_test_vectors.h" #define AES_BLOCK_SIZE 16 #define DES_BLOCK_SIZE 8 @@ -57,6 +58,8 @@ usage(char *progname) " --pmd-cyclecount-delay-ms N: set delay between enqueue\n" " and dequeue in pmd-cyclecount benchmarking mode\n" " --csv-friendly: enable test result output CSV friendly\n" + " --modex-len N: modex length, supported lengths are " + "60, 128, 255, 448. Default: 128\n" #ifdef RTE_LIB_SECURITY " --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain \n" @@ -313,6 +316,16 @@ parse_pool_sz(struct cperf_options *opts, const char *arg) return ret; } +static int +parse_modex_len(struct cperf_options *opts, const char *arg) +{ + int ret = parse_uint16_t(&opts->modex_len, arg); + + if (ret) + RTE_LOG(ERR, USER1, "failed to parse modex len"); + return ret; +} + static int parse_burst_sz(struct cperf_options *opts, const char *arg) { @@ -822,6 +835,7 @@ struct long_opt_parser { static struct option lgopts[] = { { CPERF_PTEST_TYPE, required_argument, 0, 0 }, + { CPERF_MODEX_LEN, required_argument, 0, 0 }, { CPERF_POOL_SIZE, required_argument, 0, 0 }, { CPERF_TOTAL_OPS, required_argument, 0, 0 }, @@ -939,6 +953,7 @@ cperf_options_default(struct cperf_options *opts) opts->pdcp_ses_hfn_en = 0; opts->docsis_hdr_sz = 17; #endif + opts->modex_data = (struct cperf_modex_test_data *)&modex_perf_data[0]; } static int @@ -946,6 +961,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { struct long_opt_parser parsermap[] = { { CPERF_PTEST_TYPE, parse_cperf_test_type }, + { CPERF_MODEX_LEN, parse_modex_len }, { CPERF_SILENT, parse_silent }, { CPERF_POOL_SIZE, parse_pool_sz }, { CPERF_TOTAL_OPS, parse_total_ops }, @@ -1117,6 +1133,8 @@ check_docsis_buffer_length(struct cperf_options *options) int cperf_options_check(struct cperf_options *options) { + int i; + if (options->op_type == CPERF_CIPHER_ONLY || options->op_type == CPERF_DOCSIS) options->digest_sz = 0; @@ -1243,6 +1261,30 @@ cperf_options_check(struct cperf_options *options) return -EINVAL; } + if (options->modex_len) { + if (options->op_type != CPERF_ASYM_MODEX) { + RTE_LOG(ERR, USER1, "Option modex len should be used only with " + " optype: modex.\n"); + return -EINVAL; + } + + for (i = 0; i < (int)RTE_DIM(modex_perf_data); i++) { + if (modex_perf_data[i].modulus.len == + options->modex_len) { + options->modex_data = + (struct cperf_modex_test_data + *)&modex_perf_data[i]; + break; + } + } + if (i == (int)RTE_DIM(modex_perf_data)) { + RTE_LOG(ERR, USER1, + "Option modex len: %d is not supported\n", + options->modex_len); + return -EINVAL; + } + } + #ifdef RTE_LIB_SECURITY if (options->op_type == CPERF_DOCSIS) { if (check_docsis_buffer_length(options) < 0) diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c index dafcfc0c6c..5cd7a229b8 100644 --- a/app/test-crypto-perf/cperf_test_vectors.c +++ b/app/test-crypto-perf/cperf_test_vectors.c @@ -7,37 +7,235 @@ #include "cperf_test_vectors.h" -/* modular operation test data */ -uint8_t perf_base[20] = { - 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, - 0xAE, 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, - 0xA8, 0xEB, 0x7E, 0x78, 0xA0, 0x50 -}; - -uint8_t perf_mod_p[129] = { - 0x00, 0xb3, 0xa1, 0xaf, 0xb7, 0x13, 0x08, 0x00, - 0x0a, 0x35, 0xdc, 0x2b, 0x20, 0x8d, 0xa1, 0xb5, - 0xce, 0x47, 0x8a, 0xc3, 0x80, 0xf4, 0x7d, 0x4a, - 0xa2, 0x62, 0xfd, 0x61, 0x7f, 0xb5, 0xa8, 0xde, - 0x0a, 0x17, 0x97, 0xa0, 0xbf, 0xdf, 0x56, 0x5a, - 0x3d, 0x51, 0x56, 0x4f, 0x70, 0x70, 0x3f, 0x63, - 0x6a, 0x44, 0x5b, 0xad, 0x84, 0x0d, 0x3f, 0x27, - 0x6e, 0x3b, 0x34, 0x91, 0x60, 0x14, 0xb9, 0xaa, - 0x72, 0xfd, 0xa3, 0x64, 0xd2, 0x03, 0xa7, 0x53, - 0x87, 0x9e, 0x88, 0x0b, 0xc1, 0x14, 0x93, 0x1a, - 0x62, 0xff, 0xb1, 0x5d, 0x74, 0xcd, 0x59, 0x63, - 0x18, 0x11, 0x3d, 0x4f, 0xba, 0x75, 0xd4, 0x33, - 0x4e, 0x23, 0x6b, 0x7b, 0x57, 0x44, 0xe1, 0xd3, - 0x03, 0x13, 0xa6, 0xf0, 0x8b, 0x60, 0xb0, 0x9e, - 0xee, 0x75, 0x08, 0x9d, 0x71, 0x63, 0x13, 0xcb, - 0xa6, 0x81, 0x92, 0x14, 0x03, 0x22, 0x2d, 0xde, - 0x55 +struct +cperf_modex_test_data modex_perf_data[4] = { + { + .base = { + .data = { + 0xF8, 0xBA, 0x1A, 0x55, 0xD0, 0x2F, 0x85, + 0xAE, 0x96, 0x7B, 0xB6, 0x2F, 0xB6, 0xCD, + 0xA8, 0xEB, 0x7E, 0x78, 0xA0, 0x50 + }, + .len = 20 + }, + .exponent = { + .data = { + 0x01, 0x00, 0x01 + }, + .len = 3 + }, + .modulus = { + .data = { + 0xb3, 0xa1, 0xaf, 0xb7, 0x13, 0x08, 0x00, 0x0a, + 0x35, 0xdc, 0x2b, 0x20, 0x8d, 0xa1, 0xb5, 0xce, + 0x47, 0x8a, 0xc3, 0x80, 0xf4, 0x7d, 0x4a, 0xa2, + 0x62, 0xfd, 0x61, 0x7f, 0xb5, 0xa8, 0xde, 0x0a, + 0x17, 0x97, 0xa0, 0xbf, 0xdf, 0x56, 0x5a, 0x3d, + 0x51, 0x56, 0x4f, 0x70, 0x70, 0x3f, 0x63, 0x6a, + 0x44, 0x5b, 0xad, 0x84, 0x0d, 0x3f, 0x27, 0x6e, + 0x3b, 0x34, 0x91, 0x60, 0x14, 0xb9, 0xaa, 0x72, + 0xfd, 0xa3, 0x64, 0xd2, 0x03, 0xa7, 0x53, 0x87, + 0x9e, 0x88, 0x0b, 0xc1, 0x14, 0x93, 0x1a, 0x62, + 0xff, 0xb1, 0x5d, 0x74, 0xcd, 0x59, 0x63, 0x18, + 0x11, 0x3d, 0x4f, 0xba, 0x75, 0xd4, 0x33, 0x4e, + 0x23, 0x6b, 0x7b, 0x57, 0x44, 0xe1, 0xd3, 0x03, + 0x13, 0xa6, 0xf0, 0x8b, 0x60, 0xb0, 0x9e, 0xee, + 0x75, 0x08, 0x9d, 0x71, 0x63, 0x13, 0xcb, 0xa6, + 0x81, 0x92, 0x14, 0x03, 0x22, 0x2d, 0xde, 0x55 + }, + .len = 128 + }, + .result = { + .len = 128 + } + }, + { + .base = { + .data = { + 0x4F, 0xD8, 0x5C, 0xDB, 0x6D, 0xA2, 0xFA, 0x35, + 0x9D, 0xD7, 0x97, 0x10, 0x4B, 0x71, 0x5F, 0x53, + 0xE1, 0xC7, 0x09, 0x74, 0x88, 0xC8, 0x9D, 0x03, + 0xC0, 0x70, 0xE0, 0xBE, 0xE3, 0xF2, 0x2C, 0x01, + 0x85, 0xA6, 0x4E, 0x28, 0x6E, 0xD3, 0xB5, 0x18, + 0x58, 0x69, 0x07, 0xDA, 0x3A, 0x1B, 0x35, 0xCE, + 0xE6, 0xFA + }, + .len = 50 + }, + .exponent = { + .data = { + 0x30, 0xA5, 0xD5, 0xF0, 0x42, 0x03, 0xC3, 0x2D, + 0x2F, 0x58, 0xA8, 0x5C, 0x21, 0x88, 0xDE, 0x82, + 0x36, 0x44, 0xC1, 0x5A, 0x87, 0x2C, 0x33, 0x19, + 0x4E, 0xCE, 0x3F, 0x87, 0xFF, 0x98, 0x4B, 0xFC, + 0x15, 0xC0, 0xBE, 0x9E, 0x8F, 0xF0, 0x6A, 0x62 + }, + .len = 40 + }, + .modulus = { + .data = { + 0xF8, 0x04, 0x0D, 0xD5, 0x09, 0x6C, 0x78, 0x06, + 0x7D, 0x28, 0x77, 0xA4, 0x0E, 0xA5, 0x49, 0xE7, + 0x6D, 0xC9, 0x97, 0xD3, 0xC0, 0x7F, 0x82, 0xC6, + 0x75, 0x51, 0x72, 0xAF, 0x8C, 0x77, 0x97, 0xD0, + 0xA1, 0x85, 0x54, 0xC0, 0x78, 0x86, 0xD6, 0x40, + 0x7A, 0x6B, 0xB3, 0xD7, 0x07, 0xCA, 0x27, 0xA3, + 0x66, 0xB9, 0x98, 0x22, 0xC4, 0x54, 0x18, 0x07, + 0x65, 0x76, 0x0F, 0x5A + }, + .len = 60 + }, + .result = { + .len = 60 + } + }, + { + .base = { + .data = { + 0xD8, 0x21, 0xD2, 0x76, 0xAE, 0x01, 0x62, 0xD8, + 0x8C, 0x80, 0x01, 0x25, 0xC7, 0xE8, 0x4E, 0x0F, + 0x7F, 0x23, 0xFE, 0xBB + }, + .len = 20 + }, + .exponent = { + .data = { + 0xE5, 0xCE, 0x50, 0xE8, 0x97, 0x32, 0xFB, 0x5C, + 0xFC, 0x62 + }, + .len = 10 + }, + .modulus = { + .data = { + 0x71, 0x3C, 0x6C, 0x7A, 0x19, 0x31, 0xF8, 0x94, + 0xC9, 0xAA, 0x25, 0x69, 0xA7, 0xF2, 0x28, 0x70, + 0x84, 0x5D, 0xEC, 0x40, 0xC8, 0xF9, 0xC5, 0x79, + 0xF9, 0x87, 0xD1, 0xA0, 0xC1, 0x5A, 0x06, 0xE4, + 0x65, 0xB8, 0x29, 0x0B, 0x2B, 0xFE, 0x67, 0xF0, + 0x91, 0x96, 0xE1, 0xCD, 0x5A, 0xCE, 0x44, 0xA3, + 0x4F, 0xE8, 0xBE, 0xC6, 0xA3, 0x0A, 0xCB, 0xF5, + 0x7D, 0x8B, 0x9B, 0x2F, 0x4E, 0xC9, 0x54, 0x48, + 0xA4, 0xC2, 0x09, 0xCE, 0xA5, 0x93, 0x1F, 0x43, + 0xC2, 0xCE, 0xFB, 0xBB, 0x69, 0x29, 0x03, 0x74, + 0xD6, 0x25, 0x47, 0x6B, 0xAC, 0x4E, 0x44, 0x8C, + 0x39, 0x2F, 0xB2, 0xDD, 0x15, 0x1B, 0xA3, 0x3D, + 0xA4, 0x0C, 0xFF, 0xCB, 0x05, 0xC2, 0x81, 0x97, + 0x16, 0xE2, 0xAC, 0x8A, 0xF3, 0xED, 0x80, 0xA4, + 0xC5, 0xFC, 0xF5, 0x6C, 0x4B, 0xBB, 0x05, 0x91, + 0xD4, 0x0F, 0xDA, 0x70, 0x7C, 0x9A, 0xA1, 0x63, + 0x15, 0xEE, 0xBB, 0x17, 0xE6, 0x20, 0x50, 0x74, + 0x36, 0x9C, 0xA1, 0x10, 0x29, 0x22, 0xFB, 0x7E, + 0x2A, 0x08, 0xF3, 0x07, 0xEA, 0xCD, 0x2C, 0x50, + 0x18, 0x15, 0x66, 0x87, 0x74, 0x19, 0x11, 0x2B, + 0x77, 0x85, 0xA0, 0x57, 0xA7, 0xEB, 0x6E, 0x15, + 0x15, 0x0D, 0xA4, 0x18, 0x5D, 0x54, 0x13, 0xE3, + 0x33, 0x12, 0x8D, 0xA3, 0xEF, 0x54, 0xE6, 0x1E, + 0xDB, 0x8F, 0x3D, 0x02, 0x3C, 0xCB, 0x34, 0x93, + 0x31, 0x1D, 0x4D, 0x3E, 0x9C, 0x22, 0x04, 0xD1, + 0x19, 0x53, 0x45, 0xE5, 0xBF, 0xF8, 0x70, 0x1A, + 0xEA, 0x52, 0x93, 0x2A, 0x26, 0x8A, 0x1E, 0x47, + 0xCE, 0x83, 0x5B, 0x35, 0x9A, 0xD2, 0x75, 0xC6, + 0xC6, 0x20, 0x84, 0x9F, 0x74, 0x69, 0x69, 0xB8, + 0x29, 0xD8, 0xA4, 0x70, 0x91, 0x42, 0x06, 0x25, + 0x38, 0xCB, 0x42, 0x75, 0x52, 0xEF, 0xB8, 0x64, + 0x4F, 0xC5, 0x7C, 0xC4, 0x09, 0xDB, 0x12 + }, + .len = 255 + }, + .result = { + .len = 255 + } + }, + { + .base = { + .data = { + 0x92, 0x45, 0x17, 0x7D, 0xD3, 0xF4, 0x2B, 0x93, + 0x8E, 0x1A, 0xFB, 0x1D, 0x13, 0x55, 0x53, 0x84, + 0x96, 0x3C, 0x39, 0xE0, 0xAF, 0x4A, 0xB4, 0xC9, + 0x16, 0x1F, 0xF4, 0x24, 0x65, 0xDD, 0xC3, 0x62, + 0x12, 0xAF, 0x86, 0x95, 0x0D, 0xDE, 0x28, 0x87, + 0x90, 0x11, 0xAA, 0x6E, 0x60, 0xCD, 0x54, 0xB7, + 0x48, 0x43 + }, + .len = 50 + }, + .exponent = { + .data = { + 0x22, 0xD9, 0x4D, 0x01, 0x2F, 0x50, 0x5D, 0xE1, + 0x01, 0xAA, 0xC6, 0xC6, 0xCD, 0x5D, 0x7E, 0x61, + 0x75, 0x0A, 0xDC, 0x06, 0x07, 0x4B, 0xBD, 0x29, + 0x33, 0x09, 0x91, 0xD4, 0x29, 0xEB, 0x52, 0x24, + 0x27, 0xC6, 0x83, 0x6D, 0x70, 0xA9, 0xC9, 0x11 + }, + .len = 40 + }, + .modulus = { + .data = { + 0xBB, 0x97, 0x8A, 0xB6, 0x26, 0xD4, 0x0E, 0x70, + 0x21, 0xA6, 0x56, 0x71, 0xE5, 0xD8, 0x18, 0x21, + 0x64, 0x9F, 0x1B, 0x6F, 0x7C, 0x27, 0x72, 0xB8, + 0x39, 0xE5, 0x2A, 0x94, 0x76, 0x22, 0xB7, 0x68, + 0x57, 0x3A, 0x01, 0x54, 0xA8, 0x50, 0x41, 0xA1, + 0xAD, 0xD0, 0xC7, 0xDB, 0xAA, 0x76, 0x7F, 0x37, + 0xA9, 0x27, 0x22, 0x8D, 0xF0, 0x5C, 0x5A, 0xAC, + 0xFB, 0x82, 0x6A, 0x8E, 0x31, 0x51, 0x54, 0x7C, + 0xDB, 0x55, 0x9C, 0xBC, 0x82, 0x27, 0xF4, 0x0B, + 0x94, 0x74, 0xC8, 0x83, 0x80, 0x1C, 0xD8, 0xFF, + 0x50, 0xA2, 0xC9, 0xED, 0x2B, 0x98, 0x77, 0xF3, + 0x31, 0x81, 0x1C, 0x41, 0x8E, 0xAF, 0x87, 0xA2, + 0x02, 0xAC, 0x8B, 0x55, 0x01, 0x5C, 0x16, 0x11, + 0x63, 0x8C, 0xE2, 0x0D, 0x51, 0xD2, 0x4C, 0xD7, + 0xD4, 0x3D, 0xE4, 0x79, 0x1A, 0xA7, 0xC4, 0xBF, + 0x4E, 0x2A, 0xC9, 0x74, 0xD6, 0xD4, 0x90, 0x03, + 0x65, 0x7F, 0x54, 0x0F, 0xAC, 0x5F, 0x98, 0x2C, + 0x46, 0xC0, 0xD7, 0xE6, 0x75, 0x95, 0xC3, 0xEA, + 0x05, 0x3A, 0x03, 0x55, 0x43, 0xC7, 0xC2, 0xD1, + 0x11, 0xCD, 0x57, 0x37, 0x0D, 0x40, 0x87, 0xDF, + 0x7D, 0xC3, 0x04, 0x54, 0xDE, 0x1D, 0xAF, 0xB8, + 0x02, 0x50, 0x42, 0xFF, 0x9D, 0xFB, 0x13, 0xF7, + 0x25, 0x5A, 0x8B, 0xE3, 0x31, 0xA2, 0x64, 0xF8, + 0x94, 0x50, 0x18, 0xFB, 0xBB, 0xA2, 0xE9, 0x13, + 0x77, 0x6E, 0xE1, 0x6F, 0x9F, 0x06, 0x03, 0xEE, + 0x0D, 0x06, 0x6E, 0xF2, 0x9B, 0x15, 0x70, 0xDD, + 0x26, 0x7C, 0xB4, 0x5D, 0xD0, 0xE7, 0x77, 0xC4, + 0xB9, 0x88, 0x75, 0xB8, 0x73, 0xFC, 0xE9, 0xB7, + 0x11, 0x26, 0xAC, 0xDB, 0x97, 0x27, 0x18, 0x21, + 0x50, 0x7E, 0x46, 0xB2, 0xF1, 0x50, 0x40, 0xD9, + 0x8B, 0x63, 0xDB, 0x1A, 0x8E, 0x29, 0xBE, 0x1F, + 0x88, 0x35, 0xFD, 0x95, 0xC3, 0xA6, 0x80, 0xEB, + 0x73, 0xF7, 0x02, 0x02, 0xB0, 0xCA, 0x97, 0x2C, + 0x32, 0x44, 0xA9, 0xCA, 0x94, 0xC0, 0xB2, 0xD9, + 0x7C, 0xD9, 0x10, 0x62, 0x31, 0xC9, 0xFA, 0x5B, + 0x5C, 0x2C, 0xB6, 0x04, 0x5B, 0x7E, 0x86, 0xBB, + 0x49, 0x02, 0x16, 0x9E, 0x1E, 0x53, 0xBD, 0xC2, + 0xA9, 0xAA, 0x94, 0x39, 0xA1, 0xB2, 0x18, 0x17, + 0xB6, 0x2C, 0xF6, 0xFF, 0xC0, 0xD0, 0x2D, 0x4D, + 0xAA, 0x6C, 0xB5, 0xC8, 0x6A, 0xBE, 0x38, 0xE4, + 0x9F, 0xDC, 0x5C, 0x56, 0x56, 0x04, 0x32, 0x49, + 0x91, 0x17, 0x44, 0x6E, 0xB3, 0xF9, 0x8F, 0xDB, + 0xEA, 0x04, 0x4C, 0x67, 0xE6, 0xDA, 0x96, 0x2F, + 0x89, 0x2D, 0x54, 0xC3, 0xAD, 0x07, 0x6B, 0xA0, + 0x87, 0xF0, 0xCF, 0x4B, 0x43, 0x46, 0xCA, 0x06, + 0x48, 0x8D, 0x34, 0xC4, 0xD2, 0xD2, 0xA9, 0x16, + 0x13, 0xF5, 0x49, 0x44, 0x8C, 0xD9, 0x0C, 0x1E, + 0x79, 0x47, 0xFC, 0x4C, 0x37, 0x8E, 0xD1, 0xFD, + 0xB9, 0xE8, 0x6E, 0x1B, 0x8D, 0x68, 0xCC, 0x49, + 0x0D, 0x98, 0xB5, 0xD5, 0x22, 0x1C, 0xFC, 0xBA, + 0x7A, 0x74, 0x3D, 0xBD, 0xD9, 0xB3, 0x80, 0x58, + 0x4A, 0x05, 0x67, 0x9D, 0x59, 0xF4, 0xF7, 0x72, + 0x11, 0x3C, 0x67, 0x96, 0xE7, 0x0D, 0x8E, 0x73, + 0xD1, 0xEE, 0x00, 0x79, 0x98, 0x7A, 0x0E, 0xE0, + 0xA8, 0xEA, 0x7D, 0xF3, 0xDB, 0x0E, 0x62, 0x3E, + 0x66, 0x95, 0xED, 0xD5, 0x8C, 0x39, 0xF5, 0xAB + }, + .len = 448 + }, + .result = { + .len = 448 + } + } }; -uint8_t perf_mod_result[sizeof(perf_mod_p)]; - -uint8_t perf_mod_e[3] = {0x01, 0x00, 0x01}; - uint8_t plaintext[2048] = { 0x71, 0x75, 0x83, 0x98, 0x75, 0x42, 0x51, 0x09, 0x94, 0x02, 0x13, 0x20, 0x15, 0x64, 0x46, 0x32, 0x08, 0x18, 0x91, 0x82, 0x86, 0x52, 0x23, 0x93, @@ -456,10 +654,10 @@ cperf_test_vector_get_dummy(struct cperf_options *options) t_vec->plaintext.length = options->max_buffer_size; if (options->op_type == CPERF_ASYM_MODEX) { - t_vec->modex.mod = perf_mod_p; - t_vec->modex.exp = perf_mod_e; - t_vec->modex.mlen = sizeof(perf_mod_p); - t_vec->modex.elen = sizeof(perf_mod_e); + t_vec->modex.mod = options->modex_data->modulus.data; + t_vec->modex.exp = options->modex_data->exponent.data; + t_vec->modex.mlen = options->modex_data->modulus.len; + t_vec->modex.elen = options->modex_data->exponent.len; } if (options->op_type == CPERF_PDCP || diff --git a/app/test-crypto-perf/cperf_test_vectors.h b/app/test-crypto-perf/cperf_test_vectors.h index 70f2839cd6..649478ff83 100644 --- a/app/test-crypto-perf/cperf_test_vectors.h +++ b/app/test-crypto-perf/cperf_test_vectors.h @@ -77,6 +77,26 @@ struct cperf_test_vector { } modex; }; +struct cperf_modex_test_data { +#define DATA_SIZE 512 + struct { + uint8_t data[DATA_SIZE]; + uint16_t len; + } base; + struct { + uint8_t data[DATA_SIZE]; + uint16_t len; + } exponent; + struct { + uint8_t data[DATA_SIZE]; + uint16_t len; + } modulus; + struct { + uint8_t data[DATA_SIZE]; + uint16_t len; + } result; +}; + struct cperf_test_vector* cperf_test_vector_get_dummy(struct cperf_options *options); @@ -90,9 +110,6 @@ extern uint8_t aad[]; extern uint8_t digest[2048]; -extern uint8_t perf_base[20]; -extern uint8_t perf_mod_p[129]; -extern uint8_t perf_mod_e[3]; -extern uint8_t perf_mod_result[sizeof(perf_mod_p)]; +extern struct cperf_modex_test_data modex_perf_data[4]; #endif diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 35a1193525..17e30a8e74 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -382,7 +382,7 @@ cperf_verify_devices_capabilities(struct cperf_options *opts, return -1; ret = rte_cryptodev_asym_xform_capability_check_modlen( - asym_capability, sizeof(perf_mod_p)); + asym_capability, opts->modex_data->modulus.len); if (ret != 0) return ret; diff --git a/doc/guides/tools/cryptoperf.rst b/doc/guides/tools/cryptoperf.rst index d3d5ebe4dc..cf3b147213 100644 --- a/doc/guides/tools/cryptoperf.rst +++ b/doc/guides/tools/cryptoperf.rst @@ -332,6 +332,11 @@ The following are the application command-line options: Enable fixed session based HFN instead of per packet HFN. +* ``--modex-len `` + + Set modex length for asymmetric crypto perf test. + Supported lengths are 60, 128, 255, 448. Default length is 128. + Test Vector File ~~~~~~~~~~~~~~~~ -- 2.25.1