[6/8] examples/fips_validation: fix overwrite of KEY line in TDES
Checks
Commit Message
From: Michael Shamis <michaelsh@marvell.com>
Fix for TCBCMonte2, TCBCMonte3 and TECBMonte2: application
overwrites key1 line in output file so comparision
with sample files failed
Signed-off-by: Michael Shamis <michaelsh@marvell.com>
---
examples/fips_validation/fips_validation.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
@@ -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;