From patchwork Thu Sep 19 12:12:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59453 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 73F7A1EFAE; Thu, 19 Sep 2019 13:54:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D35F01EF5D; Thu, 19 Sep 2019 13:54:20 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8JBokJN028488; Thu, 19 Sep 2019 04:54:20 -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=pfpt0818; bh=4XcpB1Xvk2cY+XMG0xV/0v0CRY/0LenZ64mB4LolnWI=; b=CGngaNQ+44zre/ZZYT7HSGW0EQ+2EZ4gGIEeFx+b4vZD+LqSPAXnMJ67ePU3Tta2GfsT ovdHx0eq/hEPNiVgeeoAWhbu80Mkii6zBH+I41vRWy65NJcemHfB3wVOiMwtOrEwHfX0 fDvPZowB0Ft+vU9+yko9y49Fe7cNSjzm+gj+cE6DzU2t8tNe0GTwnHC0oL0RwOnfvmQK 6uighOxR5RM32NR39tlCqknUcho/pe2PAfMkVcuwnoopNE5lWwOtdSYAXggDVYJCS31T UrASrxWsjK1QBq78rDo9MY2KlzJmoKYNBxipfWF+4opZuHr276HbM/hV6m9Lr7mQAzuO 3w== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:20 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 19 Sep 2019 04:54:18 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 19 Sep 2019 04:54:18 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 3732C3F703F; Thu, 19 Sep 2019 04:54:16 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:31 +0300 Message-ID: <20190919121232.4864-8-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 7/8] examples/fips_validation: improve algo parsing logic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michael Shamis The fix allows to find algorithm by folder name if the algorithm was not found from the test file header. In order to find algorithm used the folder name if it is not defined within the file. Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 9aa423b0f..4dde482e5 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -248,6 +248,48 @@ fips_test_parse_header(void) fprintf(info.fp_wr, "%s\n", info.vec[i]); } + /* use folder name if algorithm is not found yet*/ + if (info.algo == FIPS_TEST_ALGO_MAX) { + if (strstr(info.file_name, "AESVS")) { + info.algo = FIPS_TEST_ALGO_AES; + ret = parse_test_aes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "GCM")) { + info.algo = FIPS_TEST_ALGO_AES_GCM; + ret = parse_test_gcm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CMAC")) { + info.algo = FIPS_TEST_ALGO_AES_CMAC; + ret = parse_test_cmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CCM")) { + info.algo = FIPS_TEST_ALGO_AES_CCM; + ret = parse_test_ccm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "HMAC")) { + info.algo = FIPS_TEST_ALGO_HMAC; + ret = parse_test_hmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "TDES")) { + info.algo = FIPS_TEST_ALGO_TDES; + ret = parse_test_tdes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "SHA-")) { + if (info.algo != FIPS_TEST_ALGO_HMAC) { + info.algo = FIPS_TEST_ALGO_SHA; + ret = parse_test_sha_init(); + if (ret < 0) + return ret; + } + } + } + return 0; }