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 56900454E2; Mon, 24 Jun 2024 16:33:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A83440E26; Mon, 24 Jun 2024 16:33:38 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id E7689402F0 for ; Mon, 24 Jun 2024 16:33:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719239617; x=1750775617; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=hOIc7FgiupQwPypdHToeLtXY5aaXfVJKK5jJ2a5llP0=; b=h+S49eW3YGEYLpLyMK4pLbmZI5e2/Wu3aki9Jhh8csFnNVH80zZy53TW 2zHIn7h0x/lA3jQen3sg6xCZHJNblOlD0QiYdgmGGI2N+9zNuXOSZWaAR K4M/edMu8eySdoPLbiF0YNM3/DRIxgpz83jTs4+yYRhEq0YlpcVgwzILh /xuDWIvXob0i1c3aPx+0Hlu4uKvnd6xgwFBkkq8uPr+Y7b+3QgSjSNwQU YMUI+bAPfIXtamAhHxaDOZeYyvxEXkUdc+tbe7JpfXP8nhAzpZnkVOswt OeSbxfjtSfGuo3XhnvX+hcSSLbhjhBC42blAJsLnLfj0FJntCPkpAWafq w==; X-CSE-ConnectionGUID: UnfFUrNwTeejEeqPLPbtLA== X-CSE-MsgGUID: cTpunNV+SFWnrm+wn93B3Q== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="15902917" X-IronPort-AV: E=Sophos;i="6.08,262,1712646000"; d="scan'208,217";a="15902917" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2024 07:33:36 -0700 X-CSE-ConnectionGUID: Dbd76AjyS86wpjKepZO7cA== X-CSE-MsgGUID: /lPMd89BTr20nIKYXzCiGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,262,1712646000"; d="scan'208,217";a="43399050" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Jun 2024 07:33:36 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.39; Mon, 24 Jun 2024 07:33:35 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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; Mon, 24 Jun 2024 07:33:35 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.39 via Frontend Transport; Mon, 24 Jun 2024 07:33:35 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.46) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 24 Jun 2024 07:33:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MpZMKE2XZAOTH/n4FtR+BUVSOMB2bamYoS3d++dti3xLumMu1Qy7d+IOLPbVxcOB2HxX/nNnbiX4Nvz+TnVlmSXT6fp8GvJxHU6zCLjBGLct+LlL1NbsDDjEwv16e/XkSrWYBYn2fc9F1p/Ni/5HcgKBK9gJblLCYoJo6WlciK77Z+XpkJ0FO+PxY6pUoeDmxODsVYvsX5nloWqQGW5MWAYnEX4v5Z67G8h9dsd8jjGHbo57U8qvhOOjLAkwQ3Hrqe1hBFPrycqno/FOeqntbMVBOpWvGprv7fNcVFtTfqDcSve24kYJ7s7xKpcLJp0wTshLh1Pi2yVlsp/gPFu75A== 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=WbbYglI85+jhZlZte1GuIQekfQ216KjAppKNwxv75MA=; b=ddgWfTB+Pw3ysmXfRBF5uXKT21/G6WDfymbVX5defwbQoImHPXtXsHp5CSBP/YKEEc71XRuZ4E+kuXrnhtie4+eIYHcHjqDcknERiHX61aDKUSARN2QDJrrnIs2BsxgXCKIUJWs05s82HZ0miBdz+KDZHz8jUUDE9J/bQs99su1D96GES3FwZTwaEML+lh3EUbogpVRmFVS7IUliZNNhCgRV6zC95gNaq9IJ8CjBi5arQARoCcBkUZwDjXMrjWvG53VP6QUCEYw8/vaqey+Yvch/n2hopo+EtK4CcMKL6W/H2Qz8Q4sZON9JnH78V1Th2U76wOb26UWnOe7ISA8pHA== 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 DS0PR11MB7458.namprd11.prod.outlook.com (2603:10b6:8:145::13) by DM4PR11MB5261.namprd11.prod.outlook.com (2603:10b6:5:388::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.28; Mon, 24 Jun 2024 14:33:28 +0000 Received: from DS0PR11MB7458.namprd11.prod.outlook.com ([fe80::1a9e:53a6:9603:8f79]) by DS0PR11MB7458.namprd11.prod.outlook.com ([fe80::1a9e:53a6:9603:8f79%5]) with mapi id 15.20.7698.024; Mon, 24 Jun 2024 14:33:27 +0000 From: "Ji, Kai" To: "Dooley, Brian" , "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: AQHatyU7suGZTL1rTE2fnDsSO7sdg7HXGHzD Date: Mon, 24 Jun 2024 14:33:27 +0000 Message-ID: References: <20240605084844.270122-1-brian.dooley@intel.com> In-Reply-To: <20240605084844.270122-1-brian.dooley@intel.com> Accept-Language: en-GB, en-US, en-IE Content-Language: en-GB 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: DS0PR11MB7458:EE_|DM4PR11MB5261:EE_ x-ms-office365-filtering-correlation-id: efc3e7e7-0d4a-49fc-603b-08dc945a9cbf x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230037|376011|366013|1800799021|38070700015; x-microsoft-antispam-message-info: =?us-ascii?Q?YCuiM768Ymg8hEBxRiDTI0Oy4zDPRFQ+ca38BT/hl18YKfhBS/lstaIbMi6J?= =?us-ascii?Q?0pRAtXSIT4A/v5Ypb3r6TbTk6ySpJqEXx0CXBHnWmMV4vgR6dnHDXo/efPB7?= =?us-ascii?Q?KipS2LDi6Sguc34wd6fu8AaCaTzuFG+ocwkjRYgZgWmT2T9IkHAf71+ktv/i?= =?us-ascii?Q?pFUx+5sb+bbBq2te/5dpyZRTtysuG8Qmt/ouUdMe/RBHNZwOZCpeUp7b3Tb5?= =?us-ascii?Q?bibc8qv2eE5Vw7XSt1RyJTzHwfFQ/yH9fQ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APO2ZmkUvzuNMYB6xOZo8D9TJih4BoEAxvxi/IZ7LFv4KXwjKeRyGvr1lqh?= =?us-ascii?Q?XW/HDgPXcNw84YCNtOpy4V2bzP2E3uwF7igbn4CzKzj/YyMdxrSDB1zjoUDn?= =?us-ascii?Q?5ErmTyLe3MbsYU3fsRBZu1kY4aZ1QOfRR67pJkWKUJusDs3Cj4Yc7R+999SI?= =?us-ascii?Q?S0Y3THU6tylPBDXEyEZjtYDY+vp3CGkHm29n3/Dg329FxoHc5WncQc3z+q6h?= =?us-ascii?Q?btZCHoQ=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7458.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(376011)(366013)(1800799021)(38070700015); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Fyvxcj7ROlZtK6b+O9o17XNjOiR/HMlQ9OJ3q+6dl33cw14H1ZQ0ROTyesu1?= =?us-ascii?Q?NmqeFXZLnmdwtbEHAqqdA7+rM9lqyB2i5RbPKPVT12AGdfiyWcMWbmUKlQL7?= =?us-ascii?Q?XIC5ELPEUmMRgz0mN9Ecw8s2CeJIXXt5JBlQBjXh18j624u+4qru/Ed8e8w4?= =?us-ascii?Q?FiHKaeHVfbw+tmTtf7qhpS8CFxkoR+EH0VgFb+1dsZWwzC9RsEehzVIIUVL3?= =?us-ascii?Q?n5ZKpqqcH6+13LF7MQZXe9wFX0gKWk0WhbAxJZMQMcWghMTuKXLJsdZEhTin?= =?us-ascii?Q?pT8jws3TwWBM4FNNdqtgNwl7EbX/DmRyYzPuLhZ7cMPPSY38KXw+7jQwLk5X?= =?us-ascii?Q?8i7ryjN+Fk5C38awVwRpIDIlc0FtW66YlYVXjHSqsKcuGRky48fsbrr1/GCu?= =?us-ascii?Q?2xcbzACvy34SaJtJkGu0J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= =?us-ascii?Q?fALWMLuFPj4as4Wg9KZ+jXo2OhGnCPrWSm9OvUa+TZ+FL6mr5OkTc4FuBB7n?= =?us-ascii?Q?SyvVttOnt2W+M5T4xUyJ9wtytRodeXFIHuBgfr257PkDLz4rEA2eCjG3R+tf?= =?us-ascii?Q?WoihTQakRPj/YiUdfpROUXR/TSDjNeSwaAZMTJggZLPSbjikuFSUXNqCdPMW?= =?us-ascii?Q?jqxNQFFk1Jmre2CfJLQdnaWczqxlMCnTjV0VbjpHU0CxajYjR1EeXwzdoMEn?= =?us-ascii?Q?1RxbN+YOc48b4RnmV9w=3D?= Content-Type: multipart/alternative; boundary="_000_DS0PR11MB7458B4C3656E7142A7217CB981D42DS0PR11MB7458namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7458.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: efc3e7e7-0d4a-49fc-603b-08dc945a9cbf X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2024 14:33:27.6906 (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: R7uZibF4iFGvwldHvCgr2TUkba2SPrX5FkVithkLaoAeRwRs1Y+OzolFOTIbzNzHZLfm8PUcb7MvbaER0rl8cA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5261 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_DS0PR11MB7458B4C3656E7142A7217CB981D42DS0PR11MB7458namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acked-by: Kai Ji ________________________________ From: Dooley, Brian Sent: 05 June 2024 09:48 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_DS0PR11MB7458B4C3656E7142A7217CB981D42DS0PR11MB7458namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Acked-by: Kai Ji <kai.ji@intel.com>

From: Dooley, Brian <bri= an.dooley@intel.com>
Sent: 05 June 2024 09:48
To: Ji, Kai <kai.ji@intel.com>; De Lara Guarch, Pablo <pabl= o.de.lara.guarch@intel.com>
Cc: dev@dpdk.org <dev@dpdk.org>; gakhil@marvell.com <gakhil= @marvell.com>; Dooley, Brian <brian.dooley@intel.com>
Subject: [PATCH v1] crypto/ipsec_mb: use new ipad/opad calculation A= PI
 
From: Pablo de Lara <pablo.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_DS0PR11MB7458B4C3656E7142A7217CB981D42DS0PR11MB7458namp_--