From patchwork Wed Sep 9 16:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archana Muniganti X-Patchwork-Id: 77079 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C662A04B5; Wed, 9 Sep 2020 18:26:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E764E1BF8F; Wed, 9 Sep 2020 18:26:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 93BDE1BF8D; Wed, 9 Sep 2020 18:26:51 +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 089GPUOa022449; Wed, 9 Sep 2020 09:26:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=vhwNk911efNcVsnTKgePDbqpD6dIKK/tx8fyYkVXKoU=; b=Ed/EmgX5M5UMlV7g7Ac4acHmVmd+ov88ks6giSjeFnWz0RJIgG8DVN3axQ2iNMs3w+1M F+A2jmhNYVKh/H3WUTA4szDjJmJ2ncb2GIZabo4NEIopMwuYmnmFnGUg3veVTGr3elx+ Fg3zynG4g2S7unCP8citnXYnf85p7HngVg7hmRUJ8EN7zmvm2jOiCL2EujY9OLBNTCYi 7YgdhSVBtmedf3hW9XaQxWSn3JW240UY7UN8UwLMIc/lHXpOfvySiFdlwmM0c3bbIrJc Wce+47mfB5zBmA0EDx3N69PNNMiV7NZXTUKF79rvOXnPQGykbWLMHW/U7163uIBj0eaM VQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 33ccvr77jb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 09 Sep 2020 09:26:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Sep 2020 09:26:49 -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.2 via Frontend Transport; Wed, 9 Sep 2020 09:26:49 -0700 Received: from hyd1409.caveonetworks.com (unknown [10.29.45.15]) by maili.marvell.com (Postfix) with ESMTP id 164083F703F; Wed, 9 Sep 2020 09:26:45 -0700 (PDT) From: Archana Muniganti To: , , CC: Archana Muniganti , , , , , , Date: Wed, 9 Sep 2020 21:56:35 +0530 Message-ID: <1599668795-11278-1-git-send-email-marchana@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-09_12:2020-09-09, 2020-09-09 signatures=0 Subject: [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility 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" Separate out CAVS request file version 21.4 code to support lower versions. Fixes: 32440cdf2af9 ("examples/fips_validation: fix parsing of TDES vectors") Fixes: 2b84d2bd47df ("examples/fips_validation: fix count overwrite for TDES") Signed-off-by: Archana Muniganti Acked-by: Fan Zhang Tested-by: Jiang, YuX --- examples/fips_validation/fips_validation.c | 42 ++++++++++++++++++++++-------- examples/fips_validation/fips_validation.h | 1 + examples/fips_validation/main.c | 6 +++-- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 9bdf257..317f6c9 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -92,6 +92,15 @@ return -ENOMEM; } +static void +fips_test_parse_version(void) +{ + int len = strlen(info.vec[0]); + char *ptr = info.vec[0]; + + info.version = strtof(ptr + len - 4, NULL); +} + static int fips_test_parse_header(void) { @@ -106,7 +115,10 @@ if (ret < 0) return ret; - for (i = 0; i < info.nb_vec_lines; i++) { + if (info.nb_vec_lines) + fips_test_parse_version(); + + for (i = 1; i < info.nb_vec_lines; i++) { if (!algo_parsed) { if (strstr(info.vec[i], "AESVS")) { algo_parsed = 1; @@ -344,6 +356,8 @@ uint32_t interim_cnt = 0; int ret; + info.vec_start_off = 0; + if (info.interim_callbacks) { for (i = 0; i < info.nb_vec_lines; i++) { is_interim = 0; @@ -365,17 +379,24 @@ } } - info.vec_start_off = interim_cnt; - if (interim_cnt) { - for (i = 0; i < interim_cnt; i++) - fprintf(info.fp_wr, "%s\n", info.vec[i]); - fprintf(info.fp_wr, "\n"); - - if (info.nb_vec_lines == interim_cnt) + if (info.version == 21.4f) { + for (i = 0; i < interim_cnt; i++) + fprintf(info.fp_wr, "%s\n", info.vec[i]); + fprintf(info.fp_wr, "\n"); + + if (info.nb_vec_lines == interim_cnt) + return 1; + } else { + for (i = 0; i < info.nb_vec_lines; i++) + fprintf(info.fp_wr, "%s\n", info.vec[i]); + fprintf(info.fp_wr, "\n"); return 1; + } } + info.vec_start_off = interim_cnt; + for (i = info.vec_start_off; i < info.nb_vec_lines; i++) { for (j = 0; info.callbacks[j].key != NULL; j++) if (strstr(info.vec[i], info.callbacks[j].key)) { @@ -640,7 +661,7 @@ cb = &info.writeback_callbacks[0]; - if (!(strstr(info.vec[0], cb->key))) { + if ((info.version == 21.4f) && (!(strstr(info.vec[0], cb->key)))) { fprintf(info.fp_wr, "%s%u\n", cb->key, count); i = 0; } else { @@ -648,9 +669,8 @@ count); i = 1; } - snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key, count); - for (i = 1; i < info.nb_vec_lines; i++) { + for (; i < info.nb_vec_lines; i++) { for (j = 1; info.writeback_callbacks[j].key != NULL; j++) { cb = &info.writeback_callbacks[j]; if (strstr(info.vec[i], cb->key)) { diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 75fa555..a25958d 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -165,6 +165,7 @@ struct fips_test_interim_info { uint32_t nb_vec_lines; char device_name[MAX_STRING_SIZE]; char file_name[MAX_STRING_SIZE]; + float version; union { struct aesavs_interim_data aes_data; diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index efd32a8..6edb83e 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1070,10 +1070,12 @@ struct fips_test_ops { int test_mode = info.interim_info.tdes_data.test_mode; for (i = 0; i < TDES_EXTERN_ITER; i++) { - if (i == 0) { + if ((i == 0) && (info.version == 21.4f)) { if (!(strstr(info.vec[0], "COUNT"))) fprintf(info.fp_wr, "%s%u\n", "COUNT = ", 0); - } else + } + + if (i != 0) update_info_vec(i); fips_test_write_one_case();