From patchwork Fri Sep 16 08:59:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 116392 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52442A0032; Fri, 16 Sep 2022 11:00:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC2C04021D; Fri, 16 Sep 2022 11:00:06 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 3B75240156 for ; Fri, 16 Sep 2022 11:00:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663318805; x=1694854805; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CPFUoALJlNtAYCXgf13BC0Cnhi4qh46j5ExZ1bkeAhM=; b=mU3db4cQHC7dSP7OI2J16n7GfXXREWHMTmod3wIaLapBIlroyFf4lR2p uNKnpgmteGBGqmKDEG+FgBc4uax0eDR44IYrspXz2HRxqc3xQzArwALNq QD+GB8pdJ8CKubj4EGq3fv81VgDD+ocFn6GkvlTBTAgy41NBfRTtrLErW 8s/HlhjngYEM3nCk5hR4HtyKfQeT4EX92Dhk8W/sOfAMMAS0/NrrdZdk1 gJ1j2nqhSAQ8rmr5y+TBTCbu0ien+5qAdn1AUgwLtKUkaaYKPOWDpRDzp lNXSaVDAwJ0P7xlNW/NY9wn+XDW2i5KFUqpINC+57W8V/9n3qWoPyKdf8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="279330039" X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="279330039" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 01:59:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="686064559" Received: from silpixa00400883.ir.intel.com ([10.243.23.138]) by fmsmga004.fm.intel.com with ESMTP; 16 Sep 2022 01:59:45 -0700 From: Brian Dooley To: Fan Zhang , Brian Dooley Cc: dev@dpdk.org, gmuthukrishn@marvell.com, gakhil@marvell.com, kai.ji@intel.com Subject: [PATCH v3] examples/fips_validation: add parsing for AES GMAC Date: Fri, 16 Sep 2022 08:59:43 +0000 Message-Id: <20220916085943.21916-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901103501.304471-1-brian.dooley@intel.com> References: <20220901103501.304471-1-brian.dooley@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Added functionality to parse algorithm for AES GMAC test Signed-off-by: Brian Dooley Acked-by: Kai Ji Acked-by: Gowrishankar Muthukrishnan --- 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;