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>
Acked-by: Kai Ji <kai.ji@intel.com>
Acked-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
This commit is contained in:
Brian Dooley 2022-09-16 08:59:43 +00:00 committed by Akhil Goyal
parent f7f2e8a9dd
commit e27268bd21
5 changed files with 32 additions and 6 deletions

View File

@ -61,6 +61,7 @@ ACVP
* AES-CBC (128,192,256) - AFT, MCT
* AES-GCM (128,192,256) - AFT
* AES-CMAC (128,192,256) - AFT
* AES-GMAC (128,192,256) - AFT
* AES-XTS (128,256) - AFT
* HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
* SHA (1, 256, 384, 512) - AFT, MCT

View File

@ -460,6 +460,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"))

View File

@ -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,

View File

@ -292,13 +292,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;

View File

@ -660,6 +660,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);
@ -1824,6 +1839,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;
@ -2001,6 +2021,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;