public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lin, Derek (HPS UEFI Dev)" <derek.lin2@hpe.com>
To: "Zhang, Chao B" <chao.b.zhang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Yao, Jiewen" <jiewen.yao@intel.com>, "Zeng, Star" <star.zeng@intel.com>
Subject: Re: TPM 2.0 Manufacutre ID wrong byte order
Date: Fri, 23 Feb 2018 08:07:53 +0000	[thread overview]
Message-ID: <TU4PR8401MB1199F4E8646E9DFEFED4C29CC2CC0@TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <FF72C7E4248F3C4E9BDF19D4918E90F24965B772@shsmsx102.ccr.corp.intel.com>

Hi Chao B,

I think you are right, the Manufacture ID is a byte array. The order in ACPI 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 order is confused.
For example in Tcg2Dxe.c, it print:
Tpm2GetCapabilityManufactureID - 204D5453

Which should be "53544D20" in the case.

  Status = Tpm2GetCapabilityManufactureID (&mTcgDxeData.BsCap.ManufacturerID);
  if (EFI_ERROR (Status)) {
    DEBUG ((EFI_D_ERROR, "Tpm2GetCapabilityManufactureID fail!\n"));
  } else {
    DEBUG ((EFI_D_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", mTcgDxeData.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) <derek.lin2@hpe.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: TPM 2.0 Manufacutre ID wrong byte order

Hi Derek:
    Can you specify the "reversed" ManufactureId issue?  What did you get from 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<mailto:edk2-devel@lists.01.org>; Zhang, Chao B <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
Cc: Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Zeng, Star <star.zeng@intel.com<mailto:star.zeng@intel.com>>
Subject: TPM 2.0 Manufacutre ID wrong byte order

Hi TPM expert,

The line in https://github.com/tianocore/edk2/commit/73126ac2bd9804632255b2fddd4d7633537c9620#diff-76abe1c1ebf05982ed72eaf56f489029R192 change the byte 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 TPM is big-endian, which seems correct.

Can you check this and confirm?

Thanks,
Derek



  reply	other threads:[~2018-02-23  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 11:25 TPM 2.0 Manufacutre ID wrong byte order Lin, Derek (HPS UEFI Dev)
2018-02-23  3:03 ` Zhang, Chao B
2018-02-23  8:07   ` Lin, Derek (HPS UEFI Dev) [this message]
2018-02-24  6:25     ` Zhang, Chao B
2018-02-26  2:32       ` Lin, Derek (HPS UEFI Dev)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TU4PR8401MB1199F4E8646E9DFEFED4C29CC2CC0@TU4PR8401MB1199.NAMPRD84.PROD.OUTLOOK.COM \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox