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 3F9E145499; Thu, 20 Jun 2024 11:00:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C76C8410FA; Thu, 20 Jun 2024 11:00:29 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by mails.dpdk.org (Postfix) with ESMTP id 6265C402D0 for ; Thu, 20 Jun 2024 11:00:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718874028; x=1750410028; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=GNwIzqfB7JYOJkI/8MLhHn8hyvxyfFMp+wN+Cid03HA=; b=fUGIcgUn1Ykn0qxhDuOwR1JCr4ApUrNFD94JMXLTQU2e1hGim5CuQ3lC 5FDRYX7/jxAN0ghG7P5jWFCD6GAWI+OSk2Ng+dQS51q/TyEvZVjDgDmG0 xXZs1ioFHnPayk2C226EHxsJLbA4KzmpjVSw1kjADfMrslQ3vewZ/Y9AA HTz54KyLob7Zfe9aiyOf7bGhIs8nQcHxCf1ADsUABvNHNz67ImGh1XWON AFYzGAUFMb3bmh9ucJYyXualymLpuZA9TOlbhe8US5yBQDohJ3YR72/wW Hq3WQquhNhpokz31Ar09C2wRxEm8ZTsjdkqznC5n6FArMhhBeeVRDQAqi Q==; X-CSE-ConnectionGUID: pyNHhmaNQkiBQKZuOKxXXw== X-CSE-MsgGUID: V/52T92UQEauLUuJy+D4Yw== X-IronPort-AV: E=McAfee;i="6700,10204,11108"; a="15957221" X-IronPort-AV: E=Sophos;i="6.08,251,1712646000"; d="scan'208,217";a="15957221" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2024 02:00:27 -0700 X-CSE-ConnectionGUID: Us5ctr50SWyVrvsoUouWgg== X-CSE-MsgGUID: BRRX/WX5Q1+p5CxM8nBi4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,251,1712646000"; d="scan'208,217";a="42293872" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 20 Jun 2024 02:00:26 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 20 Jun 2024 02:00:25 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 20 Jun 2024 02:00:25 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.41) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 20 Jun 2024 02:00:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXhENu4Il4N/+6z6SbOudUvasTCf4hSozd3SIajRfpYZJohySQ4Dsvy94iChyN2WlcTnnAnVIi6j6dk4Xgxp77xvcsJHx61LbYQMObgdirFAePP3l3a3LeZCEHRrSFW39nJXjCRPfM/JMiJZqrjgFJcfz69CyFPaWRzQ3yldNEBGp8VIcv0UJwlSdyAOowaxD6CJIKAOxLx6E9bsvxJbPc7ByDkvFRbpzNorO83gArnyxYChPG45jdAxfW1Y0oRC7FWVz3CxB95INnFYiummv1sa0FIMirqOwcwH8jB4sYfgZ7fya/GsM6XWNONsSiTQa9yzMCsUMhPlNw0c0+fZLw== 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=E5Y8LyerPPImjk4DWZGYQEjgBCvfwxCUDEHYWwxhxEc=; b=B6NzZC8bEm+qWnDvvu4b6PboMW6By+Y5QcV1KvWA3DUfErEGry4Goij2bEIQf9U9dcJhVQbdn2rE/hLtjZ6n9hZYcqnSNX0yxjrPXQhv9qGr0Z5ljnZozmu0+AxydGvn6ZYg96GmeL95KQwP/KmRQxvZ9yGJHWFMJ64QXy6lkxP9PLG/erS0Ln59eXXpqV6kk1Ni+na7Sx+xYAYWVA+4AGJ0o23yQ9pLN8XHm1VKf/BN15FR3xTgSPJZAcOgluvmyTFxmt5VwzBq2Q3opBItir9YE8TLU9zH2SQDYKdL1tPihRM+bgIn++DNGWYwrFeDl5k9FoRTk3H2VR8m5Tenng== 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 SA2PR11MB5052.namprd11.prod.outlook.com (2603:10b6:806:fa::15) by SJ0PR11MB4895.namprd11.prod.outlook.com (2603:10b6:a03:2de::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Thu, 20 Jun 2024 09:00:23 +0000 Received: from SA2PR11MB5052.namprd11.prod.outlook.com ([fe80::d214:3c38:978b:1972]) by SA2PR11MB5052.namprd11.prod.outlook.com ([fe80::d214:3c38:978b:1972%5]) with mapi id 15.20.7698.017; Thu, 20 Jun 2024 09:00:23 +0000 From: "Dooley, Brian" To: "Ji, Kai" , "De Lara Guarch, Pablo" CC: "dev@dpdk.org" , "gakhil@marvell.com" Subject: Re: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API Thread-Topic: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API Thread-Index: AQHatyU70XPJ/QRoq0Omcq13awSKm7HAr4MigA/CpgI= Date: Thu, 20 Jun 2024 09:00:23 +0000 Message-ID: References: <20240605084844.270122-1-brian.dooley@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: 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: SA2PR11MB5052:EE_|SJ0PR11MB4895:EE_ x-ms-office365-filtering-correlation-id: 1471f640-51cf-40b4-9538-08dc91076ba3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230037|1800799021|366013|376011|38070700015; x-microsoft-antispam-message-info: =?iso-8859-1?Q?1A21aIZWdG90JEobl+TiRid7hpA7nPkDPcf4cPdcz4+o+/f/Uu87RPPJO+?= =?iso-8859-1?Q?AGrGl7IIQKahUJ830+jA2vSJKuPfcTqXVod/MlU0r1yNWR0UF8QuHg4QAS?= =?iso-8859-1?Q?bLP9n7WYQHDcU8cxZIZBm6WaNI3UNavphBFDG3OlrCe9ynBdCtNp6DCI9L?= =?iso-8859-1?Q?DfQ4ecE9/jcbZzOjPraHTSGYfcBRbIA5BMPlv+Uww5EryyqvD6q994wbOY?= =?iso-8859-1?Q?zVzgrlruCIuS31jhN4inhJMo0QQX6i4iUWoEy75qa6rB0YOpO0EfrRZ9d9?= =?iso-8859-1?Q?SPI+m4zVQGDBjJ5IUYPtz/siJrWD/X4aulyJwwR5x0RUci6HkMFt4gxvpl?= =?iso-8859-1?Q?Iw8ikfPYjlfYBvl9NHp0KG03wDbOEirJaDwdmIg5J8m4lK5W4DY8dO88A7?= =?iso-8859-1?Q?MVGcuD2mjXcLsMnYsTynJlx0dHs1xbeD+gWHHz7aTR5uVlIKOZIFfgdml2?= =?iso-8859-1?Q?g9YX0kmMGLK5VF21yxdFWLqDTFZ4bUnrEo9iWXCvVRo88w8k7aByxiRinT?= =?iso-8859-1?Q?pbSLLotjCspzECmgFx7eciOygngvAVr/3jnCy9IrzGJeVNkBYceQPiRIuX?= =?iso-8859-1?Q?xZz4dkkUhPj4rZF3aX1wibjvdR38GOFIcvEhE/GT2px3oCjJqlmByrXGoF?= =?iso-8859-1?Q?jkEn3MdShu9C9Cvu3K/z9nbhq8itIwLJ5mje888qpGTtReCPfXKLw1edWV?= =?iso-8859-1?Q?YYx2didCBMFmQ5Y4C2ZZ4WOBkoYqgFX+DQw7ZUB8jBekZiIoDYDs2WkYa8?= =?iso-8859-1?Q?DIQUkznqaCKN3mytgjKY7w/9EWvkwvYR0sHDjiZcKSJqXQI16LOvjdjsYI?= =?iso-8859-1?Q?hh/qSLVhr6WVf16o99fMoBNKzeKbUQ/9yECC8sOfejvRir7ZN4860rbfvs?= =?iso-8859-1?Q?dtWbtQtXzwHloijyyv30bilVejLuG0Yy+dvVjE1vIJaY1cCem1ubd5JQJr?= =?iso-8859-1?Q?eqkB1xtq29KIPzrw2T54BSggqXqnZ1pZgUTndwxcaNstLaKye2yZz5wuFa?= =?iso-8859-1?Q?eodRomBv7uijkzPE6m2cvWeiDJyo2/H1amhHPwpx3Hm/kZ1jw1UFa4v2bG?= =?iso-8859-1?Q?NtRT8JXZN4SaioV/DAuCi9vH4BvEls4VUKcR2WtpZZpDkJF20hAUbsbhVU?= =?iso-8859-1?Q?HgDNQAfilJW/0sJGgnV7fvTf0NfVjgrnPF061ZEIQR1KUlOXAvr/RKKd2p?= =?iso-8859-1?Q?dWZUScRqv8fiAEPyPsyBtRggFQvBHM/jqRHWFBjTL+OsWEslknVOphF5lE?= =?iso-8859-1?Q?X8azhmmganeNgwgF7PAvkq73LHZ1+0jlEwmN5QkmbpWO5V0eC9Ipeyx46Z?= =?iso-8859-1?Q?2D/g87vPutQ2VSzMny2/irxHSi/rGGqR7/myM4y6dUdqQ792i1fSCww6mB?= =?iso-8859-1?Q?jDdvvtSJuo1nCGItRUhPlyq5mQs1zpZr/ZMDFJYKFguC8kJT+6uwQ=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR11MB5052.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(1800799021)(366013)(376011)(38070700015); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?n5hDHHALCFJRPUXOsUo88U9zJxcvO1wSO2Zj9xPccTINfrLR10YdkCWPXN?= =?iso-8859-1?Q?fyUE8jLStlPyJtSOITbEJp27W+rX8CYhAvEF57YEkBNJC6dxK+lpNjScwR?= =?iso-8859-1?Q?nzud/MGqCk9JpT45KWBPir0gSSF8mkh28wOzJOIlxYhxjndG1YswHiMGMS?= =?iso-8859-1?Q?wpZszyQRrzsp1vIAfn1JVNsTzllsIZ2AvaqBSWxpWZLowCAOCHFmEcbhBd?= =?iso-8859-1?Q?omcbEZjjtq673zZ9xhSbKXpkFoK95y83WXtD0EkHHnZZf/tNusBm58VFa6?= =?iso-8859-1?Q?pla9KWdH2+kSzahi9e+fCBjuErZcRhv9eFgwoYJcPOwY/awXzrteUvpEER?= =?iso-8859-1?Q?PKpmD/m/uVlMICynSDc9EVBKjQomi7b19k8i1wTuAlu2YXSak9QJeXA3JI?= =?iso-8859-1?Q?+EnlM/4vQ8koTaj1WpVHACnf7Avb3BeG2yY0fCC0iVxDcN3+67fkO31+hD?= =?iso-8859-1?Q?FGZA8w9bCcQUq1kx1CeFnwxNC/UKJZ+LiCtU8SpxVCkpK7O9Lta9L6j5o8?= =?iso-8859-1?Q?E5bbUvwrfmNZywq+hCrFediK/qf2HdTtBZ10sikw3mXbuMr1PwJZhgEnH7?= =?iso-8859-1?Q?eiWs1iLmfsttdocdiGIWG6bE44Vc+PpbCN89WokF7yY4ENmmtQNWiIawWX?= =?iso-8859-1?Q?6C1aDHpadv5e+xdL4skKxlnaJAQB1DKZKGgURxDS7L/oPjVNMWLzD7isFL?= =?iso-8859-1?Q?c0HNTeMpUA32SFOKhilIuHKt8OaNQjO5ycOUcyWbtgVdqA0F+9xSptb9+3?= =?iso-8859-1?Q?WQIeH8m2N8J0fmA7T33SMt65A/xD0gFu56S6if+yWcGyA+AHLuC8HAovOU?= =?iso-8859-1?Q?DHtASdSyiIIYgMAzmzXis5NTOeDOwQpyHw1g2OFMK/0UjU76Ow/5X+f2l2?= =?iso-8859-1?Q?oAVDS2oJ43MgGjZaALQGNfqo0h2BPDfiJYZi+qkXpOgVJw/xQD4GffQhAj?= =?iso-8859-1?Q?L/mG1tQwPYDirOUpLsW/CwKa7USFc6RwaOp2YiPgFe+LMXDB9udpYIE2qD?= =?iso-8859-1?Q?ndsjtE7fLjClYsiYYFuExURg7XDADgoffYs33pjg3TFqRoENTzthaR5jbL?= =?iso-8859-1?Q?3cdpkfGf8Pq9g8vkHLYMySuWOR8lxE3siCaFEgDcbFOJp30bDUFfy0CDB7?= =?iso-8859-1?Q?EdGILh3SRhAqSK7jGKTCrxo1+mABS/IrM5q5H05YT+lu91oP4KJPoRneNk?= =?iso-8859-1?Q?87hSD7drzLa40ENM3FCRaMl51mWg+o/bVsw3xHaoCo6NEnz+GZzduBzq7V?= =?iso-8859-1?Q?XAZORK5u7okz2KayAtKGrJaok6Lren72mgsUlRYwOo3qlE1wG09NkZrEFG?= =?iso-8859-1?Q?MeIDP0VVc5Umj7OTfMozKdiY+fV2IXHH1QNpmKAnpUC/BOjnss7kbMGtOi?= =?iso-8859-1?Q?d3uWNyy4lGtpvc0o9d5M8WfKjs5Wjke2RSXwjy1dTXwrHHV8GFzlOJzsna?= =?iso-8859-1?Q?YV46OvqjWtweT0z+JamlII1imQRQ8iQEsKFnkTEoLsn7z188jmyx5DSBPn?= =?iso-8859-1?Q?4w0Njbq41r2bA373dRO4dXNjoTfuvHSkkB/BDcaunHvk3e18Eg7I2q0IZG?= =?iso-8859-1?Q?aK4XO09ymfGsgqpeVTYTnFoRzjZN0h5hhy7FqzrIT8iHmncXgkBqrduoql?= =?iso-8859-1?Q?MHp3PSjlRpSriwnm3Brek3mJqgYw6etexz?= Content-Type: multipart/alternative; boundary="_000_SA2PR11MB5052498C661AB435A1A1249E83C82SA2PR11MB5052namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA2PR11MB5052.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1471f640-51cf-40b4-9538-08dc91076ba3 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jun 2024 09:00:23.6090 (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: T2LPKOpMG4GDWq4cKNEa+D23C8h7SrhXD36FwOMBJaDYHpJbYhJf5cpjYkcqADItIhaFOko0ZhAhqrP7VfruPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4895 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 --_000_SA2PR11MB5052498C661AB435A1A1249E83C82SA2PR11MB5052namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Recheck-request: iol-unit-arm64-testing ________________________________ From: Dooley, Brian Sent: Monday, June 10, 2024 9:19 AM To: Ji, Kai ; De Lara Guarch, Pablo Cc: dev@dpdk.org ; gakhil@marvell.com Subject: Re: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API Recheck-request: iol-unit-amd64-testing ________________________________ From: Dooley, Brian Sent: Wednesday, June 5, 2024 9:48 AM To: Ji, Kai ; De Lara Guarch, Pablo Cc: dev@dpdk.org ; gakhil@marvell.com ; D= ooley, Brian Subject: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation API From: Pablo de Lara IPSec Multi-buffer library v1.4 added a new API to calculate inner/outer padding for HMAC-SHAx/MD5. Signed-off-by: Pablo de Lara Signed-off-by: Brian Dooley --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 34 +++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_= mb/pmd_aesni_mb.c index 69a546697b..b3fdea02ff 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -13,6 +13,7 @@ struct aesni_mb_op_buf_data { uint32_t offset; }; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM /** * Calculate the authentication pre-computes * @@ -55,6 +56,7 @@ calculate_auth_precomputes(hash_one_block_t one_block_has= h, memset(ipad_buf, 0, blocksize); memset(opad_buf, 0, blocksize); } +#endif static inline int is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) @@ -66,12 +68,14 @@ is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cip= her_mode) /** Set session authentication parameters */ static int -aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, +aesni_mb_set_session_auth_parameters(IMB_MGR *mb_mgr, struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform) { +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_one_block_t hash_oneblock_fn =3D NULL; unsigned int key_larger_block_size =3D 0; +#endif uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] =3D { 0 }; uint32_t auth_precompute =3D 1; @@ -267,18 +271,24 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr, switch (xform->auth.algo) { case RTE_CRYPTO_AUTH_MD5_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_MD5; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->md5_one_block; +#endif break; case RTE_CRYPTO_AUTH_SHA1_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_1; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->sha1_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_1)) { IMB_SHA1(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM key_larger_block_size =3D 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA1: @@ -287,14 +297,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr, break; case RTE_CRYPTO_AUTH_SHA224_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_224; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->sha224_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_224)) { IMB_SHA224(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM key_larger_block_size =3D 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA224: @@ -303,14 +317,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr, break; case RTE_CRYPTO_AUTH_SHA256_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_256; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->sha256_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_256)) { IMB_SHA256(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM key_larger_block_size =3D 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA256: @@ -319,14 +337,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr, break; case RTE_CRYPTO_AUTH_SHA384_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_384; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->sha384_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_384)) { IMB_SHA384(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM key_larger_block_size =3D 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA384: @@ -335,14 +357,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr, break; case RTE_CRYPTO_AUTH_SHA512_HMAC: sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_512; +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM hash_oneblock_fn =3D mb_mgr->sha512_one_block; +#endif if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_512)) { IMB_SHA512(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); +#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM key_larger_block_size =3D 1; +#endif } break; case RTE_CRYPTO_AUTH_SHA512: @@ -376,6 +402,11 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb= _mgr, return 0; /* Calculate Authentication precomputes */ +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + imb_hmac_ipad_opad(mb_mgr, sess->template_job.hash_alg, + xform->auth.key.data, xform->auth.k= ey.length, + sess->auth.pads.inner, sess->auth.p= ads.outer); +#else if (key_larger_block_size) { calculate_auth_precomputes(hash_oneblock_fn, sess->auth.pads.inner, sess->auth.pads.outer, @@ -389,6 +420,7 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_= mgr, xform->auth.key.length, get_auth_algo_blocksize(sess->template_job.hash_al= g)); } +#endif sess->template_job.u.HMAC._hashed_auth_key_xor_ipad =3D sess->auth.pads.inner; sess->template_job.u.HMAC._hashed_auth_key_xor_opad =3D -- 2.25.1 --_000_SA2PR11MB5052498C661AB435A1A1249E83C82SA2PR11MB5052namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Recheck-request: iol-unit-arm64-testing


From: Dooley= , Brian <brian.dooley@intel.com>
Sent: Monday, June 10, 2024 9:19 AM
To: Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo <= ;pablo.de.lara.guarch@intel.com>
Cc: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <g= akhil@marvell.com>
Subject: Re: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calc= ulation API
 
Recheck-request: iol-unit-amd64-testing


From: Dool= ey, Brian <brian.dooley@intel.com>
Sent: Wednesday, June 5, 2024 9:48 AM
To: Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo <= ;pablo.de.lara.guarch@intel.com>
Cc: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <g= akhil@marvell.com>; Dooley, Brian <brian.dooley@intel.com>
Subject: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculat= ion API
 
From: Pablo de Lara <pab= lo.de.lara.guarch@intel.com>

IPSec Multi-buffer library v1.4 added a new API to
calculate inner/outer padding for HMAC-SHAx/MD5.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Brian Dooley <brian.dooley@intel.com>
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 34 +++++++++++++++++++++++++= -
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_= mb/pmd_aesni_mb.c
index 69a546697b..b3fdea02ff 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -13,6 +13,7 @@ struct aesni_mb_op_buf_data {
         uint32_t offset;
 };
 
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
 /**
  * Calculate the authentication pre-computes
  *
@@ -55,6 +56,7 @@ calculate_auth_precomputes(hash_one_block_t one_block_has= h,
         memset(ipad_buf, 0, blocks= ize);
         memset(opad_buf, 0, blocks= ize);
 }
+#endif
 
 static inline int
 is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode)
@@ -66,12 +68,14 @@ is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cip= her_mode)
 
 /** Set session authentication parameters */
 static int
-aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr,
+aesni_mb_set_session_auth_parameters(IMB_MGR *mb_mgr,
            &nb= sp;    struct aesni_mb_session *sess,
            &nb= sp;    const struct rte_crypto_sym_xform *xform)
 {
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
         hash_one_block_t hash_oneb= lock_fn =3D NULL;
         unsigned int key_larger_bl= ock_size =3D 0;
+#endif
         uint8_t hashed_key[HMAC_MA= X_BLOCK_SIZE] =3D { 0 };
         uint32_t auth_precompute = =3D 1;
 
@@ -267,18 +271,24 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr,
         switch (xform->auth.alg= o) {
         case RTE_CRYPTO_AUTH_MD5_H= MAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_MD5;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->md5_one_block;
+#endif
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA1_= HMAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_= 1;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->sha1_one_block;
+#endif
            &nb= sp;    if (xform->auth.key.length > get_auth_algo_bloc= ksize(
            &nb= sp;            =         IMB_AUTH_HMAC_SHA_1)) {
            &nb= sp;            IMB_S= HA1(mb_mgr,
            &nb= sp;            =         xform->auth.key.data,
            &nb= sp;            =         xform->auth.key.length,
            &nb= sp;            =         hashed_key);
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;            key_l= arger_block_size =3D 1;
+#endif
            &nb= sp;    }
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA1:=
@@ -287,14 +297,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr,
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA22= 4_HMAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_= 224;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->sha224_one_block;
+#endif
            &nb= sp;    if (xform->auth.key.length > get_auth_algo_bloc= ksize(
            &nb= sp;            =         IMB_AUTH_HMAC_SHA_224)) {
            &nb= sp;            IMB_S= HA224(mb_mgr,
            &nb= sp;            =         xform->auth.key.data,
            &nb= sp;            =         xform->auth.key.length,
            &nb= sp;            =         hashed_key);
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;            key_l= arger_block_size =3D 1;
+#endif
            &nb= sp;    }
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA22= 4:
@@ -303,14 +317,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr,
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA25= 6_HMAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_= 256;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->sha256_one_block;
+#endif
            &nb= sp;    if (xform->auth.key.length > get_auth_algo_bloc= ksize(
            &nb= sp;            =         IMB_AUTH_HMAC_SHA_256)) {
            &nb= sp;            IMB_S= HA256(mb_mgr,
            &nb= sp;            =         xform->auth.key.data,
            &nb= sp;            =         xform->auth.key.length,
            &nb= sp;            =         hashed_key);
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;            key_l= arger_block_size =3D 1;
+#endif
            &nb= sp;    }
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA25= 6:
@@ -319,14 +337,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr,
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA38= 4_HMAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_= 384;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->sha384_one_block;
+#endif
            &nb= sp;    if (xform->auth.key.length > get_auth_algo_bloc= ksize(
            &nb= sp;            =         IMB_AUTH_HMAC_SHA_384)) {
            &nb= sp;            IMB_S= HA384(mb_mgr,
            &nb= sp;            =         xform->auth.key.data,
            &nb= sp;            =         xform->auth.key.length,
            &nb= sp;            =         hashed_key);
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;            key_l= arger_block_size =3D 1;
+#endif
            &nb= sp;    }
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA38= 4:
@@ -335,14 +357,18 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *m= b_mgr,
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA51= 2_HMAC:
            &nb= sp;    sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_= 512;
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;    hash_oneblock_fn =3D mb_mgr->sha512_one_block;
+#endif
            &nb= sp;    if (xform->auth.key.length > get_auth_algo_bloc= ksize(
            &nb= sp;            =         IMB_AUTH_HMAC_SHA_512)) {
            &nb= sp;            IMB_S= HA512(mb_mgr,
            &nb= sp;            =         xform->auth.key.data,
            &nb= sp;            =         xform->auth.key.length,
            &nb= sp;            =         hashed_key);
+#if IMB_VERSION(1, 3, 0) >=3D IMB_VERSION_NUM
            &nb= sp;            key_l= arger_block_size =3D 1;
+#endif
            &nb= sp;    }
            &nb= sp;    break;
         case RTE_CRYPTO_AUTH_SHA51= 2:
@@ -376,6 +402,11 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb= _mgr,
            &nb= sp;    return 0;
 
         /* Calculate Authenticatio= n precomputes */
+#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM
+            &n= bsp;  imb_hmac_ipad_opad(mb_mgr, sess->template_job.hash_alg,
+            &n= bsp;            = ;            &n= bsp; xform->auth.key.data, xform->auth.key.length,
+            &n= bsp;            = ;            &n= bsp; sess->auth.pads.inner, sess->auth.pads.outer);
+#else
         if (key_larger_block_size)= {
            &nb= sp;    calculate_auth_precomputes(hash_oneblock_fn,
            &nb= sp;            sess-= >auth.pads.inner, sess->auth.pads.outer,
@@ -389,6 +420,7 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_= mgr,
            &nb= sp;            xform= ->auth.key.length,
            &nb= sp;            get_a= uth_algo_blocksize(sess->template_job.hash_alg));
         }
+#endif
         sess->template_job.u.HM= AC._hashed_auth_key_xor_ipad =3D
            &nb= sp;    sess->auth.pads.inner;
         sess->template_job.u.HM= AC._hashed_auth_key_xor_opad =3D
--
2.25.1

--_000_SA2PR11MB5052498C661AB435A1A1249E83C82SA2PR11MB5052namp_--