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")
Cc: stable@dpdk.org
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Ayuj Verma <ayverma@marvell.com>
fips_test_parse_one_case(void)
{
uint32_t i, j = 0;
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++) {
int ret;
if (info.interim_callbacks) {
for (i = 0; i < info.nb_vec_lines; i++) {
for (j = 0; info.interim_callbacks[j].key != NULL; j++)
if (strstr(info.vec[i],
info.interim_callbacks[j].key)) {
for (j = 0; info.interim_callbacks[j].key != NULL; j++)
if (strstr(info.vec[i],
info.interim_callbacks[j].key)) {
if (ret < 0)
return ret;
}
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");
fprintf(info.fp_wr, "%s\n", info.vec[i]);
fprintf(info.fp_wr, "\n");
+
+ 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(
for (j = 0; info.callbacks[j].key != NULL; j++)
if (strstr(info.vec[i], info.callbacks[j].key)) {
ret = info.callbacks[j].cb(
- 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]);
}
fprintf(info.fp_wr, "%s\n", info.vec[i]);
}
enum fips_test_algorithms algo;
char *one_line_text;
char *vec[MAX_LINE_PER_VECTOR];
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];
uint32_t nb_vec_lines;
char device_name[MAX_STRING_SIZE];
char file_name[MAX_STRING_SIZE];