examples/fips_validation: fix block parsing

When parsing request files check for file type. This fix will remove
dependence on command line parameter for using libjansson

Fixes: 0f42f3d603 ("examples/fips_validation: share callback with multiple keys")

Signed-off-by: Brian Dooley <brian.dooley@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
This commit is contained in:
Brian Dooley 2022-10-24 10:36:51 +00:00 committed by Akhil Goyal
parent c05f2e9688
commit 10d64144b0

View File

@ -646,10 +646,11 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val)
/*
* Offset not applicable in case of JSON test vectors.
*/
RTE_SET_USED(key);
#else
src += strlen(key);
if (info.file_type == FIPS_TYPE_JSON) {
RTE_SET_USED(key);
} else
#endif
src += strlen(key);
len = strlen(src) / 2;
@ -677,18 +678,16 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val)
return 0;
}
int
parser_read_uint32_val(const char *key, char *src, struct fips_val *val)
{
#ifdef USE_JANSSON
int
parser_read_uint32_val(const char *key, char *src, struct fips_val *val)
{
RTE_SET_USED(key);
if (info.file_type == FIPS_TYPE_JSON) {
RTE_SET_USED(key);
return parser_read_uint32(&val->len, src);
}
#else
int
parser_read_uint32_val(const char *key, char *src, struct fips_val *val)
{
return parser_read_uint32(&val->len, src);
}
# endif
char *data = src + strlen(key);
size_t data_len = strlen(data);
int ret;
@ -709,7 +708,6 @@ parser_read_uint32_val(const char *key, char *src, struct fips_val *val)
return ret;
}
#endif
int
parser_read_uint32_bit_val(const char *key, char *src, struct fips_val *val)