patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Archana Muniganti <marchana@marvell.com>
To: <roy.fan.zhang@intel.com>, <marko.kovacevic@intel.com>,
	<akhil.goyal@nxp.com>
Cc: Archana Muniganti <marchana@marvell.com>, <anoobj@marvell.com>,
	<john.mcnamara@intel.com>, <yux.jiang@intel.com>,
	<qian.q.xu@intel.com>, <dev@dpdk.org>, <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH] examples/fips_validation: fix req file version incompatibility
Date: Wed, 9 Sep 2020 21:56:35 +0530
Message-ID: <1599668795-11278-1-git-send-email-marchana@marvell.com> (raw)

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 <marchana@marvell.com>
---
 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();
-- 
1.8.3.1


             reply	other threads:[~2020-09-09 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 16:26 Archana Muniganti [this message]
2020-09-21  7:02 ` Archana Muniganti
2020-10-09  9:48   ` Zhang, Roy Fan
2020-10-09 18:18     ` Akhil Goyal
2020-10-09  9:50   ` Jiang, YuX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1599668795-11278-1-git-send-email-marchana@marvell.com \
    --to=marchana@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=qian.q.xu@intel.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=yux.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git