From: Michael Shamis <michae...@marvell.com>

Signed-off-by: Michael Shamis <michae...@marvell.com>
---
 examples/fips_validation/fips_validation.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 91e6d48e7..ba513672e 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -11,6 +11,10 @@
 
 #include "fips_validation.h"
 
+#define COUNT0_STR     "COUNT = 0  "
+#define KEY_STR                "KEY"
+#define NK_STR         "NumKey"
+
 #define skip_white_spaces(pos)                 \
 ({                                             \
        __typeof__(pos) _p = (pos);             \
@@ -68,6 +72,22 @@ fips_test_fetch_one_block(void)
                if (size == 0)
                        break;
 
+               /* if first line is KEY-line then insert COUNT-line */
+               if (i == 0) {
+                       if (strstr(info.one_line_text, KEY_STR)) {
+                               info.vec[0] = calloc(1, sizeof(COUNT0_STR));
+                               strlcpy(info.vec[0],
+                                               COUNT0_STR,
+                                               sizeof(COUNT0_STR));
+                               i = 1;
+                               info.nb_vec_lines = 1;
+                       }
+               }
+
+               /* don't copy NumKey-line */
+               if (strstr(info.one_line_text, NK_STR))
+                       break;
+
                info.vec[i] = calloc(1, size + 5);
                if (info.vec[i] == NULL)
                        goto error_exit;
-- 
2.23.0

Reply via email to