public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* TPM 2.0 Manufacutre ID wrong byte order
@ 2018-02-22 11:25 Lin, Derek (HPS UEFI Dev)
  2018-02-23  3:03 ` Zhang, Chao B
  0 siblings, 1 reply; 5+ messages in thread
From: Lin, Derek (HPS UEFI Dev) @ 2018-02-22 11:25 UTC (permalink / raw)
  To: edk2-devel@lists.01.org, Zhang, Chao B; +Cc: Yao, Jiewen, Zeng, Star

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TPM 2.0 Manufacutre ID wrong byte order
  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)
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Chao B @ 2018-02-23  3:03 UTC (permalink / raw)
  To: Lin, Derek (HPS UEFI Dev), edk2-devel@lists.01.org
  Cc: Yao, Jiewen, Zeng, Star

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; Zhang, Chao B <chao.b.zhang@intel.com>
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TPM 2.0 Manufacutre ID wrong byte order
  2018-02-23  3:03 ` Zhang, Chao B
@ 2018-02-23  8:07   ` Lin, Derek (HPS UEFI Dev)
  2018-02-24  6:25     ` Zhang, Chao B
  0 siblings, 1 reply; 5+ messages in thread
From: Lin, Derek (HPS UEFI Dev) @ 2018-02-23  8:07 UTC (permalink / raw)
  To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Zeng, Star

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TPM 2.0 Manufacutre ID wrong byte order
  2018-02-23  8:07   ` Lin, Derek (HPS UEFI Dev)
@ 2018-02-24  6:25     ` Zhang, Chao B
  2018-02-26  2:32       ` Lin, Derek (HPS UEFI Dev)
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang, Chao B @ 2018-02-24  6:25 UTC (permalink / raw)
  To: Lin, Derek (HPS UEFI Dev), edk2-devel@lists.01.org
  Cc: Yao, Jiewen, Zeng, Star

Derek:
   Thank you for the info. TPM Library spec 1.38. Page 342 defines each property 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. 
It doesn't apply to the PT_MANFACTURER case. We can add comments to make this interface clearer. But I think current implementation is good from spec point of view.   
    

-----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 <chao.b.zhang@intel.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>
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 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: TPM 2.0 Manufacutre ID wrong byte order
  2018-02-24  6:25     ` Zhang, Chao B
@ 2018-02-26  2:32       ` Lin, Derek (HPS UEFI Dev)
  0 siblings, 0 replies; 5+ messages in thread
From: Lin, Derek (HPS UEFI Dev) @ 2018-02-26  2:32 UTC (permalink / raw)
  To: Zhang, Chao B, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Zeng, Star

I agree. Add comments to make this clear seems good.
It's good enough for me.

Thanks,
Derek

-----Original Message-----
From: Zhang, Chao B [mailto:chao.b.zhang@intel.com] 
Sent: Saturday, February 24, 2018 2:26 PM
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

Derek:
   Thank you for the info. TPM Library spec 1.38. Page 342 defines each property 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. 
It doesn't apply to the PT_MANFACTURER case. We can add comments to make this interface clearer. But I think current implementation is good from spec point of view.   
    

-----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 <chao.b.zhang@intel.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>
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 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-26  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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)
2018-02-24  6:25     ` Zhang, Chao B
2018-02-26  2:32       ` Lin, Derek (HPS UEFI Dev)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox