* [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility
@ 2020-09-09 16:26 Archana Muniganti
2020-09-21 7:02 ` Archana Muniganti
0 siblings, 1 reply; 5+ messages in thread
From: Archana Muniganti @ 2020-09-09 16:26 UTC (permalink / raw)
To: roy.fan.zhang, marko.kovacevic, akhil.goyal
Cc: Archana Muniganti, anoobj, john.mcnamara, yux.jiang, qian.q.xu,
dev, stable
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility
2020-09-09 16:26 [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility Archana Muniganti
@ 2020-09-21 7:02 ` Archana Muniganti
2020-10-09 9:48 ` Zhang, Roy Fan
2020-10-09 9:50 ` Jiang, YuX
0 siblings, 2 replies; 5+ messages in thread
From: Archana Muniganti @ 2020-09-21 7:02 UTC (permalink / raw)
To: Archana Muniganti, roy.fan.zhang, marko.kovacevic, akhil.goyal
Cc: Anoob Joseph, john.mcnamara, yux.jiang, qian.q.xu, dev, stable
Hi Fan,
Could you please review the changes?
Thanks,
Archana
> -----Original Message-----
> From: Archana Muniganti <marchana@marvell.com>
> Sent: Wednesday, September 9, 2020 9:57 PM
> To: roy.fan.zhang@intel.com; marko.kovacevic@intel.com;
> akhil.goyal@nxp.com
> Cc: Archana Muniganti <marchana@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; john.mcnamara@intel.com; yux.jiang@intel.com;
> qian.q.xu@intel.com; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] examples/fips_validation: fix req file version incompatibility
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility
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
1 sibling, 1 reply; 5+ messages in thread
From: Zhang, Roy Fan @ 2020-10-09 9:48 UTC (permalink / raw)
To: Archana Muniganti, Kovacevic, Marko, akhil.goyal, Jiang, YuX
Cc: Anoob Joseph, Mcnamara, John, Xu, Qian Q, dev, stable
Hi Archana,
Sorry for late reply. Missed this one.
> -----Original Message-----
> From: Archana Muniganti <marchana@marvell.com>
> Sent: Monday, September 21, 2020 8:03 AM
> To: Archana Muniganti <marchana@marvell.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; akhil.goyal@nxp.com
> Cc: Anoob Joseph <anoobj@marvell.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Jiang, YuX <yux.jiang@intel.com>; Xu, Qian Q
> <qian.q.xu@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH] examples/fips_validation: fix req file version
> incompatibility
>
> Hi Fan,
>
> Could you please review the changes?
>
> Thanks,
> Archana
>
> > -----Original Message-----
> > From: Archana Muniganti <marchana@marvell.com>
> > Sent: Wednesday, September 9, 2020 9:57 PM
> > To: roy.fan.zhang@intel.com; marko.kovacevic@intel.com;
> > akhil.goyal@nxp.com
> > Cc: Archana Muniganti <marchana@marvell.com>; Anoob Joseph
> > <anoobj@marvell.com>; john.mcnamara@intel.com; yux.jiang@intel.com;
> > qian.q.xu@intel.com; dev@dpdk.org; stable@dpdk.org
> > Subject: [PATCH] examples/fips_validation: fix req file version
> incompatibility
> >
> > 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")
> >
Problems identified in https://bugs.dpdk.org/show_bug.cgi?id=512 is resolved by
this patch. Thanks @Jiang, YuX for validating the patch in advance.
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility
2020-09-21 7:02 ` Archana Muniganti
2020-10-09 9:48 ` Zhang, Roy Fan
@ 2020-10-09 9:50 ` Jiang, YuX
1 sibling, 0 replies; 5+ messages in thread
From: Jiang, YuX @ 2020-10-09 9:50 UTC (permalink / raw)
To: Archana Muniganti, Zhang, Roy Fan, Kovacevic, Marko, akhil.goyal
Cc: Anoob Joseph, Mcnamara, John, Xu, Qian Q, dev, stable, Jiang, YuX
Tested-by: Jiang, YuX <yux.jiang@intel.com>
Best Regards
Jiang yu
> > -----Original Message-----
> > From: Archana Muniganti <marchana@marvell.com>
> > Sent: Wednesday, September 9, 2020 9:57 PM
> > To: roy.fan.zhang@intel.com; marko.kovacevic@intel.com;
> > akhil.goyal@nxp.com
> > Cc: Archana Muniganti <marchana@marvell.com>; Anoob Joseph
> > <anoobj@marvell.com>; john.mcnamara@intel.com; yux.jiang@intel.com;
> > qian.q.xu@intel.com; dev@dpdk.org; stable@dpdk.org
> > Subject: [PATCH] examples/fips_validation: fix req file version
> > incompatibility
> >
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility
2020-10-09 9:48 ` Zhang, Roy Fan
@ 2020-10-09 18:18 ` Akhil Goyal
0 siblings, 0 replies; 5+ messages in thread
From: Akhil Goyal @ 2020-10-09 18:18 UTC (permalink / raw)
To: Zhang, Roy Fan, Archana Muniganti, Kovacevic, Marko, Jiang, YuX
Cc: Anoob Joseph, Mcnamara, John, Xu, Qian Q, dev, stable
> > >
> > > 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")
> > >
>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-09 18:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 16:26 [dpdk-dev] [PATCH] examples/fips_validation: fix req file version incompatibility Archana Muniganti
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
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).