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 36EEC41D8F; Mon, 27 Feb 2023 10:30:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2857941153; Mon, 27 Feb 2023 10:30:24 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id C9F22410FB for ; Mon, 27 Feb 2023 10:30:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677490222; x=1709026222; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=F9hR2Fggnq9a6QXeYxPj4UcgwRRbhU6BcgOXUwYXAcc=; b=edkddRPQp8/I/xAebyy/SpyhjTCGcJevqiYAf3FhakzFzZOR93bGagyj Zx+RHL/B+5Fs285GOdr7sY+Sj/6by2xum6EutidG7cAKukTBoWdZqSP3q cuL2zMvQD5arjIpRh9F+Yi4XPTPVBtmCA2qguaOddSl/0OzTdILw9B5nm wdL8KfSlF2l+ECvlWU4PpUz/n9ouIStf/XBytfvZQAmsPF1PAMFDpUgh7 L7auKbkbOIIslbSFKzQdWZKXAMm0B8Ot2MjMouDWEE19huoZDJqnsf1YB 27MC50F9rWHIt5EncA8/W/atpr90OmnAe0UQM5vPQvzbKranKaCVs5Itg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="317619033" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="317619033" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 01:30:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="797544160" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="797544160" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP; 27 Feb 2023 01:30:20 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 27 Feb 2023 01:30:19 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 27 Feb 2023 01:30:18 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 27 Feb 2023 01:30:18 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.176) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 27 Feb 2023 01:30:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dv9a8b+oUoiG1/t8VMOU3fcbQRPAwmrfaP+JySH/3QUVVtko8ItXflE9KzGJFgOUJI3HhXBXkUZIHWFJ0dcbFwaCym0pLDkw1sUcoWN+1ZCHAu6gQUuLPdhiA4tHQFmlYijggiWcgbBUyk+9zr9QvyEiXDgwupZOtWiWWoOCXeWfFmTTkGOJiP+h+C/iD22/vBZ9yj1Dw0/Ts0sWgr8UmtBqFpN2KI0U32xZdzn6lWvK19lVlaQdw0N1uaRVZCgYIAfpQ4tvz25DgRHmZ8jCr/biRARdtRn3kgC55wqbb8hsSCKJW28Dh7e8KZXkM3oRDRBolJZgIsKJQbaQRDKMvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1ZkoOW04uEbNyfLCFmkYZ+Ugo6rwrwbEcUColzXlaJ8=; b=BRRL0gV+2ZOMPvegv/yLc2jZ6GYzkuEu3LAlvz8KG17KW8jNexfGfve6hzhF2wj6Ga2D/zdfaqBx3TOD+Xg4WBXbaJQurFlCPMUp/v2RaRqjpB+fSgrEJ4mE+vc7wmw8kUlc9dDnxf91Zo7b2LjsW7NRl4YvjxOnWy31VoGrJmgmuIVL4Fem2WFrzuT4bvDoy2iNwtlzbodIDZItxpxwBym783vPPtNDa/i2wQ+p43PE1cAqsjbX67aw8DcB8L4y+9GHS4RcVMSw8aoANLdsorPT7DJl+ILfirArDnp02NZHPmmWyKIE1Pmfsp7NZK1KXuqMDzBgLxoL8R61HT7WUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM5PR11MB1851.namprd11.prod.outlook.com (2603:10b6:3:114::18) by SA1PR11MB6664.namprd11.prod.outlook.com (2603:10b6:806:258::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.28; Mon, 27 Feb 2023 09:30:16 +0000 Received: from DM5PR11MB1851.namprd11.prod.outlook.com ([fe80::3c23:7638:8d23:670f]) by DM5PR11MB1851.namprd11.prod.outlook.com ([fe80::3c23:7638:8d23:670f%5]) with mapi id 15.20.6134.027; Mon, 27 Feb 2023 09:30:16 +0000 From: "Dooley, Brian" To: Gowrishankar Muthukrishnan , "dev@dpdk.org" CC: Anoob Joseph , "jerinj@marvell.com" , Akhil Goyal Subject: RE: [v1, 04/10] examples/fips_validation: add SHAKE validation Thread-Topic: [v1, 04/10] examples/fips_validation: add SHAKE validation Thread-Index: AQHZOjnWDYMdoV9euEyikTx7fPDaVK7ip7ZA Date: Mon, 27 Feb 2023 09:30:16 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM5PR11MB1851:EE_|SA1PR11MB6664:EE_ x-ms-office365-filtering-correlation-id: 8ec74037-2f8f-4dfc-8cb9-08db18a53c5d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aMGrhwHiPWCKaL0PQws70nCLzKxOHvmIYI4jASSn9vieQoE6tMjsK8EKSRlE3JpJ8jd9oUIBe/oBgL1tKvi62yTiAIT5kqqDokAg3xk3gkQpa2fVfVNPuposxlDhkVbEhrSLS9VwINDfC5LCLNgVor6qd+cm9tsFL/y3wVCrFbhJ1X84+Ed2rSNIuqKHyBkBkTl6FDJbUj0vhkYwUg+KEPByc+Uhlu4mJhC049W5TBzGJkYEZIUG9qA6acgO+xplb+VY8/4Yf4jFNbxKPVcMqPfh5O3n24ngwUQsfhO8BKR7VtKmh2rwvbqOhm4tbrd4jdiWfAV9EZ4zD8LGnKhWxO5xo8wh/M4xXEyFR5gmFXAjlvPuJirc2oTmqIXlSsabBkNPeHaU/0BAJ3Vzy5kib9pR4za0w64XC+4eLBR1Kdzv3AQy2Tn8fy+15KkUe9BCiFYMIBWSm1GGAuuxeG3ljLHfrS8yt+Jrml9ppr9f1emqVv06e9k1wOTrjLZXoAI91hERNiGvjTeDzvrShDoscbwF+d+B4DrEgT9l9vPMi33rPrOh6HKYgF6mBKM1I1yxTIZGw964unpunMb4t9g/1r/a+ZWS9mj8h+p+uFBh9dmGyNxlt6t5rVTKyzCuYUEezBXoiIZ0fMNo+kJ6+zfYY7iJSFny6Ve85s1ZfpEstaSedF+BdDaaEfiXLmv+cz2ikmMeLkh691AE8TNpGgKJjg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR11MB1851.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(136003)(346002)(366004)(376002)(396003)(39860400002)(451199018)(110136005)(54906003)(316002)(33656002)(86362001)(55016003)(38100700002)(122000001)(82960400001)(53546011)(6506007)(83380400001)(38070700005)(9686003)(26005)(186003)(5660300002)(71200400001)(30864003)(2906002)(7696005)(8936002)(52536014)(478600001)(4326008)(41300700001)(8676002)(66476007)(66446008)(64756008)(66946007)(66556008)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aZwwc5D+UGhyI59V9g1glCtTCkNoOZidNfF2Hgfi5xKASz4nncC/m0g4X4b7?= =?us-ascii?Q?ctn7cgSFreUG3afNTrZ7YemOnDX8WS0nNf1S0Th35JIw9SUhh4gEkpZXCD8D?= =?us-ascii?Q?5O8QGy7SnjP1+Uf6AfTy2oc/zDxBeYks+xCOcQ/yAMwf32/luTF0onNE/h4K?= =?us-ascii?Q?15AO0cZARiq4uCs+YYTxZI4aAo7HR/Ym+X8m/WqqFY63o75T3HXnFevmxdCw?= =?us-ascii?Q?mYKseSKWlpm8CdFOCn4sNEAfGqFQpIDI5s41DIZSr7IPKXLebnH+T97jhdG5?= =?us-ascii?Q?6lFro0r7KZZ50MamHHoiVW1lTTszi7p+hm4H1nGaeApxktTybH8EX5VKcUbl?= =?us-ascii?Q?q+YMb3B7szSEFEjlTyZfKJiA7I/UMH2/8nvFCp+gV4T1ySBTg+KJ6RKWKDKR?= =?us-ascii?Q?8D62XzIaSieWqm6MNFP6uzgDT6hzUbCdglsPCqz6KHZ+fLI23poJQ9xb9AAo?= =?us-ascii?Q?OSPnM7RpiOXSH3uQXrmfkJ/iU5gyPuDLnmO0YkaLX6q6LYkW13xw1aUfqihK?= =?us-ascii?Q?mbM7G5HGf18Q1y8NPOGNJy39rJQ9cLwpqh+adw6CFlIn1UGbiYZNvZ6PW2zk?= =?us-ascii?Q?OM9cAYXjoPgHrrPGT2a6zIp75GRR3cjNHckoi2NL0ggMoJu6okjuf9jIKulR?= =?us-ascii?Q?Kz41Du0bUEIFiHkGdUma85m2HUByxQG0CoyK79TEuLyn9t2n71cgnjpgdPHk?= =?us-ascii?Q?W6VvtoqMXaUl7B9pCgD+0dqqAmbDK5hb2f6LX4pdux9afGmU5IS07Oq+zh6B?= =?us-ascii?Q?BHg6L8OYQef1bK6H6b0/xUSkCSF1UJlwQFQW5Ga3JhaNYjOIyTjpM/JCSTrP?= =?us-ascii?Q?cOONDr7x9SN66xcnqnDo6GOuWrlUaRlGdjdt3hhLUJ41bMba7BGBixp6IHOt?= =?us-ascii?Q?fagOBiW5ahrcZ5h7EeudSZ3O/Z0UCuRGAUmFIONUv/MAaHQgaWmtrJ+sbLPt?= =?us-ascii?Q?tCJz2ztI0QHLA3bbCHlqkOQkqfoXaoTwinRrnvTvruqX2vpEIDHS3MnTpZjL?= =?us-ascii?Q?vJFPl4K9PpSTztPV6gqGVXMDfOpwTFXaSOIHRiIk1MqgXuKzUjC97PQjPaZI?= =?us-ascii?Q?d5g7X2vo/k0ooeKJpKVMDkwx3Olhqsz4X1KfUvFWBH/FQ0U6/Gw2B/+B16BZ?= =?us-ascii?Q?h9LFetIHEM+k8S2OKZ56uayEWDhRW/A8qwbxqohTFiUChFyyKxUdeNnleX3e?= =?us-ascii?Q?8PCzAJeSdoykPXeGYl0L17VTmCNyoms7+PjCNBXBr40KmriXfedvUW2Slbc7?= =?us-ascii?Q?5p/UNzM7DuPdRDvCHGW4S3L08rlZjmeMzs6u37PB59QD80L+uWWQyhUEkEIZ?= =?us-ascii?Q?ZFAe+aPMHeOmWvb/N+FLTGHvBA8Y5Gs5WsKZ4k/i2gOvSjy922ipP0P7nLHa?= =?us-ascii?Q?E752bKXfq4C8Sj0B8mxo3Kx7n4V+nWyxPVQ2MsWnLIN1px4Nz/LY5Uyj4l5c?= =?us-ascii?Q?fq+0g67BJ8bMXtyE5uUe6owKLizgoLFVTAddxs7exU9a/JwvMpDuEPNF+EYu?= =?us-ascii?Q?mfolfv74gFrC7uYnfk+W8cR5jT++LbOPe2K3G2D8/HQVwEKVeTxq84rHlm1O?= =?us-ascii?Q?f/wgCkg8T6M9ZVqRKpffIchcGrTVF3WN84txSCFi?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1851.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ec74037-2f8f-4dfc-8cb9-08db18a53c5d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2023 09:30:16.4178 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QgrUbm29NMOTUo8F73SA5zCtWDfdh6HIZS47volAzb3dctrLDfFmmPeXWik7MSgYNS+DvMZncCvF2RzioOlrSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6664 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Gowrishankar Muthukrishnan > Sent: Monday 6 February 2023 14:46 > To: dev@dpdk.org > Cc: Anoob Joseph ; jerinj@marvell.com; Akhil Goyal > ; Dooley, Brian ; > Gowrishankar Muthukrishnan > Subject: [v1, 04/10] examples/fips_validation: add SHAKE validation >=20 > Add support in fips_validation to parse SHAKE algorithms. >=20 > Signed-off-by: Gowrishankar Muthukrishnan > --- > doc/guides/sample_app_ug/fips_validation.rst | 1 + > examples/fips_validation/fips_validation.h | 4 +- > .../fips_validation/fips_validation_sha.c | 63 ++++++++++++- > examples/fips_validation/main.c | 93 ++++++++++++++++++- > 4 files changed, 154 insertions(+), 7 deletions(-) >=20 > diff --git a/doc/guides/sample_app_ug/fips_validation.rst > b/doc/guides/sample_app_ug/fips_validation.rst > index 55837895fe..4fc8297b34 100644 > --- a/doc/guides/sample_app_ug/fips_validation.rst > +++ b/doc/guides/sample_app_ug/fips_validation.rst > @@ -67,6 +67,7 @@ ACVP > * HMAC (SHA1, SHA224, SHA256, SHA384, SHA512, SHA3_224, SHA3_256, > SHA3_384, SHA3_512) > * SHA (1, 224, 256, 384, 512) - AFT, MCT > * SHA3 (224, 256, 384, 512) - AFT, MCT > + * SHAKE (128, 256) - AFT, MCT, VOT > * TDES-CBC - AFT, MCT > * TDES-ECB - AFT, MCT > * RSA > diff --git a/examples/fips_validation/fips_validation.h > b/examples/fips_validation/fips_validation.h > index 6c1bd35849..8fcb5c8500 100644 > --- a/examples/fips_validation/fips_validation.h > +++ b/examples/fips_validation/fips_validation.h > @@ -163,7 +163,8 @@ enum fips_ccm_test_types { enum > fips_sha_test_types { > SHA_KAT =3D 0, > SHA_AFT, > - SHA_MCT > + SHA_MCT, > + SHAKE_VOT > }; >=20 > enum fips_rsa_test_types { > @@ -205,6 +206,7 @@ struct sha_interim_data { > /* keep algo always on top as it is also used in asym digest */ > enum rte_crypto_auth_algorithm algo; > enum fips_sha_test_types test_type; > + uint8_t min_outlen; > uint8_t md_blocks; > }; >=20 > diff --git a/examples/fips_validation/fips_validation_sha.c > b/examples/fips_validation/fips_validation_sha.c > index 8b68f5ed36..7ce7d3744f 100644 > --- a/examples/fips_validation/fips_validation_sha.c > +++ b/examples/fips_validation/fips_validation_sha.c > @@ -22,6 +22,9 @@ > #define TESTTYPE_JSON_STR "testType" >=20 > #define PT_JSON_STR "msg" > +#define OUTLEN_JSON_STR "outLen" > +#define MINOUTLEN_JSON_STR "minOutLen" > +#define MAXOUTLEN_JSON_STR "maxOutLen" >=20 > struct plain_hash_size_conversion { > const char *str; > @@ -36,6 +39,8 @@ struct plain_hash_size_conversion { > {"32", RTE_CRYPTO_AUTH_SHA3_256}, > {"48", RTE_CRYPTO_AUTH_SHA3_384}, > {"64", RTE_CRYPTO_AUTH_SHA3_512}, > + {"16", RTE_CRYPTO_AUTH_SHAKE_128}, > + {"32", RTE_CRYPTO_AUTH_SHAKE_256}, > }; >=20 > int > @@ -89,12 +94,26 @@ struct fips_test_callback sha_tests_interim_vectors[] > =3D { }; >=20 > #ifdef USE_JANSSON > +static int > +parse_interim_str(const char *key, char *src, struct fips_val *val) { > + RTE_SET_USED(val); > + > + if (strcmp(key, MINOUTLEN_JSON_STR) =3D=3D 0) > + info.interim_info.sha_data.min_outlen =3D atoi(src) / 8; > + else if (strcmp(key, MAXOUTLEN_JSON_STR) =3D=3D 0) > + vec.cipher_auth.digest.len =3D atoi(src) / 8; > + > + return 0; > +} > + > static struct { > uint32_t type; > const char *desc; > } sha_test_types[] =3D { > {SHA_MCT, "MCT"}, > {SHA_AFT, "AFT"}, > + {SHAKE_VOT, "VOT"}, > }; >=20 > static struct plain_hash_algorithms { > @@ -111,10 +130,19 @@ static struct plain_hash_algorithms { > {"SHA3-256", RTE_CRYPTO_AUTH_SHA3_256, 1}, > {"SHA3-384", RTE_CRYPTO_AUTH_SHA3_384, 1}, > {"SHA3-512", RTE_CRYPTO_AUTH_SHA3_512, 1}, > + {"SHAKE-128", RTE_CRYPTO_AUTH_SHAKE_128, 1}, > + {"SHAKE-256", RTE_CRYPTO_AUTH_SHAKE_256, 1}, > }; >=20 > struct fips_test_callback sha_tests_json_vectors[] =3D { > {PT_JSON_STR, parse_uint8_hex_str, &vec.pt}, > + {OUTLEN_JSON_STR, parser_read_uint32_bit_val, > &vec.cipher_auth.digest}, > + {NULL, NULL, NULL} /**< end pointer */ }; > + > +struct fips_test_callback sha_tests_interim_json_vectors[] =3D { > + {MINOUTLEN_JSON_STR, parse_interim_str, NULL}, > + {MAXOUTLEN_JSON_STR, parse_interim_str, NULL}, > {NULL, NULL, NULL} /**< end pointer */ }; #endif /* > USE_JANSSON */ @@ -185,6 +213,11 @@ > parse_test_sha_json_writeback(struct fips_val *val) > md =3D json_string(info.one_line_text); > json_object_set_new(json_info.json_write_case, "md", md); >=20 > + if (info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_128 || > + info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_256) > + json_object_set_new(json_info.json_write_case, "outLen", > + json_integer(vec.cipher_auth.digest.len * 8)); > + > return 0; > } >=20 > @@ -193,6 +226,11 @@ parse_test_sha_mct_json_writeback(struct fips_val > *val) { > json_t *tcId, *md, *resArr, *res; > struct fips_val val_local; > + bool is_shake =3D false; > + > + if (info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_128 || > + info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_256) > + is_shake =3D true; >=20 > tcId =3D json_object_get(json_info.json_test_case, "tcId"); > if (json_info.json_write_case) { > @@ -204,11 +242,17 @@ parse_test_sha_mct_json_writeback(struct > fips_val *val) > json_object_set_new(json_info.json_write_case, > "tcId", tcId); > json_object_set_new(json_info.json_write_case, > "resultsArray", > json_array()); > + if (is_shake) > + > json_object_set_new(json_info.json_write_case, "outLen", > + > json_integer(0)); > } > } else { > json_info.json_write_case =3D json_object(); > json_object_set_new(json_info.json_write_case, "tcId", > tcId); > json_object_set_new(json_info.json_write_case, > "resultsArray", json_array()); > + if (is_shake) > + json_object_set_new(json_info.json_write_case, > "outLen", > + > json_integer(0)); > } >=20 > resArr =3D json_object_get(json_info.json_write_case, > "resultsArray"); @@ -224,6 +268,9 @@ > parse_test_sha_mct_json_writeback(struct fips_val *val) > md =3D json_string(info.one_line_text); > json_object_set_new(res, "md", md); >=20 > + if (is_shake) > + json_object_set_new(res, "outLen", > +json_integer(vec.cipher_auth.digest.len * 8)); > + > json_array_append_new(resArr, res); > return 0; > } > @@ -250,12 +297,17 @@ parse_test_sha_json_algorithm(void) > if (i =3D=3D RTE_DIM(json_algorithms)) > return -1; >=20 > - sz =3D parse_test_sha_hash_size(info.interim_info.sha_data.algo); > + if (info.interim_info.sha_data.test_type =3D=3D SHAKE_VOT) { > + sz =3D vec.cipher_auth.digest.len; > + } else { > + sz =3D > parse_test_sha_hash_size(info.interim_info.sha_data.algo); > + vec.cipher_auth.digest.len =3D sz; > + } > + > if (sz < 0) > return -1; >=20 > free(vec.cipher_auth.digest.val); > - vec.cipher_auth.digest.len =3D sz; > vec.cipher_auth.digest.val =3D calloc(1, sz); > if (vec.cipher_auth.digest.val =3D=3D NULL) > return -1; > @@ -288,6 +340,7 @@ parse_test_sha_json_test_type(void) > info.parse_writeback =3D > parse_test_sha_mct_json_writeback; > break; > case SHA_AFT: > + case SHAKE_VOT: > info.parse_writeback =3D parse_test_sha_json_writeback; > break; > default: > @@ -308,12 +361,12 @@ parse_test_sha_json_init(void) > info.callbacks =3D sha_tests_json_vectors; > info.writeback_callbacks =3D NULL; > info.kat_check =3D rsp_test_sha_check; > - info.interim_callbacks =3D NULL; > + info.interim_callbacks =3D sha_tests_interim_json_vectors; >=20 > - if (parse_test_sha_json_algorithm() < 0) > + if (parse_test_sha_json_test_type() < 0) > return -1; >=20 > - if (parse_test_sha_json_test_type() < 0) > + if (parse_test_sha_json_algorithm() < 0) > return -1; >=20 > return 0; > diff --git a/examples/fips_validation/main.c > b/examples/fips_validation/main.c index cf29e440f1..52076160b5 100644 > --- a/examples/fips_validation/main.c > +++ b/examples/fips_validation/main.c > @@ -2356,6 +2356,93 @@ fips_mct_sha_test(void) > return 0; > } >=20 > +static int > +fips_mct_shake_test(void) > +{ > +#define SHAKE_EXTERN_ITER 100 > +#define SHAKE_INTERN_ITER 1000 > + uint32_t i, j, range, outlen, max_outlen; > + struct fips_val val =3D {NULL, 0}, md; > + uint8_t rightmost[2]; > + int ret; > + > + max_outlen =3D vec.cipher_auth.digest.len; > + > + if (vec.cipher_auth.digest.val) > + free(vec.cipher_auth.digest.val); > + > + vec.cipher_auth.digest.val =3D calloc(1, max_outlen); > + > + if (vec.pt.val) > + memcpy(vec.cipher_auth.digest.val, vec.pt.val, vec.pt.len); > + > + rte_free(vec.pt.val); > + vec.pt.val =3D rte_malloc(NULL, 16, 0); > + vec.pt.len =3D 16; > + > + md.val =3D rte_malloc(NULL, max_outlen, 0); > + md.len =3D max_outlen; > + > + if (info.file_type !=3D FIPS_TYPE_JSON) { > + fips_test_write_one_case(); > + fprintf(info.fp_wr, "\n"); > + } > + > + range =3D max_outlen - info.interim_info.sha_data.min_outlen + 1; > + outlen =3D max_outlen; > + for (j =3D 0; j < SHAKE_EXTERN_ITER; j++) { > + memset(md.val, 0, max_outlen); > + memcpy(md.val, vec.cipher_auth.digest.val, > + vec.cipher_auth.digest.len); > + > + for (i =3D 0; i < (SHAKE_INTERN_ITER); i++) { > + memset(vec.pt.val, 0, vec.pt.len); > + memcpy(vec.pt.val, md.val, vec.pt.len); > + vec.cipher_auth.digest.len =3D outlen; > + ret =3D fips_run_test(); > + if (ret < 0) { > + if (ret =3D=3D -EPERM || ret =3D=3D -ENOTSUP) { > + if (info.file_type =3D=3D FIPS_TYPE_JSON) > + return ret; > + > + fprintf(info.fp_wr, "Bypass\n\n"); > + return 0; > + } > + return ret; > + } > + > + ret =3D get_writeback_data(&val); > + if (ret < 0) > + return ret; > + > + memset(md.val, 0, max_outlen); > + memcpy(md.val, (val.val + vec.pt.len), > + vec.cipher_auth.digest.len); > + md.len =3D outlen; > + rightmost[0] =3D md.val[md.len-1]; > + rightmost[1] =3D md.val[md.len-2]; > + outlen =3D info.interim_info.sha_data.min_outlen + > + (*(uint16_t *)rightmost % range); > + } > + > + memcpy(vec.cipher_auth.digest.val, md.val, md.len); > + vec.cipher_auth.digest.len =3D md.len; > + > + if (info.file_type !=3D FIPS_TYPE_JSON) > + fprintf(info.fp_wr, "COUNT =3D %u\n", j); > + > + info.parse_writeback(&val); > + > + if (info.file_type !=3D FIPS_TYPE_JSON) > + fprintf(info.fp_wr, "\n"); > + } > + > + rte_free(md.val); > + rte_free(vec.pt.val); > + > + free(val.val); > + return 0; > +} >=20 > static int > init_test_ops(void) > @@ -2408,7 +2495,11 @@ init_test_ops(void) > test_ops.prepare_sym_op =3D prepare_auth_op; > test_ops.prepare_sym_xform =3D prepare_sha_xform; > if (info.interim_info.sha_data.test_type =3D=3D SHA_MCT) > - test_ops.test =3D fips_mct_sha_test; > + if (info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_128 || > + info.interim_info.sha_data.algo =3D=3D > RTE_CRYPTO_AUTH_SHAKE_256) > + test_ops.test =3D fips_mct_shake_test; > + else > + test_ops.test =3D fips_mct_sha_test; > else > test_ops.test =3D fips_generic_test; > break; > -- > 2.25.1 Acked-by: Brian Dooley