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 D43F2A0558; Thu, 26 May 2022 10:02:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25A9E427F3; Thu, 26 May 2022 10:02:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3393F42684 for ; Thu, 26 May 2022 10:02:38 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24Q2AfQn003176; Thu, 26 May 2022 01:02:37 -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=hm33x41NwoAhw1m+TkooAwyBG1HMFKvnLzJAUBCTTlE=; b=XJSO0X1SHXeSOHXuvVnC+SkC4Ue8H6D9eZPQPWubsNMFyO8N4O/heDE9oE+3eUmvrlsI 8/warodYMNG51KkZ6eqcdKyG3fwjK/lI6QNtcVrTBIseNmL4/REtv82sO1GjU3i2m+RE /9O04K4LGVPfLH8zJkVHCgDbIxlDug3eSWS7e4mUgrnCIRp1xN5FB0laGkiL2styCOoW lbGuXGaSyn8vud6/7TFZP87bWE19w3bTOgdU+kvvVtGsmPx8vKZPZkLmgDu/ks0l1AI3 7Pzoe3SqGedFiAl7jIFIc9P29+IqnQl62gRL3FKQ5GKQk187apcH6zy8gRQam3zkOIIX rg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3g9jap4qkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 May 2022 01:02:37 -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; Thu, 26 May 2022 01:02:35 -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:35 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id EC9FF3F703F; Thu, 26 May 2022 01:02:32 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Fan Zhang , Brian Dooley , , Anoob Joseph , Archana Muniganti , Jerin Jacob , Brandon Lo , "Gowrishankar Muthukrishnan" Subject: [v7, 02/11] examples/fips_validation: add json info to header Date: Thu, 26 May 2022 13:32:15 +0530 Message-ID: <06fc0444ab11420680f8078ba50a007fd145c278.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: rghPfAT_Pta8ypmhZ0puQk02G9S9LI1u X-Proofpoint-ORIG-GUID: rghPfAT_Pta8ypmhZ0puQk02G9S9LI1u 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 json-specific functions and other information needed to test the new FIPS test vectors. Signed-off-by: Brandon Lo Signed-off-by: Gowrishankar Muthukrishnan --- v7: * fix switch clause for info.file_type. v5: * fix typo in macro name for prefixes. v2: * fix type of prefix to suffix --- examples/fips_validation/fips_validation.c | 6 +-- examples/fips_validation/fips_validation.h | 48 ++++++++++++++++++++-- examples/fips_validation/main.c | 2 + 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 94253eaee8..38c99b291c 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -270,11 +270,11 @@ parse_file_type(const char *path) { const char *tmp = path + strlen(path) - 3; - if (strstr(tmp, REQ_FILE_PERFIX)) + if (strstr(tmp, REQ_FILE_PREFIX)) info.file_type = FIPS_TYPE_REQ; - else if (strstr(tmp, RSP_FILE_PERFIX)) + else if (strstr(tmp, RSP_FILE_PREFIX)) info.file_type = FIPS_TYPE_RSP; - else if (strstr(path, FAX_FILE_PERFIX)) + else if (strstr(path, FAX_FILE_PREFIX)) info.file_type = FIPS_TYPE_FAX; else return -EINVAL; diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index aaadf01ba8..a1c83a9a6a 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -5,6 +5,10 @@ #ifndef _FIPS_VALIDATION_H_ #define _FIPS_VALIDATION_H_ +#ifdef RTE_HAS_JANSSON +#include +#endif /* RTE_HAS_JANSSON */ + #define FIPS_PARSE_ERR(fmt, args) \ RTE_LOG(ERR, USER1, "FIPS parse error" ## fmt ## "\n", ## args) @@ -21,9 +25,12 @@ #define POSITIVE_TEST 0 #define NEGATIVE_TEST -1 -#define REQ_FILE_PERFIX "req" -#define RSP_FILE_PERFIX "rsp" -#define FAX_FILE_PERFIX "fax" +#define REQ_FILE_PREFIX "req" +#define RSP_FILE_PREFIX "rsp" +#define FAX_FILE_PREFIX "fax" +#define JSON_FILE_PREFIX "json" + +#define ACVVERSION "1.0" enum fips_test_algorithms { FIPS_TEST_ALGO_AES = 0, @@ -40,7 +47,8 @@ enum fips_test_algorithms { enum file_types { FIPS_TYPE_REQ = 1, FIPS_TYPE_FAX, - FIPS_TYPE_RSP + FIPS_TYPE_RSP, + FIPS_TYPE_JSON, }; enum fips_test_op { @@ -161,6 +169,23 @@ struct gcm_interim_data { uint8_t gen_iv; }; +#ifdef RTE_HAS_JANSSON +struct fips_test_json_info { + /* Information used for reading from json */ + json_t *json_root; + json_t *json_vector_set; + json_t *json_test_group; + json_t *json_test_case; + /* Location of json write output */ + json_t *json_write_root; + json_t *json_write_group; + json_t *json_write_set; + json_t *json_write_case; + /* Other info */ + uint8_t is_sample; +}; +#endif /* RTE_HAS_JANSSON */ + struct fips_test_interim_info { FILE *fp_rd; FILE *fp_wr; @@ -196,6 +221,10 @@ struct fips_test_interim_info { extern struct fips_test_vector vec; extern struct fips_test_interim_info info; +#ifdef RTE_HAS_JANSSON +extern struct fips_test_json_info json_info; +#endif /* RTE_HAS_JANSSON */ + int fips_test_init(const char *req_file_path, const char *rsp_file_path, const char *device_name); @@ -212,6 +241,17 @@ fips_test_parse_one_case(void); void fips_test_write_one_case(void); +#ifdef RTE_HAS_JANSSON +int +fips_test_parse_one_json_vector_set(void); + +int +fips_test_parse_one_json_group(void); + +int +fips_test_parse_one_json_case(void); +#endif /* RTE_HAS_JANSSON */ + int parse_test_aes_init(void); diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index e06ae37567..554d74cda0 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1251,6 +1251,8 @@ fips_generic_test(void) if (ret < 0) return ret; break; + default: + break; } fprintf(info.fp_wr, "\n"); -- 2.25.1