From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.64807.1674698520570367612 for ; Wed, 25 Jan 2023 18:02:00 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=WoWEoVRj; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674698520; x=1706234520; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=bVenrM+qH6sr15MY54djIkjW2tALptMQsTXpHOp3cd0=; b=WoWEoVRjkDDpOyd6YMs4BE3u/7FK8PpGFVeluR0Jkb8zLa/ET3lvPTLn Gy0rjNtl50qVi9Qa2NKrkKqUM0q1ctt3L3cuHO1AlqBKxzlTm53EHBo0V yJwxmlUcqVWO0K6kXzYfJnUsjhCFcORucX/VmeYTlKSNynReUnScRROO4 kFvmOQsavSKerKL4GuC4QxTiaLpBHKenewfGas3PuhgH6ZQZ1T2cTEiTc rrCVND9GQ267jijtCF1pTfsJOH9hcIc9nepLTSc4MMsdafBJp74v5xZYT 6tGPgmpN76QYSiKuatWyVJ60XzOsZvDjElIiS2A6b/ey0zLsm0wRKIk1r Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="327982967" X-IronPort-AV: E=Sophos;i="5.97,247,1669104000"; d="scan'208";a="327982967" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2023 18:01:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="656018624" X-IronPort-AV: E=Sophos;i="5.97,247,1669104000"; d="scan'208";a="656018624" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga007.jf.intel.com with ESMTP; 25 Jan 2023 18:01:59 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 25 Jan 2023 18:01:59 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) 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.16; Wed, 25 Jan 2023 18:01:58 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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.16 via Frontend Transport; Wed, 25 Jan 2023 18:01:58 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) 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.16; Wed, 25 Jan 2023 18:01:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ecouW6D4o+IclrebaX6zG0bi9ryjmHEgDuKnc++fhaXjur+KUElXW7ecALSQm9EgVYyreuSxsvFbh+7Ky/OGM66RIoKzmfBcS+/hLCZxdpbJO3iXDRMnh0oqMRqLdrCb9+Yd5rUNognh6R3UfOIO+lHoLhvEeOFQwyfYMbQHIJPhxe+vJMkPp5wPTsBM5AQOLOd64DMyVE+gH6BIouLZnAerQpG0yAJI9g1Z4zh9oe1jOX+gqp3762f7R8OoVzsCu+EltoJ2gs9VYTrJmk9IUlxphw84GzKQKHk64cUpqJhJtQFhKsRETdyDdKhIozl8PYdBn9F3PLlaQd8Vr5nbPg== 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=bjZrPJuNVY9gbm9uDEq7gL7YZ6qm3cujYrGwJPZ/52c=; b=oFnHdPXs/AS2jZFdQhgFnLIC5r0n8ALL/cGZiRJVSSLJ0A73my78Y3x4VaSSozzHU7i2R56f7Ib02F5lh/UH/9b4X+ocNZLvlPDMlAnN33Z9lBuYjkN0bZLiF4gLdX/sHD71j17m5vSm5kr9dN3LIC3q35O9SIAR19jDYq+5iQ9VdVktYKwZauBZTeprrV6n49Pq2uXr6i2Ojm2gN4N/CrikFWiE0Y3vrBBE76E61RhipHq0lcpAgau3MW1P0r3z4MbYmvXXYljWyhUaqrV000rNOJRRRiyenijgtH40kDVywso+HN7184GUFQAJbega5HiM20KSRZGqp26d1jVs1w== 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 MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by SJ0PR11MB6622.namprd11.prod.outlook.com (2603:10b6:a03:478::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.21; Thu, 26 Jan 2023 02:01:54 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::5f56:1bdc:2eae:c041]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::5f56:1bdc:2eae:c041%9]) with mapi id 15.20.6002.033; Thu, 26 Jan 2023 02:01:54 +0000 From: "Yao, Jiewen" To: "Xu, Min M" , "devel@edk2.groups.io" , "kraxel@redhat.com" CC: "Aktas, Erdem" , James Bottomley , Tom Lendacky , Michael Roth Subject: Re: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add SecTdxHelperLib Thread-Topic: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add SecTdxHelperLib Thread-Index: AQHZMGQ1r94328w4PkiwLga9r2mjjq6vDOKAgADlMgCAAACEIA== Date: Thu, 26 Jan 2023 02:01:53 +0000 Message-ID: References: <20230125022359.1645-1-min.m.xu@intel.com> <20230125022359.1645-4-min.m.xu@intel.com> <20230125121621.6bv7zdwt7qdahz27@sirius.home.kraxel.org> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: MW4PR11MB5872:EE_|SJ0PR11MB6622:EE_ x-ms-office365-filtering-correlation-id: 0041d72f-d857-482e-8ffa-08daff414be1 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZwzVPwN/Dy6ieeiBn6rGT/X0HHbNqKsvn/brgWqEpsAbEwDDjG85p2tloiUp/unFjeAeykhGKkXKj8eNVjcpD8BXPPCqmw/Q8WthIhZXIfl8d06bKNwD6S4Bynap1JfIOTKrY6FkF1L0pSYm3VkpPjG1KO9FhXCSKTyB5aHY256Jx9k/r4a3+azrbwngcJwQgTY5wyZuXv/bPFNcxbFyDaZ1y0SH5kDlHd0i0DSb4CZPLew3eet+NS7SsRtYULQdpKqnmxDBuVSPRkKmDG/gxzC3aAzj88/RgHaGNH70/4EO9DcUebM5ibeubAN4RqlgOajuycKm9e7LQTdYPfVkAJlJLzJg8VX9mBhA5l2ad9l8xRycTLTHFUZg4ujkwSa/HvGVlZcfrzkKR3JURHcDiTqBBAJUnYf7GwYrOMET8kgg7RTJIsZHMkZsonHM6yt9hvDr7KIn2R7WjjdfdsC4OzJ1n799rirHK9iL4lgMadl3UNj3HGoF6TMCoWp5sjTGaWC/RfeT7dUWJeIkup/v2cdbkGri0u0qPA1sBMFNfUxxCOMycDRZj4vkJ2t3UgS/tkvzirVWugb9qa3JAT1A3SzBkAdfXCZX0f/uyK2LIdYmj0u2g9EQ/edTTwEaSQFrODKWDTFe/B6o8hDreVAUOiMeiZFwKk6qinixJotlM5a3e0ACGLJvb0JWY/Fj8/lwLAS5pB+6WknXr3DXnFlvlMruDvHlQPbJoL3oi40cQ10= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(39860400002)(346002)(396003)(376002)(366004)(136003)(451199018)(5660300002)(64756008)(66446008)(186003)(2906002)(66556008)(8936002)(76116006)(8676002)(4326008)(66946007)(52536014)(66476007)(41300700001)(83380400001)(966005)(478600001)(71200400001)(7696005)(26005)(6506007)(53546011)(9686003)(316002)(38100700002)(122000001)(110136005)(82960400001)(54906003)(38070700005)(55016003)(86362001)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nfCCC7bjxSH0w2oQq0rShwIg8HKILHeX7aMQPtN1MC3Xu3dBvMV/XFYLuVle?= =?us-ascii?Q?ddiZpHlWRjJJdQ7qfKo/X9fLJaTiifLzCj5alo8VubE9lIfc8wPZrQsUUsTc?= =?us-ascii?Q?6sAooA28u6GPtU3zZLw/Qacc4KKVgjIqh8LdAUv2rUS6RPCpiZ7Ru6AFlWB+?= =?us-ascii?Q?I/JZupEryd1ndrMQZADSVDIUFk+XFlblCuSfFyYtcOKAqjmswNYrAdvYNEug?= =?us-ascii?Q?6+Nu3g2px6Dqw2A0BA6PclS5cusmb1vsLASgv/FdRAMOONSSGKDK2d2cXsvt?= =?us-ascii?Q?BSXqpNy1fUE+9y2UxdfAfgHQwf8IQD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cGxyKI2HcdHXGWjdDnJ+PEJhSPxpXk88E5A5zYjFxIF4c6/rgr?= =?us-ascii?Q?EE4Et3AS8CWTE6dLEPCkQj1Ay9J44FgCNMy1t+E6kAP8aGav7W8LefaEYP16?= =?us-ascii?Q?MhOs135y6ZU43PPQInzPUYmMCbJmssFhuvZ+Cjj3fK69pL/XKd24vuytsGcI?= =?us-ascii?Q?q+Kx7eaqtxkKHg+flBDJbFh6/FSL7flSOmxAhulFxdlgE5YlZ3DXoHOxSY1k?= =?us-ascii?Q?VHwHbK1Z3zBUPdFUqL8QliyvLKVQOlXhaPp+L8/CnE7hk/EvmKEOcvzJBAqh?= =?us-ascii?Q?WpRZT+h4VeGFxh9PWaUwmnmfrFXL5WEuqWW/DVFDUMGnk06bDt4EI+q7tsgs?= =?us-ascii?Q?uXosPUJCzn7GLWEEWcny7P3hZ16bEzaGBRYDT08H?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0041d72f-d857-482e-8ffa-08daff414be1 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2023 02:01:53.6908 (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: LJjgTLVg+JTsOoz0h+Ag1Bbp8wJJ1WSiWdhN4VGqkpgGkwSJvYrcTXXjdZB8fQVjBtTDSUcXupDbC0DVFTL74w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6622 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hey I don't think it is a good idea to define a context size here, because that= will assume the openssl implementation. Please don't do that. Could you please just use Sha384HashAll() API, if you don't like to allocat= e memory? Thank you Yao, Jiewen > -----Original Message----- > From: Xu, Min M > Sent: Thursday, January 26, 2023 9:57 AM > To: devel@edk2.groups.io; kraxel@redhat.com > Cc: Aktas, Erdem ; James Bottomley > ; Yao, Jiewen ; Tom Lendacky > ; Michael Roth > Subject: RE: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add > SecTdxHelperLib >=20 > On January 25, 2023 8:16 PM, Gerd Hoffmann wrote: > > > +// > > > +// SHA512_CTX is defined in and its size is 216 byte= s. > > > +// It can be built successfully with GCC5 compiler but failed with V= S2019. > > > +// The error code showed in VS2019 is that "openssl/sha.h" cannot be > found. > > > +// To overcome this error SHA512_CTX_SIZE is defined. > > > +// > > > +#define SHA512_CTX_SIZ 216 > > > > There is Sha384GetContextSize() > > > HashAndExtendToRtmr is designed to be run in very early stage and at that= stage > Memory allocation service is not ready. So we have to declare an array wi= th size > of SHA512_CTX_SIZE(216). >=20 > Variable-length automatic arrays are allowed in C99. > https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html So if ovmf is bui= lt with > GCC, then the code below works: > UINT8 Sha384Ctx[Sha384GetContextSize ()]; >=20 > But unfortunately it is not supported in VS series. (I test it with VS201= 7) > Building ... > tdvf2\EmbeddedPkg\Library\PrePiMemoryAllocationLib\PrePiMemoryAllocation > Lib.inf [X64] > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2057: > expected constant expression > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2466: > cannot allocate an array of constant size 0 > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2133: > 'Sha384Ctx': unknown size >=20 > So Sha384GetContextSize() cannot be used here. >=20 > Thanks > Min