[EXT] [PATCH v4 8/8] examples/fips_validation: add parsing for cmac
Gowrishankar Muthukrishnan
gmuthukrishn at marvell.com
Wed May 18 17:46:15 CEST 2022
Verified the functionality changes and looks good to me.
Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn at marvell.com>
Thanks.
> -----Original Message-----
> From: Brandon Lo <blo at iol.unh.edu>
> Sent: Friday, April 29, 2022 9:46 PM
> To: roy.fan.zhang at intel.com; ciara.power at intel.com
> Cc: dev at dpdk.org; Brandon Lo <blo at iol.unh.edu>
> Subject: [EXT] [PATCH v4 8/8] examples/fips_validation: add parsing for cmac
>
> External Email
>
> ----------------------------------------------------------------------
> Added function to parse algorithm for CMAC test.
>
> Signed-off-by: Brandon Lo <blo at iol.unh.edu>
> ---
> examples/fips_validation/fips_validation.c | 31 +++++++++++++++++++---
> examples/fips_validation/main.c | 3 +++
> 2 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/examples/fips_validation/fips_validation.c
> b/examples/fips_validation/fips_validation.c
> index 04dfb85262..8e0a55c624 100644
> --- a/examples/fips_validation/fips_validation.c
> +++ b/examples/fips_validation/fips_validation.c
> @@ -460,6 +460,8 @@ fips_test_parse_one_json_vector_set(void)
> info.algo = FIPS_TEST_ALGO_AES_GCM;
> if (strstr(algo_str, "HMAC"))
> info.algo = FIPS_TEST_ALGO_HMAC;
> + if (strstr(algo_str, "CMAC"))
> + info.algo = FIPS_TEST_ALGO_AES_CMAC;
> else
> return -EINVAL;
>
> @@ -470,7 +472,6 @@ int
> fips_test_parse_one_json_group(void)
> {
> int ret, i;
> - json_int_t val;
> json_t *param;
>
> if (info.interim_callbacks) {
> @@ -478,8 +479,20 @@ fips_test_parse_one_json_group(void)
> for (i = 0; info.interim_callbacks[i].key != NULL; i++) {
> param =
> json_object_get(json_info.json_test_group,
> info.interim_callbacks[i].key);
> - val = json_integer_value(param);
> - snprintf(json_value, 255,
> "%"JSON_INTEGER_FORMAT, val);
> + switch (json_typeof(param)) {
> + case JSON_STRING:
> + snprintf(json_value, 256, "%s",
> json_string_value(param));
> + break;
> +
> + case JSON_INTEGER:
> + snprintf(json_value, 255,
> "%"JSON_INTEGER_FORMAT,
> + json_integer_value(param));
> + break;
> +
> + default:
> + return -EINVAL;
> + }
> +
> /* First argument is blank because the key
> * is not included in the string being parsed.
> */
> @@ -673,6 +686,18 @@ parser_read_uint32_bit_val(const char *key, char
> *src, struct fips_val *val)
> return 0;
> }
>
> +int
> +parser_read_cmac_direction_str(__rte_unused const char *key, char *src,
> + __rte_unused struct fips_val *val)
> +{
> + if (strcmp(src, "gen") == 0)
> + info.op = FIPS_TEST_ENC_AUTH_GEN;
> + else if (strcmp(src, "ver") == 0)
> + info.op = FIPS_TEST_DEC_AUTH_VERIF;
> +
> + return 0;
> +}
> +
> int
> writeback_hex_str(const char *key, char *dst, struct fips_val *val) { diff --git
> a/examples/fips_validation/main.c b/examples/fips_validation/main.c index
> de6dedaf75..aa8034c29f 100644
> --- a/examples/fips_validation/main.c
> +++ b/examples/fips_validation/main.c
> @@ -1946,6 +1946,9 @@ fips_test_one_test_group(void)
> case FIPS_TEST_ALGO_HMAC:
> ret = parse_test_hmac_json_init();
> break;
> + case FIPS_TEST_ALGO_AES_CMAC:
> + ret = parse_test_cmac_json_init();
> + break;
> default:
> return -EINVAL;
> }
> --
> 2.25.1
More information about the dev
mailing list