From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=chao.b.zhang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6DCE1222630DA for ; Fri, 23 Feb 2018 22:19:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2018 22:25:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,386,1515484800"; d="scan'208";a="20039989" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga008.fm.intel.com with ESMTP; 23 Feb 2018 22:25:51 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Feb 2018 22:25:50 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 23 Feb 2018 22:25:50 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.125]) with mapi id 14.03.0319.002; Sat, 24 Feb 2018 14:25:48 +0800 From: "Zhang, Chao B" To: "Lin, Derek (HPS UEFI Dev)" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: TPM 2.0 Manufacutre ID wrong byte order Thread-Index: AdOrz7VEcbbsZcIoT4ukA4PvAGJIIQAgZLyAAApqgIAALo1P0A== Date: Sat, 24 Feb 2018 06:25:47 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWYxMjE1ZmItNjk5NC00NDRhLWJhMWMtNzU3ODAwNzIxMGNmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJFY1M1a0ZUT3REWnRsUUlFVVN6U2l1aUY0MVpvdEd5azFpTThrZm9pd0tnZitpNzVKXC9vWStIbjFCM1hZMGhkNyJ9 dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: TPM 2.0 Manufacutre ID wrong byte order X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 06:19:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Derek: Thank you for the info. TPM Library spec 1.38. Page 342 defines each pro= perty to be a 32-bit value. Endian conversion only applies to those 32-bit = value that are interpreted as 16-bit, 32-bit data outside.=20 It doesn't apply to the PT_MANFACTURER case. We can add comments to make th= is interface clearer. But I think current implementation is good from spec = point of view. =20 =20 -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Lin,= Derek (HPS UEFI Dev) Sent: Friday, February 23, 2018 4:08 PM To: Zhang, Chao B ; edk2-devel@lists.01.org Cc: Yao, Jiewen ; Zeng, Star Subject: Re: [edk2] TPM 2.0 Manufacutre ID wrong byte order Hi Chao B, I think you are right, the Manufacture ID is a byte array. The order in ACP= I HID is correct. But Tpm2GetCapabilityManufactureID return a UINT32 value. EFI_STATUS EFIAPI Tpm2GetCapabilityManufactureID ( OUT UINT32 *ManufactureId ) This is confused . When the caller use ManufactureId as UINT32, the byte or= der is confused. For example in Tcg2Dxe.c, it print: Tpm2GetCapabilityManufactureID - 204D5453 Which should be "53544D20" in the case. Status =3D Tpm2GetCapabilityManufactureID (&mTcgDxeData.BsCap.Manufacture= rID); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "Tpm2GetCapabilityManufactureID fail!\n")); } else { DEBUG ((EFI_D_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", mTcgDxeD= ata.BsCap.ManufacturerID)); } How about changing the returning value to a 4 bytes array? Thanks, Derek From: Zhang, Chao B [mailto:chao.b.zhang@intel.com] Sent: Friday, February 23, 2018 11:03 AM To: Lin, Derek (HPS UEFI Dev) ; edk2-devel@lists.01.org Cc: Yao, Jiewen ; Zeng, Star Subject: RE: TPM 2.0 Manufacutre ID wrong byte order Hi Derek: Can you specify the "reversed" ManufactureId issue? What did you get f= rom this interface? The implementation follows Vendor ID registry spec. The vendor ID is octet = array. There is no endian issue here. We haven't seen any disorder before. From: Lin, Derek (HPS UEFI Dev) [mailto:derek.lin2@hpe.com] Sent: Thursday, February 22, 2018 7:25 PM To: edk2-devel@lists.01.org; Zhang, Chao B = > Cc: Yao, Jiewen >; Zeng, = Star > Subject: TPM 2.0 Manufacutre ID wrong byte order Hi TPM expert, The line in https://github.com/tianocore/edk2/commit/73126ac2bd9804632255b2= fddd4d7633537c9620#diff-76abe1c1ebf05982ed72eaf56f489029R192 change the byt= e order of Manufacture ID in Tpm2GetCapabilityManufactureID (). I see it return "reversed" ManufactureId for two TPM vendor's module. Also, all other Capability data in Tpm2Capability.c use SwapBytes32 since T= PM is big-endian, which seems correct. Can you check this and confirm? Thanks, Derek _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel