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 04F20A0555; Wed, 25 May 2022 19:15:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA8C341133; Wed, 25 May 2022 19:14:41 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7A1E442B89 for ; Wed, 25 May 2022 19:14:40 +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 24PH1H44020591; Wed, 25 May 2022 10:14:39 -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=Z8lFW2AmXT9r692GD1EPxFHFISgdv7NIHXvwHAdhmOY=; b=Y/pFaUz3D3UADgsVpGYWhDkdBdWEn6qqXE+BimPflso2ta8WNJSncV0SbMw1Go97LwpA Vz1HRf69Bt/5MI2+/P71B8iZaJ+x8JIxuuSsjMo24Yuqi6TJLw54ZLA+b3sXCdrArb54 HGOIbgig9sCeKfe/2z92hpTifA8MVW6yeoZE6TtX0zA+6OnRUfdX3qm/+dgNDlrRAY0A mZZmpPEabWB2RlWu7ijB5P56DnR0qUHNLziSTJLXaNGDhcaVaXDBDbTjXQDYRnqrk1CP V3S6R2KckibEyvNGNswig3GQZoUw/4xKtGwoHXRIONc13Uorxr2KIWSTvp5U7tBYrgge tg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g93ty4w67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 25 May 2022 10:14:39 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 25 May 2022 10:14:37 -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; Wed, 25 May 2022 10:14:37 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 279B13F7078; Wed, 25 May 2022 10:14:34 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Fan Zhang , Brian Dooley , , Anoob Joseph , Archana Muniganti , Jerin Jacob , Brandon Lo , "Gowrishankar Muthukrishnan" Subject: [v6, 08/11] examples/fips_validation: add parsing for cmac Date: Wed, 25 May 2022 22:43:44 +0530 Message-ID: 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: zDqSuJedfIgFXtVFtN_MiMwYJGPreFIj X-Proofpoint-ORIG-GUID: zDqSuJedfIgFXtVFtN_MiMwYJGPreFIj 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-25_04,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 261e2c4c99..9df6abf47f 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1945,6 +1945,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