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 09624A0543; Fri, 12 Aug 2022 13:52:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB5D0406A2; Fri, 12 Aug 2022 13:52: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 90D5440685 for ; Fri, 12 Aug 2022 13:52:09 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27C8KKRc007059; Fri, 12 Aug 2022 04:52:09 -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=JUAV6xggQ6TkBBUeARuKjV0tG0qewpA8WRHwAmGsabo=; b=KD4ik7HYwCwVNwTJBR1NmLONRSrutNzt2X3hqBxL6edO+BR8dv8szZeT/9/n2EpK8jLr lhRAaVAbmIA2ntZhGLTVwDpTwj2Blcap04JCatuWKLc89Hia2J2BhPzeWIO9QYV+WZJK TX4tdfOkJImqjL7jnB7yqAit2z5pgwhIAEPg9s6bLWthkqlVvsdFvmqF+j/1sw7Ef8RS 4hQZwqcyfYFXyV90Vg5/2IQrp1/kjjHdry0Y10pkGSPWHiTE2M4NRhZhyb7xl800oPwA qxCZ3lNeY4IcwFr181X+kXGvfRO9TCz2cf5Vc1NLfEVabKGnVZWDyI4/+sC9k/2urbd2 Xg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3hwk8wgk09-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 12 Aug 2022 04:52:08 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 12 Aug 2022 04:52:06 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 12 Aug 2022 04:52:06 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 8548F5C68E3; Fri, 12 Aug 2022 04:52:04 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Anoob Joseph , Fan Zhang , Brian Dooley , Akhil Goyal , , Gowrishankar Muthukrishnan Subject: [PATCH v2 1/2] examples/fips_validation: share test callback with multiple keys Date: Fri, 12 Aug 2022 17:22:00 +0530 Message-ID: <20220812115201.1032352-1-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <73d188a54d126678538a1a2b7d8b9aae95e4e6d8.1657694117.git.gmuthukrishn@marvell.com> References: <73d188a54d126678538a1a2b7d8b9aae95e4e6d8.1657694117.git.gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: TVzzjKevmipEHS9lpBjtQOms6N3tA_D7 X-Proofpoint-ORIG-GUID: TVzzjKevmipEHS9lpBjtQOms6N3tA_D7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-12_08,2022-08-11_01,2022-06-22_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 Make use of key param in test callbacks so that, test callback can be shared with multiple keys. Signed-off-by: Gowrishankar Muthukrishnan --- examples/fips_validation/fips_validation.c | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 12b9b03f56..9678aa2161 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -499,11 +499,8 @@ fips_test_parse_one_json_group(void) return -EINVAL; } - /* First argument is blank because the key - * is not included in the string being parsed. - */ ret = info.interim_callbacks[i].cb( - "", json_value, + info.interim_callbacks[i].key, json_value, info.interim_callbacks[i].val ); if (ret < 0) @@ -525,11 +522,8 @@ fips_test_parse_one_json_case(void) param = json_object_get(json_info.json_test_case, info.callbacks[i].key); if (param) { strcpy(info.one_line_text, json_string_value(param)); - /* First argument is blank because the key - * is not included in the string being parsed. - */ ret = info.callbacks[i].cb( - "", info.one_line_text, + info.callbacks[i].key, info.one_line_text, info.callbacks[i].val ); if (ret < 0) @@ -625,7 +619,14 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val) { uint32_t len, j; +#ifdef USE_JANSSON + /* + * Offset not applicable in case of JSON test vectors. + */ + RTE_SET_USED(key); +#else src += strlen(key); +#endif len = strlen(src) / 2; @@ -653,6 +654,15 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val) return 0; } +#ifdef USE_JANSSON +int +parser_read_uint32_val(const char *key, char *src, struct fips_val *val) +{ + RTE_SET_USED(key); + + return parser_read_uint32(&val->len, src); +} +#else int parser_read_uint32_val(const char *key, char *src, struct fips_val *val) { @@ -676,6 +686,7 @@ parser_read_uint32_val(const char *key, char *src, struct fips_val *val) return ret; } +#endif int parser_read_uint32_bit_val(const char *key, char *src, struct fips_val *val) -- 2.25.1