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 C5027A0555; Wed, 25 May 2022 17:46:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 507AF42B91; Wed, 25 May 2022 17:46:05 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 1FC3442B81 for ; Wed, 25 May 2022 17:46:03 +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 24P7Glo6020546; Wed, 25 May 2022 08:46:02 -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=vjGzwdbXk2tgEY/Emb2cmiyyRZ3h4eo0iyT4Wd3Vxas=; b=G+ioy8FoSXhYvykA9L8sDPuwTSeoZ7fqxpkK7wbmIy+4bqBtSfhi2OI7FOxI8JXk0uVE +pn7nL6mlyjTOCRTfhhlAYfX1ezaqXpGhkubdlmCS6VKgCG34JCCp4ay383I5v29MJkb mTOGadM8/gFuN3vVP8YcckwqgIlQp9Uw+Ny23NUa5nwdiVwkLdK/zNs6g3N6p5LuyGZL LaAJZRJ95WKqkDvX9RUkDhoMh5f2sKP7gzokByplMRhvjtEgblX34RgJ0tisLKw92206 gL5SKo8ulX7KKD1uiuftED60fUKv3ajR/cFqii+y0CdJE/QzbyqbdMnOka3sCh2iYr+1 PQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g93ty4fww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 25 May 2022 08:46:02 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 25 May 2022 08:45:58 -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 08:45:59 -0700 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 9CEB03F703F; Wed, 25 May 2022 08:45:56 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: Fan Zhang , Brian Dooley , , Anoob Joseph , Archana Muniganti , Jerin Jacob , Brandon Lo , "Gowrishankar Muthukrishnan" Subject: [v5, 02/11] examples/fips_validation: add json info to header Date: Wed, 25 May 2022 21:15:33 +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: IujGBqNgBXXKFAVnvBWTTiuVEjU1jj6E X-Proofpoint-ORIG-GUID: IujGBqNgBXXKFAVnvBWTTiuVEjU1jj6E 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 json-specific functions and other information needed to test the new FIPS test vectors. Signed-off-by: Brandon Lo Signed-off-by: Gowrishankar Muthukrishnan --- 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 ++++++++++++++++++++-- 2 files changed, 47 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); -- 2.25.1