From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 974CAA00C4; Fri, 30 Sep 2022 10:53:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7AED840E5A; Fri, 30 Sep 2022 10:53:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id EE5EE40684 for ; Fri, 30 Sep 2022 10:53:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664527990; x=1696063990; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PVJ8gZ2j5i+gYXZOgILDch9UOjv8+tWmhKh84yx1S9M=; b=AsStmDn6Eut2xjb7gEurha2SvBBQA6E6HgJrBUutagiYZBrNdZMu8dZK e4hs+l+ICr27G/fMgXTFogxOPERXIw0T29FZ0VDYNSVm5vdx8W70w5GDb lqPXEUb7p0UHyzV2+y1lgGYNBwe0XTunM/enmvThDXrgn7YRxTTbII5QU 6cTfIVhJ8OeDOe2E+YqE6h30GStwtI67efH7vUOcTAs9HckHmGRB2VZPg cbkXUIUqgmCLyOydDZ7VB+ZXIdQcLh5o9ThZBxruidhaOza34Oze3sv9b rmPuxKB4EDtOOhvH82rKIfcEJP4VN5AXv/vf1qPDkvM3Vsil2iLCmqe6D g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="300861325" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="300861325" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 01:53:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="624916540" X-IronPort-AV: E=Sophos;i="5.93,357,1654585200"; d="scan'208";a="624916540" Received: from silpixa00400883.ir.intel.com ([10.243.23.138]) by fmsmga007.fm.intel.com with ESMTP; 30 Sep 2022 01:53:06 -0700 From: Brian Dooley To: Brian Dooley Cc: dev@dpdk.org, gmuthukrishn@marvell.com, gakhil@marvell.com, roy.fan.zhang@intel.com, kai.ji@intel.com Subject: [PATCH v4] examples/fips_validation: add parsing for AES CTR Date: Fri, 30 Sep 2022 08:53:02 +0000 Message-Id: <20220930085302.317536-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916135355.324573-1-brian.dooley@intel.com> References: <20220916135355.324573-1-brian.dooley@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 CTR test Signed-off-by: Brian Dooley Acked-by: Kai Ji Acked-by: Gowrishankar Muthukrishnan --- v2: fix clang warning for int-in-bool-context --- v3: in reply to fix and patchwork CI --- v4: missing acks --- examples/fips_validation/fips_validation.c | 2 ++ examples/fips_validation/fips_validation.h | 2 ++ examples/fips_validation/fips_validation_aes.c | 5 +++++ examples/fips_validation/main.c | 9 +++++++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index cd905b2c5b..016888fe7f 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -468,6 +468,8 @@ fips_test_parse_one_json_vector_set(void) info.algo = FIPS_TEST_ALGO_AES_CBC; else if (strstr(algo_str, "AES-XTS")) info.algo = FIPS_TEST_ALGO_AES_XTS; + else if (strstr(algo_str, "AES-CTR")) + info.algo = FIPS_TEST_ALGO_AES_CTR; else if (strstr(algo_str, "SHA")) info.algo = FIPS_TEST_ALGO_SHA; else diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5c1abcbd91..96fdbec41a 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -35,6 +35,7 @@ enum fips_test_algorithms { FIPS_TEST_ALGO_AES = 0, FIPS_TEST_ALGO_AES_CBC, + FIPS_TEST_ALGO_AES_CTR, FIPS_TEST_ALGO_AES_GCM, FIPS_TEST_ALGO_AES_CMAC, FIPS_TEST_ALGO_AES_CCM, @@ -105,6 +106,7 @@ enum fips_aesavs_test_types { AESAVS_TYPE_MMT, AESAVS_TYPE_MCT, AESAVS_TYPE_AFT, + AESAVS_TYPE_CTR, }; enum fips_tdes_test_types { diff --git a/examples/fips_validation/fips_validation_aes.c b/examples/fips_validation/fips_validation_aes.c index 4f61505bb3..0ef97aa03d 100644 --- a/examples/fips_validation/fips_validation_aes.c +++ b/examples/fips_validation/fips_validation_aes.c @@ -30,8 +30,10 @@ #define TESTTYPE_JSON_STR "testType" #define DIR_JSON_STR "direction" #define KEYLEN_JSON_STR "keyLen" +#define OVERFLOW_JSON_STR "overflow" #define KEY_JSON_STR "key" +#define PAYLOADLEN_JSON_STR "payloadLen" #define IV_JSON_STR "iv" #define PT_JSON_STR "pt" #define CT_JSON_STR "ct" @@ -52,6 +54,7 @@ struct { {AESAVS_TYPE_MMT, "MMT"}, {AESAVS_TYPE_MCT, "MCT"}, {AESAVS_TYPE_AFT, "AFT"}, + {AESAVS_TYPE_CTR, "CTR"}, }; struct aes_test_algo { @@ -60,6 +63,7 @@ struct aes_test_algo { } const algo_con[] = { {"CBC", RTE_CRYPTO_CIPHER_AES_CBC}, {"ECB", RTE_CRYPTO_CIPHER_AES_ECB}, + {"CTR", RTE_CRYPTO_CIPHER_AES_CTR}, }; static int @@ -291,6 +295,7 @@ parse_test_aes_json_init(void) case AESAVS_TYPE_MCT: info.parse_writeback = parse_test_aes_mct_json_writeback; break; + case AESAVS_TYPE_CTR: case AESAVS_TYPE_AFT: info.parse_writeback = parse_test_aes_json_writeback; break; diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index e6c0b6a3a1..6713fe0582 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -771,9 +771,11 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform) struct rte_crypto_cipher_xform *cipher_xform = &xform->cipher; xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER; - if (info.interim_info.aes_data.cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC) cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_CBC; + else if (info.interim_info.aes_data.cipher_algo == + RTE_CRYPTO_CIPHER_AES_CTR) + cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_CTR; else cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_ECB; @@ -782,7 +784,8 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform) RTE_CRYPTO_CIPHER_OP_DECRYPT; cipher_xform->key.data = vec.cipher_auth.key.val; cipher_xform->key.length = vec.cipher_auth.key.len; - if (cipher_xform->algo == RTE_CRYPTO_CIPHER_AES_CBC) { + if (cipher_xform->algo == RTE_CRYPTO_CIPHER_AES_CBC || + cipher_xform->algo == RTE_CRYPTO_CIPHER_AES_CTR) { cipher_xform->iv.length = vec.iv.len; cipher_xform->iv.offset = IV_OFF; } else { @@ -1797,6 +1800,7 @@ init_test_ops(void) { switch (info.algo) { case FIPS_TEST_ALGO_AES_CBC: + case FIPS_TEST_ALGO_AES_CTR: case FIPS_TEST_ALGO_AES: test_ops.prepare_op = prepare_cipher_op; test_ops.prepare_xform = prepare_aes_xform; @@ -2008,6 +2012,7 @@ fips_test_one_test_group(void) ret = parse_test_xts_json_init(); break; case FIPS_TEST_ALGO_AES_CBC: + case FIPS_TEST_ALGO_AES_CTR: case FIPS_TEST_ALGO_AES: ret = parse_test_aes_json_init(); break; -- 2.25.1