From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.64713.1674698227102846889 for ; Wed, 25 Jan 2023 17:57:07 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=UXlDASl+; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674698227; x=1706234227; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=9oAKTMoeaeJvEa/MSlbaQ571iqvoq7Q/7kzXoRpWREA=; b=UXlDASl+eNMAUAVm/6YnkH0xBpV7ucLB8ZZbHK25BnFhNkFuM7kPlU9d HeP9x5T+qV5WZQOWRdGPrCFVC8k4OXNr73LcM3Y2O8+J/DMEb14cuq3ce 4aRFZJPRo7htN7uJU2El9rm9SOnEBXE3dRUeP8zXi6eaj2aTq8WhwsxVd zLeh6BPl/ovQ5ZN3KsZRNaFUA6SYdvDcM6au34xmJj74wbupjnm35eaoN /Lqs1J9ymELoWctNxwCWF2kbSoVuXS6SZUiismy+IwuG8sgrvZCU4cgBX Q9AgKfAlo87jkplmTNAIZlf82AWe5zDCgS7YZRiWdflp+DLx6+eS+MsJi w==; X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="314634424" X-IronPort-AV: E=Sophos;i="5.97,247,1669104000"; d="scan'208";a="314634424" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2023 17:57:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10601"; a="664677804" X-IronPort-AV: E=Sophos;i="5.97,247,1669104000"; d="scan'208";a="664677804" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga007.fm.intel.com with ESMTP; 25 Jan 2023 17:57:06 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) 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 17:57:05 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 17:57:05 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.16 via Frontend Transport; Wed, 25 Jan 2023 17:57:05 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.45) by edgegateway.intel.com (192.55.55.71) 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 17:57:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/ckEm0wIGw4WJlGyUef1KK8HPT5UGDir1zl77NBS8VvMueJTWLENNntVzApCEK2I+NQWn43loaTTO1OBti6IxoufEv6ZhiKYCzw9/mojmC3iWFPL3Bj6j8flHk3GRDJzibK//E9zE2P7Y4DloiWhwZLYkQ95jsW9oGoIbNoAjZ+Zd506vij3kwMVmesiHnQzLJgIMg09TiefbHo53UlvC8gyMPeM8D4S7RoPr5Z2oK+CxXlX91xsVmPuAQMi83yoViqOjrRhH14ElDdHZv6z+FynvY0WKBuXjYasPxVUCQvxBZoK3etlvRF5U8Yn+V57a+wafq60sDa7yJnxpnXlQ== 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=nO2LiMz+T2/E2uiuRhssWGgKds4owVpa7uurA24cHc8=; b=aBmCCSDCYdnZZ1aUG2u+ABFLN/zJzoN3NvZLcOn77xYCse0OSl92rqRee7k6IydRx0jnZj2Z3n4PZjwFCxUMK2NsxynSgrnd8NaNjDbtXwKgrggPB+JPuWxrh/5DB+4taO+HVv5MyZUElA+0eP73J6XWdEPUrl3/iMswm55S3xVMu8zAjwQOY/R2MGVSTGes3+ThEMcMmbE9isrj0cUjdpKgQvp3xUTIsXkNp03QgnSWlN9v/LU2TM2Ul0pKll7HVc9dhwgEifOrNkNSt1BJXvJizoZtGgYRdFuYxfUdi4erNgIf7EQz81WfqQRvApN4c3tyeroXPrdeeFvQvxBtXA== 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 PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by DS7PR11MB7740.namprd11.prod.outlook.com (2603:10b6:8:e0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Thu, 26 Jan 2023 01:56:40 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::d87:9f99:2db2:43d1]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::d87:9f99:2db2:43d1%8]) with mapi id 15.20.6043.022; Thu, 26 Jan 2023 01:56:40 +0000 From: "Min Xu" 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 Thread-Topic: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add SecTdxHelperLib Thread-Index: AQHZMGQ1Vxa9iGrGzE6/IgxvTCOmbK6vDOKAgADRFWA= Date: Thu, 26 Jan 2023 01:56:40 +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: <20230125121621.6bv7zdwt7qdahz27@sirius.home.kraxel.org> 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: PH0PR11MB5064:EE_|DS7PR11MB7740:EE_ x-ms-office365-filtering-correlation-id: cb178358-864b-40bd-b225-08daff4090ee 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: xFZQSX9S8dayrEIzXm5VMWh1Dt6XpCXdIAdQwjZQifhddRLdhJLoATU3LEssHDegSg+dBXpwnNfu+PL2s+mTaxoNJ5EUJB8frIPIz8xVvU5eYDam0ys44RwEv0isR8DtUvq/4dDZOsnx2FuGyvgmLVIOFfpX43m9t+Os9nN3KbVSTXV2WbIzCGWNoYhFQRXYLAGv7db7nN4ygb3qBmYLondK5GXxuiSVd1x+pkZX00E1kDxIm6qL69HkGp0/YR1oZxOcnxKSmc/CIT60XAPECIRqIqzBXjZsTlXyRYvBUMDKv2JfwmzoJ7iFLnS3f6k9JQcclI0JUKteLxT7DOOUwCU5pLNX/Xv90xaKJOR+wEg9q+pv2iK0RjVKUBpFiVOW8XpYvnuyUb1uOtVvQGYfc/bbFPTu5QTtil4XhdyKu6QcAcMVImoZ/LW0h6Ay+7q4dqP1jzH7aANhDOoBaDvlk4QFXp+7LlBd3SdToxP2xHj0On3AsE+uESUcWXZ/Ga4924P0TxhgZT4uLXMud5eZRroPo6ncpHYhvmLq5vhOu+OqCmA4YPLndXrWkybfmKjuxUCZOHvw7bY3K04VO+aZTGeghV3tHVjbm16QfBLse6dd80PEzn2lu1l9ggUCqPSDg20rExuJMAVZvrcRzWBm1B9PIepY9vEoXD/CR/g3lCuTT1MF/KIqKH/Rh9C8wD+yv+/7X19YlbndAeANIENHAH0cLZZDt67Fqu6vqx0W5qo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39860400002)(136003)(366004)(346002)(396003)(451199018)(33656002)(38070700005)(82960400001)(478600001)(122000001)(26005)(6506007)(66476007)(9686003)(64756008)(186003)(5660300002)(38100700002)(86362001)(76116006)(66946007)(66556008)(316002)(8676002)(66446008)(83380400001)(966005)(7696005)(71200400001)(41300700001)(110136005)(54906003)(4326008)(2906002)(8936002)(55016003)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2Sp3G0GbINr+d6RPk5XBGDyjP805/bDoU4qlRTM+T+EFbW9pvDUPZ9xNDmkg?= =?us-ascii?Q?cS4/Veg5MC8kT19k5vhhXOzpXEF2b2WsTwm3AZ1Zx/uDqwznuCJbVHUrrUSf?= =?us-ascii?Q?Mdx/1cw1Xh713PbI4bhnjUhWA8fD/CXLUPDD/LLffKMZy9+BlVdHTOjvqimn?= =?us-ascii?Q?4Hv9uV1uA6KGJYQEy+xqLn/9qxaCa0ffs3t76GSfRlCjdtXMBNhKd6Mr6XBM?= =?us-ascii?Q?5TcZtlSIQnwuKliK/eXnvy4ftJcHlz0t2MgW+CVSJWCPWsKpx1gOXSAzVbGi?= =?us-ascii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qwGAJwoLP9t2kvTo/R?= =?us-ascii?Q?rSa+eA7Mn8xnDS0HXB/qS8DmJ6HYBaERpQnwnSMZNM1N2vRYe+pNn7nZb2m3?= =?us-ascii?Q?dvpADKPhz3AfkvLy8oxkeXUHvVNjDxD3ILU3O7vTYrjyH+k4frbmYGXFkdfB?= =?us-ascii?Q?OftI/mXqz1k3ArEGDz5jWY7ylnnsnzTJJgalhzHaowoMxerWfUA177XJ10e9?= =?us-ascii?Q?W5fq7v6vWCdtWldOrz1xvDkJFs4PI7Mrl+UqVXhnreXm+e3PsN9pt6FNrxIy?= =?us-ascii?Q?6MEkMuSh22l3wnZjcDWzCESrlNAwjfuXwm8WlO+QtIxerLgREICfq2cLDD5/?= =?us-ascii?Q?JvOThpEmI6nTi0d1tqc0c5S52yZDDh+LU18JS0qwzConDnK8/0ubZUQgfdjq?= =?us-ascii?Q?6fJFrybfawmNaNQiuVE3Nk10I+umLys3pH8jqEzj?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb178358-864b-40bd-b225-08daff4090ee X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2023 01:56:40.0273 (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: ePJjSjmxWDBzmx+3E3LFHG0beT9DQJBSf/C+jOXEHxkBPp7Cq+mpg9jKpQf/5Nm0hdPp/0n+HjQncXDlTii0RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7740 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On January 25, 2023 8:16 PM, Gerd Hoffmann wrote: > > +// > > +// SHA512_CTX is defined in and its size is 216 bytes. > > +// It can be built successfully with GCC5 compiler but failed with VS2= 019. > > +// The error code showed in VS2019 is that "openssl/sha.h" cannot be f= ound. > > +// To overcome this error SHA512_CTX_SIZE is defined. > > +// > > +#define SHA512_CTX_SIZ 216 >=20 > There is Sha384GetContextSize() >=20 HashAndExtendToRtmr is designed to be run in very early stage and at that s= tage Memory allocation service is not ready. So we have to declare an array= with size of SHA512_CTX_SIZE(216). Variable-length automatic arrays are allowed in C99. https://gcc.gnu.org/on= linedocs/gcc/Variable-Length.html So if ovmf is built with GCC, then the co= de below works: UINT8 Sha384Ctx[Sha384GetContextSize ()]; But unfortunately it is not supported in VS series. (I test it with VS2017) Building ... tdvf2\EmbeddedPkg\Library\PrePiMemoryAllocationLib\PrePiMemory= AllocationLib.inf [X64] tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2057: expec= ted constant expression tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2466: canno= t allocate an array of constant size 0 tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2133: 'Sha3= 84Ctx': unknown size So Sha384GetContextSize() cannot be used here. Thanks Min