DPDK patches and discussions
 help / color / mirror / Atom feed
From: Archana Muniganti <marchana@marvell.com>
To: <marko.kovacevic@intel.com>, <roy.fan.zhang@intel.com>,
	<akhil.goyal@nxp.com>
Cc: Ayuj Verma <ayverma@marvell.com>, <anoobj@marvell.com>,
	<pathreya@marvell.com>, <kkotamarthy@marvell.com>, <dev@dpdk.org>,
	<stable@dpdk.org>, Archana Muniganti <marchana@marvell.com>
Subject: [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors
Date: Thu, 11 Jun 2020 19:14:16 +0530	[thread overview]
Message-ID: <1591883057-11008-2-git-send-email-marchana@marvell.com> (raw)
In-Reply-To: <1591883057-11008-1-git-send-email-marchana@marvell.com>

From: Ayuj Verma <ayverma@marvell.com>

Processing of test vector for COUNT = 0 is getting skipped, as
some of the NIST TDES files doesn't have an empty line after
[ENCRYPT]/[DECRYPT] and thus treated as an interim block.

Parse function now identifies such blocks, separates out interim
and test vector data, and then parses each with their respective
callbacks.

Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application")

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Ayuj Verma <ayverma@marvell.com>
---
 examples/fips_validation/fips_validation.c | 21 +++++++++++++++------
 examples/fips_validation/fips_validation.h |  1 +
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index a34e34d..3aaec20 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -340,11 +340,13 @@
 fips_test_parse_one_case(void)
 {
 	uint32_t i, j = 0;
-	uint32_t is_interim = 0;
+	uint32_t is_interim;
+	uint32_t interim_cnt = 0;
 	int ret;
 
 	if (info.interim_callbacks) {
 		for (i = 0; i < info.nb_vec_lines; i++) {
+			is_interim = 0;
 			for (j = 0; info.interim_callbacks[j].key != NULL; j++)
 				if (strstr(info.vec[i],
 					info.interim_callbacks[j].key)) {
@@ -357,17 +359,24 @@
 					if (ret < 0)
 						return ret;
 				}
+
+			if (is_interim)
+				interim_cnt += 1;
 		}
 	}
 
-	if (is_interim) {
-		for (i = 0; i < info.nb_vec_lines; i++)
+	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");
-		return 1;
+
+		if (info.nb_vec_lines == interim_cnt)
+			return 1;
 	}
 
-	for (i = 0; i < info.nb_vec_lines; i++) {
+	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)) {
 				ret = info.callbacks[j].cb(
@@ -387,7 +396,7 @@
 {
 	uint32_t i;
 
-	for (i = 0; i < info.nb_vec_lines; i++)
+	for (i = info.vec_start_off; i < info.nb_vec_lines; i++)
 		fprintf(info.fp_wr, "%s\n", info.vec[i]);
 }
 
diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h
index 5aee955..75fa555 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -161,6 +161,7 @@ struct fips_test_interim_info {
 	enum fips_test_algorithms algo;
 	char *one_line_text;
 	char *vec[MAX_LINE_PER_VECTOR];
+	uint32_t vec_start_off;
 	uint32_t nb_vec_lines;
 	char device_name[MAX_STRING_SIZE];
 	char file_name[MAX_STRING_SIZE];
-- 
1.8.3.1


  reply	other threads:[~2020-06-11 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 13:44 [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Archana Muniganti
2020-06-11 13:44 ` Archana Muniganti [this message]
2020-06-11 13:44 ` [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for TDES vectors Archana Muniganti
2020-07-02 18:53 ` [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Akhil Goyal
2020-07-12 23:39   ` Thomas Monjalon
2020-07-15 20:00     ` Akhil Goyal

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=1591883057-11008-2-git-send-email-marchana@marvell.com \
    --to=marchana@marvell.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anoobj@marvell.com \
    --cc=ayverma@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kkotamarthy@marvell.com \
    --cc=marko.kovacevic@intel.com \
    --cc=pathreya@marvell.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=stable@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).