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 D6B1DA00C4; Mon, 30 May 2022 14:24:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D575142BB6; Mon, 30 May 2022 14:24:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 6912A42BB4 for ; Mon, 30 May 2022 14:24:11 +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 24UBWld4007791; Mon, 30 May 2022 05:24:10 -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=an2qh6mUJVeKNDaeWKSkO+9b5m3MQgSkPSCGqCx/kjQ=; b=Q0GPvG3dZQhMfNA8Wpi+w9IAfIRGKMh4n1ntx07yuw8Umd03qnkR+/V229+ZZvsDMbAF DZmYH5NexMUA01/7L8/c5cbM9Wru09qfsELR5GnOA8iBY3/fa/SH8KEjF7y0FXd9F2H6 jpeSwM+yzLyaSGefzsY5DiqjlesUq3mzDd0g29d8+VQi/iAOvA6qjZ1cO7IebZ8D6yYK ye2cqkRnNRm+EQRJHGe8SMnajOJcoQj6ZQT3nhY7SDc5P/VeOgfkXoHZECT9tVQz/1Wi 8nLGhYI5Z5JccZHhPSkCFU4VEPKXY64O9kZi+gkw0xNkWaVfbblMU3Igj0HaGV2NYsJS 2A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3gbk8n5c8y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 05:24:10 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 30 May 2022 05:24:08 -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; Mon, 30 May 2022 05:24:08 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 3FC7A3F7048; Mon, 30 May 2022 05:24:06 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Fan Zhang , Brian Dooley , , Anoob Joseph , Archana Muniganti , Jerin Jacob , Brandon Lo , "Gowrishankar Muthukrishnan" Subject: [v8, 08/10] examples/fips_validation: add parsing for cmac Date: Mon, 30 May 2022 17:53:28 +0530 Message-ID: <9f13d012f64ac826c586e7d6ce690d2001340f86.1653913201.git.gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 6jXu-0EJh7tTlwfMN6MvHms-03DAnK42 X-Proofpoint-GUID: 6jXu-0EJh7tTlwfMN6MvHms-03DAnK42 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-30_04,2022-05-30_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: Brandon Lo Added function to parse algorithm for CMAC test. Signed-off-by: Brandon Lo Signed-off-by: Gowrishankar Muthukrishnan -- v5: * parser_read_cmac_direction_str implementation moved to static. --- examples/fips_validation/fips_validation.c | 19 ++++++++++++++++--- examples/fips_validation/main.c | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index e8520f59cf..ab4c0d0eca 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -460,6 +460,8 @@ fips_test_parse_one_json_vector_set(void) info.algo = FIPS_TEST_ALGO_AES_GCM; if (strstr(algo_str, "HMAC")) info.algo = FIPS_TEST_ALGO_HMAC; + if (strstr(algo_str, "CMAC")) + info.algo = FIPS_TEST_ALGO_AES_CMAC; else return -EINVAL; @@ -470,7 +472,6 @@ int fips_test_parse_one_json_group(void) { int ret, i; - json_int_t val; json_t *param; if (info.interim_callbacks) { @@ -478,8 +479,20 @@ fips_test_parse_one_json_group(void) for (i = 0; info.interim_callbacks[i].key != NULL; i++) { param = json_object_get(json_info.json_test_group, info.interim_callbacks[i].key); - val = json_integer_value(param); - snprintf(json_value, 255, "%"JSON_INTEGER_FORMAT, val); + switch (json_typeof(param)) { + case JSON_STRING: + snprintf(json_value, 256, "%s", json_string_value(param)); + break; + + case JSON_INTEGER: + snprintf(json_value, 255, "%"JSON_INTEGER_FORMAT, + json_integer_value(param)); + break; + + default: + return -EINVAL; + } + /* First argument is blank because the key * is not included in the string being parsed. */ diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 2393559d0d..1645fa99e5 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1960,6 +1960,9 @@ fips_test_one_test_group(void) case FIPS_TEST_ALGO_HMAC: ret = parse_test_hmac_json_init(); break; + case FIPS_TEST_ALGO_AES_CMAC: + ret = parse_test_cmac_json_init(); + break; default: return -EINVAL; } -- 2.25.1