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 CCF5FA0555; Thu, 26 May 2022 10:42:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B166440E64; Thu, 26 May 2022 10:42:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 1CFA440DF7 for ; Thu, 26 May 2022 10:42:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653554531; x=1685090531; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=44SXyknKBs1qW+R5Xb+C405Bxt/xRr26J7YDULy9zSc=; b=Iy4PENimhd6Bp8SbBiYNFY+Qy7e9ViWkPTwdo3xv9hwfknSaQUeNC8dW PM9N6ULPf2BoXAsywSYZOoxuxpnkItmMZBlwbDxU6Fm/Ajk0Sv88LCIOr Na2ZwyLinyUmvIos7/+C3JoA8VTCan59hE5ieYnEn7//imNFxq78ORvVa QMiaG2Nte10s4lzHZw9r6Lq61fq6nhLAZ8aaUfBSi5DTG9w/YhXMC109J 2p4gLfe6xTGSXBQK2P8pyZm+M2JOwMBhjuzMz/w9z/1mHP378xzb9B7vx sdCEWDZmfoCtMqW4r0FKzEZUmeFxldrDYD0daovkwwjpG8ur5YluHZDo/ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10358"; a="299422473" X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="299422473" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2022 01:42:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,252,1647327600"; d="scan'208";a="549465496" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga006.jf.intel.com with ESMTP; 26 May 2022 01:42:09 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 26 May 2022 01:42:09 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 26 May 2022 01:42:09 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 26 May 2022 01:42:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bgw9QEY3hObS9ig5Ueq4M15opZ7WnEl74d4OUkgUM3iPLEGn+LfcgsoiCdIkfjiESONaVu/6MuTAeR5nXPAIKX2KHl6b/lf76yvV387qObuiFzxkEI+ntlplQ6tdLOAWkrCS7TjqLMAzJWzjsr8HGeYWFEAGKS4h6w48yJvJFo4bDfgUR9U2C90y95Fv083k+mskN4PpHcUBczejdXjNKXL0kD8CouIPyGumLNFBlFT3Bjp6Lh0GLnqIhF9+Lfkfs45XdG3ieP1M3y4opsDLxNKVF7dKS1CaJIsZh14PHI6+2yWRyT5cFoqr+FWPBo+DXf2MjuCOBHTAWSPZahepnA== 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=gV8xHGC7fbwfQLhhkA18KplTgW5AACwGZ6xvPPAQbP8=; b=iIWxQNkQj8fCLk+wfGH2FI3TJRoFo/tBFeSDYpLqgF262R/K6uUW7c7HmjZRkZV/uwAlXcXf7vFsdZlx/uswJPyVVrUbvaGEbSB8TWfEk44HXbiyu5kR5VhIBSEVYTpT1FkaVUH1HDNFg3e/69Gp9rhDtOfF4PJ8eoAFLnymfp/qGAs38c15cqP+7E9OC0AlRA8OFX0acLKlcXxrX4zxO3pVB7ACTCrFm8/sC1407zJdZFVlwKBtune7Us7sQzwjVN7eztG8XWGYSYGu0o7Yk7ySkVofnbXT/MsFBQYBiG/W1sEs97LTv+t8+qVl5+SAA6XNTTtp/psJiNw42VyCxg== 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 MW5PR11MB5809.namprd11.prod.outlook.com (2603:10b6:303:197::6) by PH0PR11MB4981.namprd11.prod.outlook.com (2603:10b6:510:39::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Thu, 26 May 2022 08:42:07 +0000 Received: from MW5PR11MB5809.namprd11.prod.outlook.com ([fe80::b9ba:9827:9cbd:9f37]) by MW5PR11MB5809.namprd11.prod.outlook.com ([fe80::b9ba:9827:9cbd:9f37%5]) with mapi id 15.20.5273.021; Thu, 26 May 2022 08:42:07 +0000 From: "Zhang, Roy Fan" To: "Ji, Kai" , "dev@dpdk.org" CC: "Richardson, Bruce" , "gakhil@marvell.com" Subject: RE: [dpdk-dev v3] crypto/qat: use intel-ipsec-mb for partial hash & aes Thread-Topic: [dpdk-dev v3] crypto/qat: use intel-ipsec-mb for partial hash & aes Thread-Index: AQHYcFfbrz+m/XwafkStQhY67K1fNq0w13ow Date: Thu, 26 May 2022 08:42:06 +0000 Message-ID: References: <20220525165218.10926-1-kai.ji@intel.com> In-Reply-To: <20220525165218.10926-1-kai.ji@intel.com> Accept-Language: zh-Hans-HK, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 77547074-9fd5-4a32-b964-08da3ef39dbd x-ms-traffictypediagnostic: PH0PR11MB4981:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UdrEYNga4SHK9ii6Aqa7GX5YM382rf9oZFbY+dTAomjs3R8ar3rwJnYa//7bAdrOVhBmbEvqIM9xjT/7+iof1heVZN9LONRfn0MRO8xJHlOOWEMvsXPeZxoDHgMQK3aqkI9On6vWYH4Yn8aILQLOTRKEqNbwdVzChFjSB99lLfh6uQ20H2BFL7Luhv3JO34aN3u0DvAhEVVKbS59LSWsHwo3XpCfvkVeXxya/pGfr1UEcUC95n04xrHKzc8Oa2RzhjTQXqMmWsyRU1zVNY7qc0J296/y5fmhk1pksjf7aHrHFM7QeQpP25mFdAZhY6+IihtjdRdwmcxEbsg/+3byITTbBcCJGCGO16B0KUXProxHrGxOwkFZFAcsVT6SPwMqRtmZs/daloVVOrg4PE43+zv2j6O2JMoapbMQbs1YkQiZO8cv1lmYFkfZbJO3qoQaSr+5X1/0RKr3Qin8tPVm5iPvy4ZDC3Er19qmGdBralVr8l5g/GDwis5kEViU6c/LUU8RgNgfzOBvjSlFxs3f1GzJ19+h7qgiHQtig6xX1vD7r5pvmRlD8Ss00w/oEqQ37HYyeOYk/mESw10Er0TOAeXFisL7nRJ4DPtjknvXc1xbCJMl8k59LYfzkBXv4tipmvnffWqdv9qLlTVB1mhPRkaEqv9pPy0DxcwBOqGncGr8wcBTZvE77nmcpnylmKfPjZvAFyy12ifCGjNiTZfRjQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW5PR11MB5809.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66946007)(55016003)(8936002)(26005)(86362001)(82960400001)(9686003)(52536014)(76116006)(38070700005)(71200400001)(64756008)(66446008)(66476007)(66556008)(4326008)(5660300002)(2906002)(53546011)(83380400001)(186003)(54906003)(316002)(38100700002)(7696005)(8676002)(110136005)(508600001)(6506007)(122000001)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?YLj6IZXEdCbvukUZZuM4gV1yxHOg9/qSY3kx/Fk3mTyfZCC4rYxLRCxE?= =?Windows-1252?Q?MI7PiF7DysKjlOEw8F0/JdaGMGqKXozg1LOtdEmtikjQQZLLKapAXerP?= =?Windows-1252?Q?WJfHDj6NspONYOLgHcU/nwdhTDA+6f4k9O0OLCru333Z7KSdC6SCb/m4?= =?Windows-1252?Q?NPSaBBeyol4ZY3E/ikxCL4QkkQDbxvWYSP28tOIWtHB8Mxjp9eH0C/75?= =?Windows-1252?Q?g92PU+OXb3q9GArGNthj0pOfzZEfeuAjuIB1KfiEriFYDDM7I1stqpai?= =?Windows-1252?Q?DqzZoKMifUVjzlsdGVLQNXYP/BHUo8ej2tsUB/MSCOa8BK49OIAL/on9?= =?Windows-1252?Q?wlmCDxV70LNDpGxXIXvXEf1qSMQV1p3B/aV+4tI9uP37mR+A5nemdnZV?= =?Windows-1252?Q?2RkFrtA33rw/xiiqnrHtvJkhsDqfPEKQ8iUawsgwvyco/wffCO6jZpB3?= =?Windows-1252?Q?SIYqPMVhFXaEM4F2EGq8O/m8wu60mDHuw4HWh97+vdTHj6kadvQFV9+X?= =?Windows-1252?Q?ocfuPaq4rqXcLtcaWzHze+okxZu43is26Zl+2buwpmNJrJW3ELpgIedV?= =?Windows-1252?Q?IpzvG8O7L2QkhcVH3ALUDaJTTk45FHI69w9OlaFdF6fuCmQ9uvzbLlGS?= =?Windows-1252?Q?AEg87HB5lalQ9lYXpTm7gePFvrHUQ3d9eK3vKxjAbLYnBTc6a0lSp83O?= =?Windows-1252?Q?6EPSSgcDv5tLTovHBG9uytofEHrywKX5dNerrBN9oF5kXf+71/AzIBvc?= =?Windows-1252?Q?iYzOgl9bJ+LrZ11j4vg7NxHCY4QPvSiZX5CSRHRdrffxGSvLgkWtwGFj?= =?Windows-1252?Q?uNMMOWYWRxt7bgkFRbtqoEQXylBJKxfQacNOHr2p9xfRUdvFrMic+Dxw?= =?Windows-1252?Q?YBFkpV3BSesXGronJ/KVlkpB+Yl5u4OKsqljTt2M6y8UT+m7NTkQ778m?= =?Windows-1252?Q?hJAhwwCzRhgIj1r4TqQw1B/XJzKyuVWVuYCAzGLeDaDyFFWVXmBImEni?= =?Windows-1252?Q?EKdZGSsH36022fDrDMqyXGvL9T+EQpKPo/qgJogwoxSkKDfJltssC/Hx?= =?Windows-1252?Q?1BRSZP6OBVZfaZyaH6nYk4YW3XJVNEtMESJwQi4s1I6pZ2IvD6ab0V+t?= =?Windows-1252?Q?oWUZ5azD+3XuqMf117Gtlcw3bR75km5FCY2mSw5uTtx52debQQmvFrNg?= =?Windows-1252?Q?ESdL62wqitFZmyLlNr1va4qiv5DxfZyYo10cW/W6ig6+zOLI3Awzs0OG?= =?Windows-1252?Q?4E5ud2/C+eBlaD/+ytyg/jkfagciTmUT3aEtmS2CmESUOK8YftuckGi4?= =?Windows-1252?Q?G7ugZCbrTa6DtLgpDWJg6AkcHv9yS/hkk4t6tTW5xncvQlaCLumTe3+n?= =?Windows-1252?Q?nPLeaXtsV9I7hpQ2kCisNHN2Z3xnreGzPrNhdA6MG0ld3d9vy1Aln9xm?= =?Windows-1252?Q?N8FSTViMaigYs6qE5aFWWZXldgHmDD3QG50UyP7R5N7Xxa4gdSNu2M1G?= =?Windows-1252?Q?rhhYpYRmVGe0Xw8HHZZs9ZSd272/3LENo+gbUac8qTpIuBFFheWYkGn6?= =?Windows-1252?Q?ry/a2EndSKF8q+7Sqgll1R6HGegSBtuz+PKnFdFMZk4s36uSFb8rR30D?= =?Windows-1252?Q?o1EfDtjvUvTDcW4H+46FAz8/xel3k5Dvxzl511zKLz424fZN31wAmsmA?= =?Windows-1252?Q?KPdTWG1dn8+yhxgLOGx36EXQ59NL+5lp+eyfzbSyeYDQZibPyPWtyEz/?= =?Windows-1252?Q?S80b4py0zJMEc1YHjbWXI8EsB7AsRhnXVqQJeTgirfLIm1hI+MU4km+G?= =?Windows-1252?Q?Er4s7W8TRLQT/0tpMS/C//FETiLuSdqojuxTyd3DjzP42HqW6ybkjwdg?= =?Windows-1252?Q?Wl4j5P0xSPoJzA=3D=3D?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5809.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77547074-9fd5-4a32-b964-08da3ef39dbd X-MS-Exchange-CrossTenant-originalarrivaltime: 26 May 2022 08:42:07.0153 (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: aajbuIVS0sEG3miZzev6DWKq3wOZ1Nlux7neYZdTk73z4oCsRFz/LNbf6rd0JBe6kIO6K6tr7dO9h3l5DB6ERg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4981 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 Hi Kai, > -----Original Message----- > From: Ji, Kai > Sent: Wednesday, May 25, 2022 5:52 PM > To: dev@dpdk.org > Cc: Zhang, Roy Fan ; Richardson, Bruce > ; gakhil@marvell.com; Ji, Kai > Subject: [dpdk-dev v3] crypto/qat: use intel-ipsec-mb for partial hash & = aes >=20 > Since openssl 3.0 now deprecates the low level API QAT required to > perform partial hash & aes operation when creating the session. This > patch add in qat_ipsec_mb_lib driver parameter to allow QAT PMD to > switch APIs between openssl and intel ipsec-mb library. >=20 > Signed-off-by: Kai Ji > Signed-off-by: Fan Zhang > --- > +static int qat_sym_do_precomputes_ipsec_mb(enum > icp_qat_hw_auth_algo hash_alg, > + const uint8_t *auth_key, > + uint16_t auth_keylen, > + uint8_t *p_state_buf, > + uint16_t *p_state_len, > + uint8_t aes_cmac) > +{ > + int block_size; > + uint8_t > ipad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; > + uint8_t > opad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; > + int i; > + > + IMB_MGR *m; > + m =3D alloc_mb_mgr(0); > + if (m =3D=3D NULL) > + return -ENOMEM; > + > + init_mb_mgr_auto(m, NULL); > + > + if (hash_alg =3D=3D ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC) { > + > + /* CMAC */ > + if (aes_cmac) { > + uint8_t *in =3D NULL; > + uint8_t k0[ICP_QAT_HW_AES_128_KEY_SZ]; > + uint8_t *k1, *k2; > + > + auth_keylen =3D ICP_QAT_HW_AES_128_KEY_SZ; > + > + in =3D rte_zmalloc("AES CMAC K1", > + ICP_QAT_HW_AES_128_KEY_SZ, 16); > + > + if (in =3D=3D NULL) { > + QAT_LOG(ERR, "Failed to alloc memory"); > + return -ENOMEM; > + } > + > + rte_memcpy(in, AES_CMAC_SEED, > + ICP_QAT_HW_AES_128_KEY_SZ); > + rte_memcpy(p_state_buf, auth_key, auth_keylen); > + > + DECLARE_ALIGNED(uint32_t expkey[4*15], 16); > + DECLARE_ALIGNED(uint32_t dust[4*15], 16); > + IMB_AES_KEYEXP_128(m, p_state_buf, expkey, > dust); > + k1 =3D p_state_buf + > ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ; > + k2 =3D k1 + ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ; > + > + IMB_AES_CMAC_SUBKEY_GEN_128(m, expkey, k1, > k2); > + memset(k0, 0, ICP_QAT_HW_AES_128_KEY_SZ); > + *p_state_len =3D > ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ; > + rte_free(in); > + free_mb_mgr(m); > + return 0; > + } > + > + static uint8_t qat_aes_xcbc_key_seed[ > + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ] > =3D { > + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, > + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, > + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, > + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, > + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, > + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, > + }; > + > + uint8_t *in =3D NULL; > + uint8_t *out =3D p_state_buf; > + int x; > + > + in =3D rte_zmalloc("working mem for key", > + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ, > 16); > + if (in =3D=3D NULL) { > + QAT_LOG(ERR, "Failed to alloc memory"); > + return -ENOMEM; > + } > + > + rte_memcpy(in, qat_aes_xcbc_key_seed, > + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); > + for (x =3D 0; x < HASH_XCBC_PRECOMP_KEY_NUM; x++) { > + if (aes_ipsecmb_job(in, out, m, auth_key, > auth_keylen)) { > + rte_free(in - > + (x * > ICP_QAT_HW_AES_XCBC_MAC_KEY_SZ)); > + memset(out - > + (x * > ICP_QAT_HW_AES_XCBC_MAC_KEY_SZ), > + 0, > ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); > + return -EFAULT; > + } > + > + in +=3D ICP_QAT_HW_AES_XCBC_MAC_KEY_SZ; > + out +=3D ICP_QAT_HW_AES_XCBC_MAC_KEY_SZ; > + } > + *p_state_len =3D ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ; > + rte_free(in - x*ICP_QAT_HW_AES_XCBC_MAC_KEY_SZ); > + free_mb_mgr(m); > + return 0; > + > + } else if ((hash_alg =3D=3D ICP_QAT_HW_AUTH_ALGO_GALOIS_128) || > + (hash_alg =3D=3D ICP_QAT_HW_AUTH_ALGO_GALOIS_64)) { > + uint8_t *in =3D NULL; > + uint8_t *out =3D p_state_buf; > + > + memset(p_state_buf, 0, ICP_QAT_HW_GALOIS_H_SZ + > + ICP_QAT_HW_GALOIS_LEN_A_SZ + > + ICP_QAT_HW_GALOIS_E_CTR0_SZ); > + in =3D rte_zmalloc("working mem for key", > + ICP_QAT_HW_GALOIS_H_SZ, 16); > + if (in =3D=3D NULL) { > + QAT_LOG(ERR, "Failed to alloc memory"); > + return -ENOMEM; > + } > + > + memset(in, 0, ICP_QAT_HW_GALOIS_H_SZ); > + if (aes_ipsecmb_job(in, out, m, auth_key, auth_keylen)) > + return -EFAULT; > + > + *p_state_len =3D ICP_QAT_HW_GALOIS_H_SZ + > + ICP_QAT_HW_GALOIS_LEN_A_SZ + > + ICP_QAT_HW_GALOIS_E_CTR0_SZ; > + rte_free(in); > + free_mb_mgr(m); > + return 0; > + } > + >From this point on, mb_mgr is not freed either error happens or the functio= n exists Normally. =20 > + block_size =3D qat_hash_get_block_size(hash_alg); > + if (block_size < 0) > + return block_size; > + /* init ipad and opad from key and xor with fixed values */ > + memset(ipad, 0, block_size); > + memset(opad, 0, block_size); > + > + if (auth_keylen > (unsigned int)block_size) { > + QAT_LOG(ERR, "invalid keylen %u", auth_keylen); > + return -EFAULT; > + } > + rte_memcpy(ipad, auth_key, auth_keylen); > + rte_memcpy(opad, auth_key, auth_keylen); > + > + for (i =3D 0; i < block_size; i++) { > + uint8_t *ipad_ptr =3D ipad + i; > + uint8_t *opad_ptr =3D opad + i; > + *ipad_ptr ^=3D HMAC_IPAD_VALUE; > + *opad_ptr ^=3D HMAC_OPAD_VALUE; > + } > + > + /* do partial hash of ipad and copy to state1 */ > + if (partial_hash_compute_ipsec_mb(hash_alg, ipad, p_state_buf)) { > + memset(ipad, 0, block_size); > + memset(opad, 0, block_size); > + QAT_LOG(ERR, "ipad precompute failed"); > + return -EFAULT; > + } > + > + /* > + * State len is a multiple of 8, so may be larger than the digest. > + * Put the partial hash of opad state_len bytes after state1 > + */ > + *p_state_len =3D qat_hash_get_state1_size(hash_alg); > + if (partial_hash_compute_ipsec_mb(hash_alg, opad, p_state_buf + > *p_state_len)) { > + memset(ipad, 0, block_size); > + memset(opad, 0, block_size); > + QAT_LOG(ERR, "opad precompute failed"); > + return -EFAULT; > + } > + > + /* don't leave data lying around */ > + memset(ipad, 0, block_size); > + memset(opad, 0, block_size); > + return 0; > +}