diff options
| author | Gowrishankar Muthukrishnan <[email protected]> | 2022-08-12 17:22:00 +0530 |
|---|---|---|
| committer | Akhil Goyal <[email protected]> | 2022-10-07 11:06:35 +0200 |
| commit | 0f42f3d6034c9472dc43fba7fa29e5b826d23aee (patch) | |
| tree | 17fe76a4b7cc90c12e8298a326d6277604c67719 /examples/fips_validation | |
| parent | 6ea24fc7b894c9c0aa21e506eae9548770edc355 (diff) | |
examples/fips_validation: share callback with multiple keys
Make use of key param in test callbacks so that,
test callback can be shared with multiple keys.
Signed-off-by: Gowrishankar Muthukrishnan <[email protected]>
Acked-by: Brian Dooley <[email protected]>
Diffstat (limited to 'examples/fips_validation')
| -rw-r--r-- | examples/fips_validation/fips_validation.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index cd905b2c5b..8bbba92e3f 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -501,11 +501,8 @@ fips_test_parse_one_json_group(void) return -EINVAL; } - /* First argument is blank because the key - * is not included in the string being parsed. - */ ret = info.interim_callbacks[i].cb( - "", json_value, + info.interim_callbacks[i].key, json_value, info.interim_callbacks[i].val ); if (ret < 0) @@ -527,11 +524,8 @@ fips_test_parse_one_json_case(void) param = json_object_get(json_info.json_test_case, info.callbacks[i].key); if (param) { strcpy(info.one_line_text, json_string_value(param)); - /* First argument is blank because the key - * is not included in the string being parsed. - */ ret = info.callbacks[i].cb( - "", info.one_line_text, + info.callbacks[i].key, info.one_line_text, info.callbacks[i].val ); if (ret < 0) @@ -627,7 +621,14 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val) { uint32_t len, j; +#ifdef USE_JANSSON + /* + * Offset not applicable in case of JSON test vectors. + */ + RTE_SET_USED(key); +#else src += strlen(key); +#endif len = strlen(src) / 2; @@ -655,6 +656,15 @@ parse_uint8_hex_str(const char *key, char *src, struct fips_val *val) return 0; } +#ifdef USE_JANSSON +int +parser_read_uint32_val(const char *key, char *src, struct fips_val *val) +{ + 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) { @@ -678,6 +688,7 @@ 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) |
