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 EC35343C4B; Tue, 5 Mar 2024 16:16:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 947F4410E7; Tue, 5 Mar 2024 16:16:41 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by mails.dpdk.org (Postfix) with ESMTP id 67A04402AF for ; Tue, 5 Mar 2024 16:16:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QxqDC7Gy7kmVA/9T6USfSrPcfudWiJy6UOc2whvkvuRIUVoU8TeWqdIUa4tf10XHOyBk7LxDwBP/0L/1v3IPlNxDHFG+QFKNuqAfAMg4Lg+TUL4UfB5SrZ1GtP5yjG9S9WG5V4vU46ehHbNZe0K8XZgbNAZ0RNUVYDGzEd2wcOqKbYS3MhOjmFDpQDUbdf/0Ux+j0r599n2I/KWB8Lhul+ehXs4I34wZCX8QZexwJ8tyx8ZcjeaooOyf7erDUURjEYv/nGTPhNzfX1VDUZDS6yYFXyoWQRpqKag/Z7IPGWgshMvRYPuMrIbmGATPt1tnQubLd4ku+SsUwXIJ2dMXdQ== 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=YN/sp9LNfZ2Q2RDs3qBvSSzhZEvoY92Wr+xP0PUW5/Y=; b=jkPogIOQwv53XyD5tKkTlXWiKVBGwaC7VjJ4LiXP/vqPki+Sbm6pcf5cenm2CZ2pslMeD1OkE9jxuNTRgR86FmH9wkzgaVocIdTUZ8HP+YW39B4vgltvl17XDDtRTLTPSQTEWf1OnS+A9RBAeVxipIbZ8Mkgy+y/OuoOupvcXH4+KiA5rb3kYbwiZk80lqYouJjLybnoV3wSMFVFPpZRu+dFa2mQrDNKzcCw+WsNxLkstxzkL5Prs5qO4cGhBr2c3/2ya9Ppq3iv5K50ecpTARoBwpT32vLJghKhw0tggwiza7Kk4lyMCgdpQ6E14r2b62VI7esxWrQrfE+w1Btz2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YN/sp9LNfZ2Q2RDs3qBvSSzhZEvoY92Wr+xP0PUW5/Y=; b=BzjvqUcPtvXBfksm6MB4A19R7DwfIAvJwIqfyelTy33nEMVhyL//g2aHAxk3LOJvsZSH9f5fGtxzOHTEICCUjvr6xuS2WYG4FzHeu2Y0htUm5UVgivTdBzTjlaoB+HPg77GgRpd6+bk0vo42OyElvZHQyHn6Sdzm3b3Cq7Ob7eA= Received: from AM0PR08MB5073.eurprd08.prod.outlook.com (2603:10a6:208:15c::27) by DB9PR08MB6377.eurprd08.prod.outlook.com (2603:10a6:10:259::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 15:16:36 +0000 Received: from AM0PR08MB5073.eurprd08.prod.outlook.com ([fe80::ae6d:f7e2:32d4:dd6a]) by AM0PR08MB5073.eurprd08.prod.outlook.com ([fe80::ae6d:f7e2:32d4:dd6a%5]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 15:16:36 +0000 From: Wathsala Wathawana Vithanage To: Brian Dooley , Kai Ji , Pablo de Lara CC: "dev@dpdk.org" , "gakhil@marvell.com" , Ciara Power , nd , nd Subject: RE: [PATCH v2] crypto/ipsec_mb: use new ipad/opad calculation API Thread-Topic: [PATCH v2] crypto/ipsec_mb: use new ipad/opad calculation API Thread-Index: AQHaXR4LTF/GFruWSUGvVQnAB9J+UrEpZXYQ Date: Tue, 5 Mar 2024 15:16:36 +0000 Message-ID: References: <20231214164135.2193863-1-brian.dooley@intel.com> <20240211191038.863120-1-brian.dooley@intel.com> In-Reply-To: <20240211191038.863120-1-brian.dooley@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: F8A6B5A974B0D945AAB1E0391A9462BE.0 x-checkrecipientchecked: true authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM0PR08MB5073:EE_|DB9PR08MB6377:EE_ x-ms-office365-filtering-correlation-id: d2490255-c8b8-4ff6-15a6-08dc3d273fd5 nodisclaimer: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Xv+PtoxFKVLYC5h/9gygzfExbuSw71sjAwfv56+QNk7PmRIzyG3IdBxFNP6FoiabRJTtAHY73kdxhONr3rvN/ilxRmF4fJ2SttuZAyJ+hgFpu7itpGK8MbNDI8p9kF2RBTqFtaBXNLvr7/24kZfVHzvmTrG/4i42ula525VwEK6ec9Pa6b2ELPZksb0Rjjw2Q8i8vP+vdyg8iyJpGKGPDCUCo5OdkzbNgpICy5mAONOUYzGoygus53jQPi/0UhVHmifAJ0aTCA7x2tsQqmlZp3aji78Tg9I455nJo7MwCA5Tdg4vP78I7LEcDgkRCQmQEk+5/wKsXaFppb4FRCp2mAXCQU/eGp3TIwQ7wL1GWNIsZ/sxVs8IkkaLSoEUMry/sPJKR6NFchWBeZoYAwJluvfOOkaVN+TXfqg6EDsdXtNwqUmVsG7r9KNzJBrANv2KCeL28Ic1m5aGBB3sDIqe18cgF9guZAwpHGSxcHSoFZ7PMyVPsITcpUM8XeEEHFeCNCi1m9cn7x3cyXBgS17xusTC2A7ZUVfTr6T0RixvcFDXRhrYHECyWup9FcCxBU+5l04bTvNnMeziuT3h5pgu6qPiyZEcNoxgUmzNgX3i9a3JOVS89wzDYu0Rnko6RU9Xj1v4g0G32fSnZJNj590HaWwW4wfsOnhvlqYWmXlVYNkdkfyt3lGMPMBq854t8fYdjKaDtU4utnivcEGAMaT3LSvUbTfX0PVLkjJKyl7Z4ZQ= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR08MB5073.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?X3J0mG1aRz1yb5kw4trjF3iuMApUNVDAdwN9AvtOBfpVvss5qB4GaLN7jeTG?= =?us-ascii?Q?+VC1yv2kLUT3wZdL1DEEyvyKSF5KhO2hvD6IgLmsWr2b6DmI79fP6iaaIfFW?= =?us-ascii?Q?TtYQW+5X7bhCbKvHIYW9kKgeFzlMAfQR36Jd2PPKLKCFi00ljjAcpBKId/KK?= =?us-ascii?Q?4Bopv/5MjYoXJIXIqmsE9ChiXrKMI7LNCfwSykOIHoAEtY5mCsqRffQF6PYi?= =?us-ascii?Q?iiNVX40jiI/AsXseJ9VB2laSzKy0Y1w39zA2RDG0bGnnvBCXCkOKJKQNiHkp?= =?us-ascii?Q?PwJhaFJ7nretdzTgH0kcwDZgloDtwxTToc5SOQP5D8FyFSHormwZgkA8rOO2?= =?us-ascii?Q?Q0HKE0ZaAAPLnhMnO3U7njrDWyqnkcDZwEIBRGDnDQb0djJ2E813Bio6BlLi?= =?us-ascii?Q?GPskZeTlrHmBXaff7xRjTGTDt8l6jgqOsErlKjhv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fLnUpevFG9WkhZbJPQGNj/3eNqBd5tnrosFuL1k52QYDsY?= =?us-ascii?Q?gyIIP5oTqJ21iDAH/cRwt+R0gBwudYwFaazMVNjgQTcpgP7TH4EMlH9QvvzC?= =?us-ascii?Q?vl925DDQZSMzwiJFQLbHES4Y6RxCL5CbFAqMoQ64ksioMqYkHwXnfECbfhiM?= =?us-ascii?Q?aM4CQZKIjWZuPaqpUqn+fLOSxkiTgQx0tpd5K0C0sLv89hOnveXq3hzBh9uU?= =?us-ascii?Q?ki3IGLuVND9XdvtZDgcYRstULLatUm/DdPPQNwCX?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR08MB5073.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2490255-c8b8-4ff6-15a6-08dc3d273fd5 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2024 15:16:36.3342 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: B+m1eDTIbNe4qXOxqUx+hVVnLkzDlqiLFBou5NRehZbq+d+RzmCBQ5kEoUMXjs9uXg8d+MLGDmM/MalPP4GI4+UZlsi7bPB6J1BfnBMK/Dk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6377 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 > Signed-off-by: Pablo de Lara > Signed-off-by: Brian Dooley > Acked-by: Ciara Power Acked-by: Wathsala Vithanage >=20 > Depends-on: series-30989 ("crypto/ipsec_mb: bump minimum IPsec Multi- > buffer version") >=20 > v2: > - Remove ipsec mb version checks > --- > drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 75 ++------------------------ > 1 file changed, 5 insertions(+), 70 deletions(-) >=20 > diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c > b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c > index 4de4866cf3..251e18ec7a 100644 > --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c > +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c > @@ -13,49 +13,6 @@ struct aesni_mb_op_buf_data { > uint32_t offset; > }; >=20 > -/** > - * Calculate the authentication pre-computes > - * > - * @param one_block_hash Function pointer > - * to calculate digest on ipad/opad > - * @param ipad Inner pad output byte array > - * @param opad Outer pad output byte array > - * @param hkey Authentication key > - * @param hkey_len Authentication key length > - * @param blocksize Block size of selected hash algo > - */ > -static void > -calculate_auth_precomputes(hash_one_block_t one_block_hash, > - uint8_t *ipad, uint8_t *opad, > - const uint8_t *hkey, uint16_t hkey_len, > - uint16_t blocksize) > -{ > - uint32_t i, length; > - > - uint8_t ipad_buf[blocksize] __rte_aligned(16); > - uint8_t opad_buf[blocksize] __rte_aligned(16); > - > - /* Setup inner and outer pads */ > - memset(ipad_buf, HMAC_IPAD_VALUE, blocksize); > - memset(opad_buf, HMAC_OPAD_VALUE, blocksize); > - > - /* XOR hash key with inner and outer pads */ > - length =3D hkey_len > blocksize ? blocksize : hkey_len; > - > - for (i =3D 0; i < length; i++) { > - ipad_buf[i] ^=3D hkey[i]; > - opad_buf[i] ^=3D hkey[i]; > - } > - > - /* Compute partial hashes */ > - (*one_block_hash)(ipad_buf, ipad); > - (*one_block_hash)(opad_buf, opad); > - > - /* Clean up stack */ > - memset(ipad_buf, 0, blocksize); > - memset(opad_buf, 0, blocksize); > -} > - > static inline int > is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) { > @@ -66,12 +23,10 @@ is_aead_algo(IMB_HASH_ALG hash_alg, > IMB_CIPHER_MODE cipher_mode) >=20 > /** 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) { > - hash_one_block_t hash_oneblock_fn =3D NULL; > - unsigned int key_larger_block_size =3D 0; > uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] =3D { 0 }; > uint32_t auth_precompute =3D 1; >=20 > @@ -267,18 +222,15 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > switch (xform->auth.algo) { > case RTE_CRYPTO_AUTH_MD5_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_MD5; > - hash_oneblock_fn =3D mb_mgr->md5_one_block; > break; > case RTE_CRYPTO_AUTH_SHA1_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_1; > - hash_oneblock_fn =3D mb_mgr->sha1_one_block; > 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); > - key_larger_block_size =3D 1; > } > break; > case RTE_CRYPTO_AUTH_SHA1: > @@ -287,14 +239,12 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > break; > case RTE_CRYPTO_AUTH_SHA224_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_224; > - hash_oneblock_fn =3D mb_mgr->sha224_one_block; > 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); > - key_larger_block_size =3D 1; > } > break; > case RTE_CRYPTO_AUTH_SHA224: > @@ -303,14 +253,12 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > break; > case RTE_CRYPTO_AUTH_SHA256_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_256; > - hash_oneblock_fn =3D mb_mgr->sha256_one_block; > 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); > - key_larger_block_size =3D 1; > } > break; > case RTE_CRYPTO_AUTH_SHA256: > @@ -319,14 +267,12 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > break; > case RTE_CRYPTO_AUTH_SHA384_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_384; > - hash_oneblock_fn =3D mb_mgr->sha384_one_block; > 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); > - key_larger_block_size =3D 1; > } > break; > case RTE_CRYPTO_AUTH_SHA384: > @@ -335,14 +281,12 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > break; > case RTE_CRYPTO_AUTH_SHA512_HMAC: > sess->template_job.hash_alg =3D IMB_AUTH_HMAC_SHA_512; > - hash_oneblock_fn =3D mb_mgr->sha512_one_block; > 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); > - key_larger_block_size =3D 1; > } > break; > case RTE_CRYPTO_AUTH_SHA512: > @@ -376,19 +320,10 @@ aesni_mb_set_session_auth_parameters(const > IMB_MGR *mb_mgr, > return 0; >=20 > /* Calculate Authentication precomputes */ > - if (key_larger_block_size) { > - calculate_auth_precomputes(hash_oneblock_fn, > - sess->auth.pads.inner, sess->auth.pads.outer, > - hashed_key, > - xform->auth.key.length, > - get_auth_algo_blocksize(sess- > >template_job.hash_alg)); > - } else { > - calculate_auth_precomputes(hash_oneblock_fn, > - sess->auth.pads.inner, sess->auth.pads.outer, > - xform->auth.key.data, > - xform->auth.key.length, > - get_auth_algo_blocksize(sess- > >template_job.hash_alg)); > - } > + imb_hmac_ipad_opad(mb_mgr, sess->template_job.hash_alg, > + xform->auth.key.data, xform->auth.key.length, > + sess->auth.pads.inner, sess->auth.pads.outer); > + > 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