DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback
@ 2020-06-11 13:44 Archana Muniganti
  2020-06-11 13:44 ` [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors Archana Muniganti
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Archana Muniganti @ 2020-06-11 13:44 UTC (permalink / raw)
  To: marko.kovacevic, roy.fan.zhang, akhil.goyal
  Cc: Archana Muniganti, anoobj, pathreya, ayverma, kkotamarthy, dev, stable

Fix missing callback registration and the incorrect
callback definition for interim NK_STR. The callback
should compare input key against the interim.

Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")

Signed-off-by: Archana Muniganti <marchana@marvell.com>
---
 examples/fips_validation/fips_validation_tdes.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/examples/fips_validation/fips_validation_tdes.c b/examples/fips_validation/fips_validation_tdes.c
index 84dd288..a1ddd57 100644
--- a/examples/fips_validation/fips_validation_tdes.c
+++ b/examples/fips_validation/fips_validation_tdes.c
@@ -59,9 +59,7 @@ struct {
 parse_tdes_uint8_hex_str(const char *key, char *src, struct fips_val *val);
 
 static int
-parse_tdes_interim(const char *key,
-		__rte_unused char *text,
-		struct fips_val *val);
+parse_tdes_interim(const char *key, char *text, struct fips_val *val);
 
 struct fips_test_callback tdes_tests_vectors[] = {
 		{KEYS_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key},
@@ -77,6 +75,7 @@ struct fips_test_callback tdes_tests_vectors[] = {
 struct fips_test_callback tdes_tests_interim_vectors[] = {
 		{ENC_STR, parse_tdes_interim, NULL},
 		{DEC_STR, parse_tdes_interim, NULL},
+		{NK_STR, parse_tdes_interim, NULL},
 		{NULL, NULL, NULL} /**< end pointer */
 };
 
@@ -94,21 +93,23 @@ struct fips_test_callback tdes_writeback_callbacks[] = {
 };
 
 static int
-parse_tdes_interim(const char *key,
-		__rte_unused char *text,
+parse_tdes_interim(const char *key, char *text,
 		__rte_unused struct fips_val *val)
 {
 	if (strstr(key, ENC_STR))
 		info.op = FIPS_TEST_ENC_AUTH_GEN;
 	else if (strstr(key, DEC_STR))
 		info.op = FIPS_TEST_DEC_AUTH_VERIF;
-	else if (strstr(NK_STR, "NumKeys = 1"))
-		info.interim_info.tdes_data.nb_keys = 1;
-	else if (strstr(NK_STR, "NumKeys = 2"))
-		info.interim_info.tdes_data.nb_keys = 2;
-	else if (strstr(NK_STR, "NumKeys = 3"))
-		info.interim_info.tdes_data.nb_keys = 3;
-	else
+	else if (strstr(key, NK_STR)) {
+		if (strcmp(text, "NumKeys = 1") == 0)
+			info.interim_info.tdes_data.nb_keys = 1;
+		else if (strcmp(text, "NumKeys = 2") == 0)
+			info.interim_info.tdes_data.nb_keys = 2;
+		else if (strcmp(text, "NumKeys = 3") == 0)
+			info.interim_info.tdes_data.nb_keys = 3;
+		else
+			return -EINVAL;
+	} else
 		return -EINVAL;
 
 	return 0;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors
  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
  2020-06-11 13:44 ` [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for " Archana Muniganti
  2020-07-02 18:53 ` [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Akhil Goyal
  2 siblings, 0 replies; 6+ messages in thread
From: Archana Muniganti @ 2020-06-11 13:44 UTC (permalink / raw)
  To: marko.kovacevic, roy.fan.zhang, akhil.goyal
  Cc: Ayuj Verma, anoobj, pathreya, kkotamarthy, dev, stable,
	Archana Muniganti

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for TDES vectors
  2020-06-11 13:44 [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Archana Muniganti
  2020-06-11 13:44 ` [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors Archana Muniganti
@ 2020-06-11 13:44 ` Archana Muniganti
  2020-07-02 18:53 ` [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Akhil Goyal
  2 siblings, 0 replies; 6+ messages in thread
From: Archana Muniganti @ 2020-06-11 13:44 UTC (permalink / raw)
  To: marko.kovacevic, roy.fan.zhang, akhil.goyal
  Cc: Archana Muniganti, anoobj, pathreya, ayverma, kkotamarthy, dev, stable

Application updates first line of each test vector with
COUNT = i(where i = 1,2,3..) assuming first line contains
COUNT string. But few of the TDES input test vectors don't
contain COUNT string and thus COUNT is getting overwritten on
other data.

Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Kanaka Durga Kotamarthy <kkotamarthy@marvell.com>
---
 examples/fips_validation/fips_validation.c | 8 ++++++++
 examples/fips_validation/main.c            | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index 3aaec20..9bdf257 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -640,6 +640,14 @@
 
 	cb = &info.writeback_callbacks[0];
 
+	if (!(strstr(info.vec[0], cb->key))) {
+		fprintf(info.fp_wr, "%s%u\n", cb->key, count);
+		i = 0;
+	} else {
+		snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key,
+				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++) {
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index f9b2056..efd32a8 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -1070,7 +1070,10 @@ 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) {
+			if (!(strstr(info.vec[0], "COUNT")))
+				fprintf(info.fp_wr, "%s%u\n", "COUNT = ", 0);
+		} else
 			update_info_vec(i);
 
 		fips_test_write_one_case();
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback
  2020-06-11 13:44 [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Archana Muniganti
  2020-06-11 13:44 ` [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors Archana Muniganti
  2020-06-11 13:44 ` [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for " Archana Muniganti
@ 2020-07-02 18:53 ` Akhil Goyal
  2020-07-12 23:39   ` Thomas Monjalon
  2 siblings, 1 reply; 6+ messages in thread
From: Akhil Goyal @ 2020-07-02 18:53 UTC (permalink / raw)
  To: marko.kovacevic, roy.fan.zhang
  Cc: anoobj, pathreya, ayverma, kkotamarthy, dev, stable, Archana Muniganti

Hi Marko/Fan,

Could you please review this series?

> Subject: [PATCH 1/3] examples/fips_validation: fix TDES interim callback
> 
> Fix missing callback registration and the incorrect
> callback definition for interim NK_STR. The callback
> should compare input key against the interim.
> 
> Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
> 
> Signed-off-by: Archana Muniganti <marchana@marvell.com>

-Akhil

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2020-07-12 23:39 UTC (permalink / raw)
  To: marko.kovacevic, roy.fan.zhang, dev
  Cc: anoobj, pathreya, ayverma, kkotamarthy, dev, stable,
	Archana Muniganti, Akhil Goyal, john.mcnamara

02/07/2020 20:53, Akhil Goyal:
> Hi Marko/Fan,
> 
> Could you please review this series?

What happens? Nobody to review this?

> > Subject: [PATCH 1/3] examples/fips_validation: fix TDES interim callback
> > 
> > Fix missing callback registration and the incorrect
> > callback definition for interim NK_STR. The callback
> > should compare input key against the interim.
> > 
> > Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
> > 
> > Signed-off-by: Archana Muniganti <marchana@marvell.com>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback
  2020-07-12 23:39   ` Thomas Monjalon
@ 2020-07-15 20:00     ` Akhil Goyal
  0 siblings, 0 replies; 6+ messages in thread
From: Akhil Goyal @ 2020-07-15 20:00 UTC (permalink / raw)
  To: Thomas Monjalon, marko.kovacevic, roy.fan.zhang, dev, john.mcnamara
  Cc: anoobj, pathreya, ayverma, kkotamarthy, dev, stable, Archana Muniganti

> 02/07/2020 20:53, Akhil Goyal:
> > Hi Marko/Fan,
> >
> > Could you please review this series?
> 
> What happens? Nobody to review this?
> 
> > > Subject: [PATCH 1/3] examples/fips_validation: fix TDES interim callback
> > >
> > > Fix missing callback registration and the incorrect
> > > callback definition for interim NK_STR. The callback
> > > should compare input key against the interim.
> > >
> > > Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
> > >
> > > Signed-off-by: Archana Muniganti <marchana@marvell.com>
> 
> 
Cc: stable@dpdk.org added in all the commit messages of this patchset.

I believe Marvell people can take over the maintenance of this app.
Intel does not look interested maintaining this app.

Applied to dpdk-next-crypto without review, as it is pending for review for more than 5 weeks.

Thanks. 



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-15 20:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 13:44 [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback Archana Muniganti
2020-06-11 13:44 ` [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors Archana Muniganti
2020-06-11 13:44 ` [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for " 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

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).