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 8D7AE41F67; Mon, 10 Jun 2024 10:25:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A10F40647; Mon, 10 Jun 2024 10:25:25 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mails.dpdk.org (Postfix) with ESMTP id 9E9CB402CE for ; Mon, 10 Jun 2024 10:25:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718007923; x=1749543923; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=v/h+F/FcMmj+Pm4s0Q/+kF20qx/W9dRF0QSO6seJNWw=; b=c5rvkMZQxwjCVQRHvCtlNdoSFYgmo8/DCefweeOL3hCPbFW8DNxSWJ51 il94KWU3/KHZF1rF0xm+VnYS5yGfq95skMusInCcTRzsYFt4w1GSsrLYS 2oye/ipoyBckSNjNqKsxyeXyDp+OJw8ONHkYMGNAKSpEhq+2XobmI2+io 4210zhuTaPcKLoHtW/FCVSScnBK9MDfffqEOLwhauUPv5+uxfcSv54RSO EvUIbSz3Qz/hlybJ0tAS+I9ANPdOcNgJiAi/2/LozwfNsRg5Zk2gz39XL awCpG7FY+Uta5GPJX0L5Zg6s7NRDvaBgGgpT9oAkThv7m/OOErWV3AOtp g==; X-CSE-ConnectionGUID: fcDvdYWZQXSH2f+2XIzbfQ== X-CSE-MsgGUID: PVYXiDfpQqe5dpqjL6W5cw== X-IronPort-AV: E=McAfee;i="6600,9927,11098"; a="25317279" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208,217";a="25317279" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 01:19:49 -0700 X-CSE-ConnectionGUID: ox7/BiynS8eh/yxFA7xSLg== X-CSE-MsgGUID: VFB0Tzl3QTepauqW1q0gDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208,217";a="39529815" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Jun 2024 01:19:49 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 01:19:48 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 10 Jun 2024 01:19:48 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) 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, 10 Jun 2024 01:19:48 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.44) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 10 Jun 2024 01:19:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gk01HcWw1BPZFSN3qUT8RSZhG3/00lWMZhygxRq/f4+ZcI76gdY5md/qsfg+F/WcjHiQ018ekbGFZoK/IxtflcNtwaABuWVv/fKRpSeDs75oedPjy0hgzig27oHJbTglH7gtcj4lqlS0b3n8TpDNOciRw6S5jKw4CBXH9x1RZ4OJLIBVJQvxYblDeBFqMRrUiGEajjii5OQ9bJuFmDC8Bvkm70ercdVbblG6js2DcihZQfAPP6ZXYZDCImGcxqXkcCWmedRuUqVSvHErzPJHY0cOGxvOo9ovDIlEIxCA0ycrAhTXHjHlZQqo1Rkw0LpQ9Z5NrQcETdX4VUQIfoRSHA== 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=xWqkgRxzuWGPB3uVR9mkY5RVbeRTO5LJAUfPcxn3O40=; b=TE4G+SDtVSfv4WsMmcJUxUMiM54ryl6gr5EBektU+fIah04ACh+aTa15yuVJlBaiJ7hoO2TjgnUdds0gsZmvvS32tDcTh3nBBit4MpfxQ3Te7tfj1Nl6uiT+lajFLHoS1LHJNYXX0AkG0q0DNmnkrmfv4LBZgvxxrJ0z+ZojN94/pIQAbYxwTUjibtw6dOUViDHRpHhpt9oPXNdxJ5fzBQ15dfkjF+SqqyZ5KzMCZ1zm5O2kaFF6StW6mdQ7WFmSsqYkJh6XTM6bcCyzi2aE+o4k27lpWYg1FHpGbjNKQAw3v5lCGvOCVRGjvm+7FVC5KJDhGkfk4ClKXogEPYlHYw== 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 SJ0PR11MB5056.namprd11.prod.outlook.com (2603:10b6:a03:2d5::6) by SA1PR11MB6991.namprd11.prod.outlook.com (2603:10b6:806:2b8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.33; Mon, 10 Jun 2024 08:19:45 +0000 Received: from SJ0PR11MB5056.namprd11.prod.outlook.com ([fe80::4f35:279e:a725:ad08]) by SJ0PR11MB5056.namprd11.prod.outlook.com ([fe80::4f35:279e:a725:ad08%6]) with mapi id 15.20.7633.036; Mon, 10 Jun 2024 08:19:45 +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/QRoq0Omcq13awSKm7HAr4Mi Date: Mon, 10 Jun 2024 08:19:45 +0000 Message-ID: References: <20240605084844.270122-1-brian.dooley@intel.com> In-Reply-To: <20240605084844.270122-1-brian.dooley@intel.com> 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: SJ0PR11MB5056:EE_|SA1PR11MB6991:EE_ x-ms-office365-filtering-correlation-id: 47a68a25-ea84-47ac-c0d4-08dc8926165d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|376005|1800799015|38070700009; x-microsoft-antispam-message-info: =?iso-8859-1?Q?ohy/tYsNPhxxtD8NDnaZCBZ2dfv8lCgbZ/TsNeQKmnn6NVv4Kv7l7LWtxq?= =?iso-8859-1?Q?HcF3AH7rX3gOHCXXnHKyVQjNdAkdYD8LWwS0+u8IgbkhgGnCUUrrj0xEZP?= =?iso-8859-1?Q?t8r6IN4EGtKrPTzk1jKWxaqWS9m8Tx1ZA4udln0rtJyCWPYehKMZjcsDmH?= =?iso-8859-1?Q?2Eoww/8bD/UNTWe+LL3AesTp5a/kPW1Nwqwvu7IbluY/zHaMQN1PKLy/X2?= =?iso-8859-1?Q?VGSXFM02tb/x0Vau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-1?Q?gweEMJXTmR++24/mea3lMUsnUcvgse3OyCn6tx2ztGbYev8NrJ7edumoXc?= =?iso-8859-1?Q?iRX3lAzJ4KhSxqv7wOO9Q2C4negV68Y+H/W1j8+QnJr4SI5M/XF3f+IB0v?= =?iso-8859-1?Q?dC7tln/GO/oxtgQBq0OZef1v/Z0D+4eHb9dDKBi84uvGkyFOOzkzN+v7Mx?= =?iso-8859-1?Q?9ZBgc16xfAe+lrLqpIBxXH4fFnDRnGEin4Pi6i84d5e6l1R2eaHmKMdZ5I?= =?iso-8859-1?Q?t0zkLZrCmNwuxWZy8+o3SAwB0mPve1dKWGHjQSEIv4LvNMw5ueMwk=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5056.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?ouvlEGfXgIR/72SoaFxEL6SK3C3t3lJjg2ob08b16ZV4NUpiE5WoqlogwA?= =?iso-8859-1?Q?6XiGoLVwoM99vkhyyDDv+Z4OSxs4C2PhBckELBWR75girxKc7jX2d8hIEE?= =?iso-8859-1?Q?dOOyhyik6BQGYh3VN85ZIxIWcZDbbynAiAOvK4d1HrRXnMhMexATuUYJQ7?= =?iso-8859-1?Q?VuwqYX0HObL9B8cHhUvayJ2XnOqnevXtABB5066Tixk7ue3Lcju38qQNWk?= =?iso-8859-1?Q?5SEVFPDft/Vr368yTCC+6+9L32LUi2rlDLcyU7xLIze5XiKNy7Kcyl9lLQ?= =?iso-8859-1?Q?qioYT8FHVhoyJts2spDTwJI7IUJAlKu18k8JLBBd3n//o4ziLAyRPiMNUs?= =?iso-8859-1?Q?jpNJ5ld/yqitJfXr3fKDP7FQ89/zwZJJXEqBRzGZiw1NeVmYeRG2uT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xsmKEpawc1/ATVjVWrcY3fIyBQF?= =?iso-8859-1?Q?miTMxmSgIdB8LFI6oYBni7Hac79Wyla4Pjm2ICdS2tLi+bZgxCH88qixG7?= =?iso-8859-1?Q?TFe8HD3TP3KWaTtxyBiQH5HZIp8dGizuBgdkX1joO57/f0tsHOG/asfay7?= =?iso-8859-1?Q?SrI9OLLB+vfJEpKXXBzja3wXX8p02aq4zcE24SmTnP/Hz3/EtzRGoD8qx3?= =?iso-8859-1?Q?CXWjyxnjP6nw0zpno6Z9ky1Fq6iVFXvpN2u+MXbp0AMDPx8QT9EMrJU5Xv?= =?iso-8859-1?Q?pY4RSTx3zSJQFaAKYHQgDxRlXT+9oOYVfDl9KrpucNpMaBvUq7RBgyAlqv?= =?iso-8859-1?Q?Mx4vEi5qb2wiyUF2o4mC8ZNGSgbHWvuOji?= Content-Type: multipart/alternative; boundary="_000_SJ0PR11MB5056CE9B5A7677132AA4C3CC83C62SJ0PR11MB5056namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5056.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47a68a25-ea84-47ac-c0d4-08dc8926165d X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2024 08:19:45.6324 (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: RP9vStlsC7kD7yAf71A4tsWieISCZzlp6FIH//PC9RKIS/Z5l/KG/Ok0p1gZmN5Kn3HA/XsFAaLf75r9NCTEQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6991 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_SJ0PR11MB5056CE9B5A7677132AA4C3CC83C62SJ0PR11MB5056namp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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_SJ0PR11MB5056CE9B5A7677132AA4C3CC83C62SJ0PR11MB5056namp_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Recheck-request: iol-unit-amd64-testing


From: Dooley= , 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 <pablo.de.lara.guarc= h@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_SJ0PR11MB5056CE9B5A7677132AA4C3CC83C62SJ0PR11MB5056namp_--