From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.241.48.73; helo=g9t5009.houston.hpe.com; envelope-from=derek.lin2@hpe.com; receiver=edk2-devel@lists.01.org Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) (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 3F6AF2243693B for ; Fri, 23 Feb 2018 00:02:00 -0800 (PST) Received: from G2W6311.americas.hpqcorp.net (g2w6311.austin.hp.com [16.197.64.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id AE4DB73 for ; Fri, 23 Feb 2018 08:08:00 +0000 (UTC) Received: from G9W8673.americas.hpqcorp.net (16.220.49.32) by G2W6311.americas.hpqcorp.net (16.197.64.53) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 23 Feb 2018 08:07:56 +0000 Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W8673.americas.hpqcorp.net (16.220.49.32) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 23 Feb 2018 08:07:55 +0000 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (15.241.52.12) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Fri, 23 Feb 2018 08:07:55 +0000 Received: from TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM (10.169.48.149) by TU4PR8401MB0733.NAMPRD84.PROD.OUTLOOK.COM (10.169.45.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Fri, 23 Feb 2018 08:07:53 +0000 Received: from TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM ([fe80::9937:9c33:86e1:2704]) by TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM ([fe80::9937:9c33:86e1:2704%14]) with mapi id 15.20.0527.017; Fri, 23 Feb 2018 08:07:53 +0000 From: "Lin, Derek (HPS UEFI Dev)" To: "Zhang, Chao B" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , "Zeng, Star" Thread-Topic: TPM 2.0 Manufacutre ID wrong byte order Thread-Index: AdOrz7VEcbbsZcIoT4ukA4PvAGJIIQAgZLyAAApqgIA= Date: Fri, 23 Feb 2018 08:07:53 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=derek.lin2@hpe.com; x-originating-ip: [16.242.247.133] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TU4PR8401MB0733; 7:b8N/zuyoH57PaZ8oIZkz6Vutyl6XmRW8pKf3ozRLINGxG7nNmbEGALLk3eRU14q2CXBGH7Se33UyOIMyJnU3JM++U5KpXTbk5TwVaEt8jpvlsYqtqpaod0Wo9w3txKcSYS7qeqYR5GQx/1L3rwCZHS04SFcEa+Jb5T3oijyycDwzCo5SpWwYYJdG7YfsoqlgZID9/1voKnfZwwb5rbX/BeOo7L2xUS5kxfWqnyC8GnbyOKiLZ2kC/DZ68wq0TNdE x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ba99bb6d-cae9-4d83-6147-08d57a948a0f x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989060)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:TU4PR8401MB0733; x-ms-traffictypediagnostic: TU4PR8401MB0733: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(227479698468861)(166708455590820)(162533806227266)(21748063052155)(222181515654134)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001082)(6040501)(2401047)(5005006)(8121501046)(3231101)(944501161)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:TU4PR8401MB0733; BCL:0; PCL:0; RULEID:; SRVR:TU4PR8401MB0733; x-forefront-prvs: 0592A9FDE6 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39380400002)(376002)(346002)(396003)(39860400002)(366004)(189003)(199004)(790700001)(6116002)(8676002)(102836004)(9686003)(6306002)(54896002)(5250100002)(7696005)(33656002)(86362001)(81166006)(81156014)(74316002)(3846002)(236005)(106356001)(99286004)(53546011)(2906002)(229853002)(2501003)(4326008)(7736002)(97736004)(105586002)(25786009)(8936002)(2950100002)(3660700001)(14454004)(186003)(606006)(59450400001)(68736007)(76176011)(478600001)(5660300001)(54906003)(110136005)(6436002)(3280700002)(53936002)(66066001)(55016002)(26005)(6506007)(6246003)(2900100001)(966005)(316002)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:TU4PR8401MB0733; H:TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: dma1ZFiWMn0jwRQ6Rj79xQ2Pf4zGhAlStunR+BcJu8q5VlQQYyERrbeBwpLxHusCppFg9RyjiXkqHfCb7ZaEwT2CjUeZ6vlcl3TYA30BIdW2kf9kUIAL0g/m+4RDGtPxMB5p+BelOBdZjsKQW2Cyq0tWBDF7Bp4qowVUH5z0SlM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: ba99bb6d-cae9-4d83-6147-08d57a948a0f X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2018 08:07:53.1711 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR8401MB0733 X-OriginatorOrg: hpe.com X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Fri, 23 Feb 2018 08:02:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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