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 B8821A0558; Thu, 26 May 2022 10:03:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A91B42B81; Thu, 26 May 2022 10:02:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 320B342B81 for ; Thu, 26 May 2022 10:02:57 +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 24Q2B6jn029495; Thu, 26 May 2022 01:02:55 -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=d16FF7sjGr0JuUvwLlX55lTwGHaxiFiqGffA65NMTEE=; b=V7JvmdBSR//twhBU/huaE42IXHQz2OV9+ca5hYIwyf45OIQAcqhlA7yKncif9yF0j/Gy CHjFTdxUGGEj3EqxTVKDUecZO07UnT/c2fNaJw5r3b4LsXOAOdz9TAqUpC0AhNkzC2zL DmXKcoEg6Y4opNhjuCo0cVScRWJ0hy/5Pu8v1J2kVPTg9enfTdzTkKblN8ReVg9wkLCY rfRz7kbGmlVQKwnaWoOE36U/TQNRxufwebDniFfvMmbdZx7tJfPuNO67xpqqAT4qpFc3 L5/HXyvhWONQH1QW4AmF+an7nmA8ul5DII4ifNpTAgg+uYFLWcqA9l0L+TorGq2OsR0Q VQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g93ty7ugt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 May 2022 01:02:55 -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; Thu, 26 May 2022 01:02:53 -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; Thu, 26 May 2022 01:02:53 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id DD74C3F703F; Thu, 26 May 2022 01:02:50 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Fan Zhang , Brian Dooley , , Anoob Joseph , Archana Muniganti , Jerin Jacob , Brandon Lo , "Gowrishankar Muthukrishnan" Subject: [v7, 08/11] examples/fips_validation: add parsing for cmac Date: Thu, 26 May 2022 13:32:21 +0530 Message-ID: <593f0e542ae7d618f08ad409ffaa26602ec44544.1653551880.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-GUID: nfC1nr1aH8N7X4F6JouUjdRzo50q9NUc X-Proofpoint-ORIG-GUID: nfC1nr1aH8N7X4F6JouUjdRzo50q9NUc 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-26_02,2022-05-25_02,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 45b453b913..d104d82221 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1947,6 +1947,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