* [PATCH v1] examples/fips_validation: add parsing for AES GMAC @ 2022-08-19 9:46 Brian Dooley 2022-09-01 10:35 ` [PATCH v2] " Brian Dooley 0 siblings, 1 reply; 6+ messages in thread From: Brian Dooley @ 2022-08-19 9:46 UTC (permalink / raw) To: Fan Zhang, Brian Dooley; +Cc: dev, gmuthukrishn, gakhil, kai.ji Added functionality to parse algorithm for AES GMAC test Signed-off-by: Brian Dooley <brian.dooley@intel.com> --- examples/fips_validation/fips_validation.c | 2 ++ examples/fips_validation/fips_validation.h | 1 + examples/fips_validation/main.c | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 12b9b03f56..5c7ecce412 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -458,6 +458,8 @@ fips_test_parse_one_json_vector_set(void) /* Vector sets contain the algorithm type, and nothing else we need. */ if (strstr(algo_str, "AES-GCM")) info.algo = FIPS_TEST_ALGO_AES_GCM; + else if (strstr(algo_str, "AES-GMAC")) + info.algo = FIPS_TEST_ALGO_AES_GMAC; else if (strstr(algo_str, "HMAC")) info.algo = FIPS_TEST_ALGO_HMAC; else if (strstr(algo_str, "CMAC")) diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5c1abcbd91..24edab68da 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -36,6 +36,7 @@ enum fips_test_algorithms { FIPS_TEST_ALGO_AES = 0, FIPS_TEST_ALGO_AES_CBC, FIPS_TEST_ALGO_AES_GCM, + FIPS_TEST_ALGO_AES_GMAC, FIPS_TEST_ALGO_AES_CMAC, FIPS_TEST_ALGO_AES_CCM, FIPS_TEST_ALGO_AES_XTS, diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 8bd5a66889..070a42e8dd 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1817,6 +1817,11 @@ init_test_ops(void) else test_ops.test = fips_generic_test; break; + case FIPS_TEST_ALGO_AES_GMAC: + test_ops.prepare_op = prepare_auth_op; + test_ops.prepare_xform = prepare_gmac_xform; + test_ops.test = fips_generic_test; + break; case FIPS_TEST_ALGO_AES_GCM: test_ops.prepare_op = prepare_aead_op; test_ops.prepare_xform = prepare_gcm_xform; @@ -1994,6 +1999,7 @@ fips_test_one_test_group(void) json_object_set_new(json_info.json_write_group, "tests", write_tests); switch (info.algo) { + case FIPS_TEST_ALGO_AES_GMAC: case FIPS_TEST_ALGO_AES_GCM: ret = parse_test_gcm_json_init(); break; -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] examples/fips_validation: add parsing for AES GMAC 2022-08-19 9:46 [PATCH v1] examples/fips_validation: add parsing for AES GMAC Brian Dooley @ 2022-09-01 10:35 ` Brian Dooley 2022-09-15 13:20 ` Ji, Kai 2022-09-16 8:59 ` [PATCH v3] " Brian Dooley 0 siblings, 2 replies; 6+ messages in thread From: Brian Dooley @ 2022-09-01 10:35 UTC (permalink / raw) To: Fan Zhang, Brian Dooley; +Cc: dev, gmuthukrishn, gakhil, kai.ji Added functionality to parse algorithm for AES GMAC test Signed-off-by: Brian Dooley <brian.dooley@intel.com> --- v2: add random internal iv generation --- examples/fips_validation/fips_validation.c | 2 ++ examples/fips_validation/fips_validation.h | 1 + .../fips_validation/fips_validation_gcm.c | 13 ++++++------ examples/fips_validation/main.c | 21 +++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 12b9b03f56..5c7ecce412 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -458,6 +458,8 @@ fips_test_parse_one_json_vector_set(void) /* Vector sets contain the algorithm type, and nothing else we need. */ if (strstr(algo_str, "AES-GCM")) info.algo = FIPS_TEST_ALGO_AES_GCM; + else if (strstr(algo_str, "AES-GMAC")) + info.algo = FIPS_TEST_ALGO_AES_GMAC; else if (strstr(algo_str, "HMAC")) info.algo = FIPS_TEST_ALGO_HMAC; else if (strstr(algo_str, "CMAC")) diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5c1abcbd91..24edab68da 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -36,6 +36,7 @@ enum fips_test_algorithms { FIPS_TEST_ALGO_AES = 0, FIPS_TEST_ALGO_AES_CBC, FIPS_TEST_ALGO_AES_GCM, + FIPS_TEST_ALGO_AES_GMAC, FIPS_TEST_ALGO_AES_CMAC, FIPS_TEST_ALGO_AES_CCM, FIPS_TEST_ALGO_AES_XTS, diff --git a/examples/fips_validation/fips_validation_gcm.c b/examples/fips_validation/fips_validation_gcm.c index 6b3d158629..7e1bd77faf 100644 --- a/examples/fips_validation/fips_validation_gcm.c +++ b/examples/fips_validation/fips_validation_gcm.c @@ -291,13 +291,14 @@ parse_test_gcm_json_writeback(struct fips_val *val) if (info.op == FIPS_TEST_ENC_AUTH_GEN) { json_t *ct; + if (!info.interim_info.gcm_data.is_gmac) { + tmp_val.val = val->val; + tmp_val.len = vec.pt.len; - tmp_val.val = val->val; - tmp_val.len = vec.pt.len; - - writeback_hex_str("", info.one_line_text, &tmp_val); - ct = json_string(info.one_line_text); - json_object_set_new(json_info.json_write_case, CT_JSON_STR, ct); + writeback_hex_str("", info.one_line_text, &tmp_val); + ct = json_string(info.one_line_text); + json_object_set_new(json_info.json_write_case, CT_JSON_STR, ct); + } if (info.interim_info.gcm_data.gen_iv) { json_t *iv; diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 8bd5a66889..9118ca4d92 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -669,6 +669,21 @@ prepare_auth_op(void) __rte_crypto_op_reset(env.op, RTE_CRYPTO_OP_TYPE_SYMMETRIC); + if (info.interim_info.gcm_data.gen_iv == 1) { + uint32_t i; + + if (!vec.iv.val) { + vec.iv.val = rte_malloc(0, vec.iv.len, 0); + if (!vec.iv.val) + return -ENOMEM; + } + + for (i = 0; i < vec.iv.len; i++) { + int random = rand(); + vec.iv.val[i] = (uint8_t)random; + } + } + if (vec.iv.len) { uint8_t *iv = rte_crypto_op_ctod_offset(env.op, uint8_t *, IV_OFF); @@ -1817,6 +1832,11 @@ init_test_ops(void) else test_ops.test = fips_generic_test; break; + case FIPS_TEST_ALGO_AES_GMAC: + test_ops.prepare_op = prepare_auth_op; + test_ops.prepare_xform = prepare_gmac_xform; + test_ops.test = fips_generic_test; + break; case FIPS_TEST_ALGO_AES_GCM: test_ops.prepare_op = prepare_aead_op; test_ops.prepare_xform = prepare_gcm_xform; @@ -1994,6 +2014,7 @@ fips_test_one_test_group(void) json_object_set_new(json_info.json_write_group, "tests", write_tests); switch (info.algo) { + case FIPS_TEST_ALGO_AES_GMAC: case FIPS_TEST_ALGO_AES_GCM: ret = parse_test_gcm_json_init(); break; -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] examples/fips_validation: add parsing for AES GMAC 2022-09-01 10:35 ` [PATCH v2] " Brian Dooley @ 2022-09-15 13:20 ` Ji, Kai 2022-09-16 8:59 ` [PATCH v3] " Brian Dooley 1 sibling, 0 replies; 6+ messages in thread From: Ji, Kai @ 2022-09-15 13:20 UTC (permalink / raw) To: Dooley, Brian, Zhang, Roy Fan; +Cc: dev, gmuthukrishn, gakhil > -----Original Message----- > From: Dooley, Brian <brian.dooley@intel.com> > Sent: Thursday, September 1, 2022 11:35 AM > To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; Dooley, Brian > <brian.dooley@intel.com> > Cc: dev@dpdk.org; gmuthukrishn@marvell.com; gakhil@marvell.com; Ji, Kai > <kai.ji@intel.com> > Subject: [PATCH v2] examples/fips_validation: add parsing for AES GMAC > > Added functionality to parse algorithm for AES GMAC test > > Signed-off-by: Brian Dooley <brian.dooley@intel.com> > --- > v2: add random internal iv generation > --- Acked-by: Ji, Kai <kai.ji@intel.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] examples/fips_validation: add parsing for AES GMAC 2022-09-01 10:35 ` [PATCH v2] " Brian Dooley 2022-09-15 13:20 ` Ji, Kai @ 2022-09-16 8:59 ` Brian Dooley 2022-09-16 17:06 ` [EXT] " Gowrishankar Muthukrishnan 2022-10-10 19:50 ` Akhil Goyal 1 sibling, 2 replies; 6+ messages in thread From: Brian Dooley @ 2022-09-16 8:59 UTC (permalink / raw) To: Fan Zhang, Brian Dooley; +Cc: dev, gmuthukrishn, gakhil, kai.ji Added functionality to parse algorithm for AES GMAC test Signed-off-by: Brian Dooley <brian.dooley@intel.com> Acked-by: Kai Ji <kai.ji@intel.com> --- v2: add random internal iv generation --- v3: in reply to fix and patchwork CI --- examples/fips_validation/fips_validation.c | 2 ++ examples/fips_validation/fips_validation.h | 1 + .../fips_validation/fips_validation_gcm.c | 13 ++++++------ examples/fips_validation/main.c | 21 +++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 12b9b03f56..5c7ecce412 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -458,6 +458,8 @@ fips_test_parse_one_json_vector_set(void) /* Vector sets contain the algorithm type, and nothing else we need. */ if (strstr(algo_str, "AES-GCM")) info.algo = FIPS_TEST_ALGO_AES_GCM; + else if (strstr(algo_str, "AES-GMAC")) + info.algo = FIPS_TEST_ALGO_AES_GMAC; else if (strstr(algo_str, "HMAC")) info.algo = FIPS_TEST_ALGO_HMAC; else if (strstr(algo_str, "CMAC")) diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5c1abcbd91..24edab68da 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -36,6 +36,7 @@ enum fips_test_algorithms { FIPS_TEST_ALGO_AES = 0, FIPS_TEST_ALGO_AES_CBC, FIPS_TEST_ALGO_AES_GCM, + FIPS_TEST_ALGO_AES_GMAC, FIPS_TEST_ALGO_AES_CMAC, FIPS_TEST_ALGO_AES_CCM, FIPS_TEST_ALGO_AES_XTS, diff --git a/examples/fips_validation/fips_validation_gcm.c b/examples/fips_validation/fips_validation_gcm.c index 6b3d158629..7e1bd77faf 100644 --- a/examples/fips_validation/fips_validation_gcm.c +++ b/examples/fips_validation/fips_validation_gcm.c @@ -291,13 +291,14 @@ parse_test_gcm_json_writeback(struct fips_val *val) if (info.op == FIPS_TEST_ENC_AUTH_GEN) { json_t *ct; + if (!info.interim_info.gcm_data.is_gmac) { + tmp_val.val = val->val; + tmp_val.len = vec.pt.len; - tmp_val.val = val->val; - tmp_val.len = vec.pt.len; - - writeback_hex_str("", info.one_line_text, &tmp_val); - ct = json_string(info.one_line_text); - json_object_set_new(json_info.json_write_case, CT_JSON_STR, ct); + writeback_hex_str("", info.one_line_text, &tmp_val); + ct = json_string(info.one_line_text); + json_object_set_new(json_info.json_write_case, CT_JSON_STR, ct); + } if (info.interim_info.gcm_data.gen_iv) { json_t *iv; diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 8bd5a66889..9118ca4d92 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -669,6 +669,21 @@ prepare_auth_op(void) __rte_crypto_op_reset(env.op, RTE_CRYPTO_OP_TYPE_SYMMETRIC); + if (info.interim_info.gcm_data.gen_iv == 1) { + uint32_t i; + + if (!vec.iv.val) { + vec.iv.val = rte_malloc(0, vec.iv.len, 0); + if (!vec.iv.val) + return -ENOMEM; + } + + for (i = 0; i < vec.iv.len; i++) { + int random = rand(); + vec.iv.val[i] = (uint8_t)random; + } + } + if (vec.iv.len) { uint8_t *iv = rte_crypto_op_ctod_offset(env.op, uint8_t *, IV_OFF); @@ -1817,6 +1832,11 @@ init_test_ops(void) else test_ops.test = fips_generic_test; break; + case FIPS_TEST_ALGO_AES_GMAC: + test_ops.prepare_op = prepare_auth_op; + test_ops.prepare_xform = prepare_gmac_xform; + test_ops.test = fips_generic_test; + break; case FIPS_TEST_ALGO_AES_GCM: test_ops.prepare_op = prepare_aead_op; test_ops.prepare_xform = prepare_gcm_xform; @@ -1994,6 +2014,7 @@ fips_test_one_test_group(void) json_object_set_new(json_info.json_write_group, "tests", write_tests); switch (info.algo) { + case FIPS_TEST_ALGO_AES_GMAC: case FIPS_TEST_ALGO_AES_GCM: ret = parse_test_gcm_json_init(); break; -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [EXT] [PATCH v3] examples/fips_validation: add parsing for AES GMAC 2022-09-16 8:59 ` [PATCH v3] " Brian Dooley @ 2022-09-16 17:06 ` Gowrishankar Muthukrishnan 2022-10-10 19:50 ` Akhil Goyal 1 sibling, 0 replies; 6+ messages in thread From: Gowrishankar Muthukrishnan @ 2022-09-16 17:06 UTC (permalink / raw) To: Brian Dooley, Fan Zhang; +Cc: dev, Akhil Goyal, kai.ji, Anoob Joseph Tested with FIPS test vectors from NIST. Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com> Thanks, Gowrishankar > -----Original Message----- > From: Brian Dooley <brian.dooley@intel.com> > Sent: Friday, September 16, 2022 2:30 PM > To: Fan Zhang <roy.fan.zhang@intel.com>; Brian Dooley > <brian.dooley@intel.com> > Cc: dev@dpdk.org; Gowrishankar Muthukrishnan > <gmuthukrishn@marvell.com>; Akhil Goyal <gakhil@marvell.com>; > kai.ji@intel.com > Subject: [EXT] [PATCH v3] examples/fips_validation: add parsing for AES > GMAC > > External Email > > ---------------------------------------------------------------------- > Added functionality to parse algorithm for AES GMAC test > > Signed-off-by: Brian Dooley <brian.dooley@intel.com> > Acked-by: Kai Ji <kai.ji@intel.com> > --- > v2: add random internal iv generation > --- > v3: in reply to fix and patchwork CI > --- > examples/fips_validation/fips_validation.c | 2 ++ > examples/fips_validation/fips_validation.h | 1 + > .../fips_validation/fips_validation_gcm.c | 13 ++++++------ > examples/fips_validation/main.c | 21 +++++++++++++++++++ > 4 files changed, 31 insertions(+), 6 deletions(-) > > diff --git a/examples/fips_validation/fips_validation.c > b/examples/fips_validation/fips_validation.c > index 12b9b03f56..5c7ecce412 100644 > --- a/examples/fips_validation/fips_validation.c > +++ b/examples/fips_validation/fips_validation.c > @@ -458,6 +458,8 @@ fips_test_parse_one_json_vector_set(void) > /* Vector sets contain the algorithm type, and nothing else we need. > */ > if (strstr(algo_str, "AES-GCM")) > info.algo = FIPS_TEST_ALGO_AES_GCM; > + else if (strstr(algo_str, "AES-GMAC")) > + info.algo = FIPS_TEST_ALGO_AES_GMAC; > else if (strstr(algo_str, "HMAC")) > info.algo = FIPS_TEST_ALGO_HMAC; > else if (strstr(algo_str, "CMAC")) > diff --git a/examples/fips_validation/fips_validation.h > b/examples/fips_validation/fips_validation.h > index 5c1abcbd91..24edab68da 100644 > --- a/examples/fips_validation/fips_validation.h > +++ b/examples/fips_validation/fips_validation.h > @@ -36,6 +36,7 @@ enum fips_test_algorithms { > FIPS_TEST_ALGO_AES = 0, > FIPS_TEST_ALGO_AES_CBC, > FIPS_TEST_ALGO_AES_GCM, > + FIPS_TEST_ALGO_AES_GMAC, > FIPS_TEST_ALGO_AES_CMAC, > FIPS_TEST_ALGO_AES_CCM, > FIPS_TEST_ALGO_AES_XTS, > diff --git a/examples/fips_validation/fips_validation_gcm.c > b/examples/fips_validation/fips_validation_gcm.c > index 6b3d158629..7e1bd77faf 100644 > --- a/examples/fips_validation/fips_validation_gcm.c > +++ b/examples/fips_validation/fips_validation_gcm.c > @@ -291,13 +291,14 @@ parse_test_gcm_json_writeback(struct fips_val > *val) > > if (info.op == FIPS_TEST_ENC_AUTH_GEN) { > json_t *ct; > + if (!info.interim_info.gcm_data.is_gmac) { > + tmp_val.val = val->val; > + tmp_val.len = vec.pt.len; > > - tmp_val.val = val->val; > - tmp_val.len = vec.pt.len; > - > - writeback_hex_str("", info.one_line_text, &tmp_val); > - ct = json_string(info.one_line_text); > - json_object_set_new(json_info.json_write_case, > CT_JSON_STR, ct); > + writeback_hex_str("", info.one_line_text, > &tmp_val); > + ct = json_string(info.one_line_text); > + json_object_set_new(json_info.json_write_case, > CT_JSON_STR, ct); > + } > > if (info.interim_info.gcm_data.gen_iv) { > json_t *iv; > diff --git a/examples/fips_validation/main.c > b/examples/fips_validation/main.c index 8bd5a66889..9118ca4d92 100644 > --- a/examples/fips_validation/main.c > +++ b/examples/fips_validation/main.c > @@ -669,6 +669,21 @@ prepare_auth_op(void) > > __rte_crypto_op_reset(env.op, > RTE_CRYPTO_OP_TYPE_SYMMETRIC); > > + if (info.interim_info.gcm_data.gen_iv == 1) { > + uint32_t i; > + > + if (!vec.iv.val) { > + vec.iv.val = rte_malloc(0, vec.iv.len, 0); > + if (!vec.iv.val) > + return -ENOMEM; > + } > + > + for (i = 0; i < vec.iv.len; i++) { > + int random = rand(); > + vec.iv.val[i] = (uint8_t)random; > + } > + } > + > if (vec.iv.len) { > uint8_t *iv = rte_crypto_op_ctod_offset(env.op, uint8_t *, > IV_OFF); > @@ -1817,6 +1832,11 @@ init_test_ops(void) > else > test_ops.test = fips_generic_test; > break; > + case FIPS_TEST_ALGO_AES_GMAC: > + test_ops.prepare_op = prepare_auth_op; > + test_ops.prepare_xform = prepare_gmac_xform; > + test_ops.test = fips_generic_test; > + break; > case FIPS_TEST_ALGO_AES_GCM: > test_ops.prepare_op = prepare_aead_op; > test_ops.prepare_xform = prepare_gcm_xform; @@ -1994,6 > +2014,7 @@ fips_test_one_test_group(void) > json_object_set_new(json_info.json_write_group, "tests", > write_tests); > > switch (info.algo) { > + case FIPS_TEST_ALGO_AES_GMAC: > case FIPS_TEST_ALGO_AES_GCM: > ret = parse_test_gcm_json_init(); > break; > -- > 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [EXT] [PATCH v3] examples/fips_validation: add parsing for AES GMAC 2022-09-16 8:59 ` [PATCH v3] " Brian Dooley 2022-09-16 17:06 ` [EXT] " Gowrishankar Muthukrishnan @ 2022-10-10 19:50 ` Akhil Goyal 1 sibling, 0 replies; 6+ messages in thread From: Akhil Goyal @ 2022-10-10 19:50 UTC (permalink / raw) To: Brian Dooley, Fan Zhang; +Cc: dev, Gowrishankar Muthukrishnan, kai.ji > Added functionality to parse algorithm for AES GMAC test > > Signed-off-by: Brian Dooley <brian.dooley@intel.com> > Acked-by: Kai Ji <kai.ji@intel.com> Added documentation update. Applied to dpdk-next-crypto Thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-10 19:50 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-19 9:46 [PATCH v1] examples/fips_validation: add parsing for AES GMAC Brian Dooley 2022-09-01 10:35 ` [PATCH v2] " Brian Dooley 2022-09-15 13:20 ` Ji, Kai 2022-09-16 8:59 ` [PATCH v3] " Brian Dooley 2022-09-16 17:06 ` [EXT] " Gowrishankar Muthukrishnan 2022-10-10 19:50 ` Akhil Goyal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).