public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] SecurityPkg: add TIS sanity check
@ 2023-04-26 16:24 Gerd Hoffmann
  2023-04-26 16:24 ` [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2) Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2023-04-26 16:24 UTC (permalink / raw)
  To: devel
  Cc: Jian J Wang, Pawel Polawski, Oliver Steffen, Jiewen Yao,
	Gerd Hoffmann



Gerd Hoffmann (2):
  SecurityPkg: add TIS sanity check (tpm2)
  SecurityPkg: add TIS sanity check (tpm12)

 SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 6 +++++-
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.40.0


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

* [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2)
  2023-04-26 16:24 [PATCH 0/2] SecurityPkg: add TIS sanity check Gerd Hoffmann
@ 2023-04-26 16:24 ` Gerd Hoffmann
  2023-04-27 14:37   ` [edk2-devel] " Yao, Jiewen
  2023-04-26 16:24 ` [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12) Gerd Hoffmann
  2023-05-02 15:47 ` [edk2-devel] [PATCH 0/2] SecurityPkg: add TIS sanity check Yao, Jiewen
  2 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2023-04-26 16:24 UTC (permalink / raw)
  To: devel
  Cc: Jian J Wang, Pawel Polawski, Oliver Steffen, Jiewen Yao,
	Gerd Hoffmann

The code blindly assumes a TIS interface is present in case both CRB and
FIFO checks fail.  Check the InterfaceType for TIS instead and only
return Tpm2PtpInterfaceTis in case it matches, Tpm2PtpInterfaceMax
otherwise.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
index 1f9ac5ab5a30..eac9f0e29941 100644
--- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
+++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
@@ -464,7 +464,11 @@ Tpm2GetPtpInterface (
     return Tpm2PtpInterfaceFifo;
   }
 
-  return Tpm2PtpInterfaceTis;
+  if (InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
+    return Tpm2PtpInterfaceTis;
+  }
+
+  return Tpm2PtpInterfaceMax;
 }
 
 /**
-- 
2.40.0


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

* [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12)
  2023-04-26 16:24 [PATCH 0/2] SecurityPkg: add TIS sanity check Gerd Hoffmann
  2023-04-26 16:24 ` [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2) Gerd Hoffmann
@ 2023-04-26 16:24 ` Gerd Hoffmann
  2023-04-27 14:36   ` Yao, Jiewen
  2023-05-02 15:47 ` [edk2-devel] [PATCH 0/2] SecurityPkg: add TIS sanity check Yao, Jiewen
  2 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2023-04-26 16:24 UTC (permalink / raw)
  To: devel
  Cc: Jian J Wang, Pawel Polawski, Oliver Steffen, Jiewen Yao,
	Gerd Hoffmann

The code blindly assumes a TIS interface is present in case both CRB and
FIFO checks fail.  Check the InterfaceType for TIS instead and only
return PtpInterfaceTis in case it matches, PtpInterfaceMax otherwise.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
index 51f43591287a..d2b79a274084 100644
--- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
+++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
@@ -91,7 +91,11 @@ Tpm12GetPtpInterface (
     return PtpInterfaceFifo;
   }
 
-  return PtpInterfaceTis;
+  if (InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
+    return PtpInterfaceTis;
+  }
+
+  return PtpInterfaceMax;
 }
 
 /**
-- 
2.40.0


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

* Re: [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12)
  2023-04-26 16:24 ` [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12) Gerd Hoffmann
@ 2023-04-27 14:36   ` Yao, Jiewen
  0 siblings, 0 replies; 6+ messages in thread
From: Yao, Jiewen @ 2023-04-27 14:36 UTC (permalink / raw)
  To: Gerd Hoffmann, devel@edk2.groups.io
  Cc: Wang, Jian J, Pawel Polawski, Oliver Steffen

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Thursday, April 27, 2023 12:24 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Oliver Steffen <osteffen@redhat.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12)
> 
> The code blindly assumes a TIS interface is present in case both CRB and
> FIFO checks fail.  Check the InterfaceType for TIS instead and only
> return PtpInterfaceTis in case it matches, PtpInterfaceMax otherwise.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
> b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
> index 51f43591287a..d2b79a274084 100644
> --- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
> +++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
> @@ -91,7 +91,11 @@ Tpm12GetPtpInterface (
>      return PtpInterfaceFifo;
>    }
> 
> -  return PtpInterfaceTis;
> +  if (InterfaceId.Bits.InterfaceType ==
> PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
> +    return PtpInterfaceTis;
> +  }
> +
> +  return PtpInterfaceMax;
>  }
> 
>  /**
> --
> 2.40.0


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

* Re: [edk2-devel] [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2)
  2023-04-26 16:24 ` [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2) Gerd Hoffmann
@ 2023-04-27 14:37   ` Yao, Jiewen
  0 siblings, 0 replies; 6+ messages in thread
From: Yao, Jiewen @ 2023-04-27 14:37 UTC (permalink / raw)
  To: devel@edk2.groups.io, kraxel@redhat.com
  Cc: Wang, Jian J, Pawel Polawski, Oliver Steffen

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd
> Hoffmann
> Sent: Thursday, April 27, 2023 12:24 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Oliver Steffen <osteffen@redhat.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [edk2-devel] [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2)
> 
> The code blindly assumes a TIS interface is present in case both CRB and
> FIFO checks fail.  Check the InterfaceType for TIS instead and only
> return Tpm2PtpInterfaceTis in case it matches, Tpm2PtpInterfaceMax
> otherwise.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> index 1f9ac5ab5a30..eac9f0e29941 100644
> --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
> @@ -464,7 +464,11 @@ Tpm2GetPtpInterface (
>      return Tpm2PtpInterfaceFifo;
>    }
> 
> -  return Tpm2PtpInterfaceTis;
> +  if (InterfaceId.Bits.InterfaceType ==
> PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_TIS) {
> +    return Tpm2PtpInterfaceTis;
> +  }
> +
> +  return Tpm2PtpInterfaceMax;
>  }
> 
>  /**
> --
> 2.40.0
> 
> 
> 
> 
> 


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

* Re: [edk2-devel] [PATCH 0/2] SecurityPkg: add TIS sanity check
  2023-04-26 16:24 [PATCH 0/2] SecurityPkg: add TIS sanity check Gerd Hoffmann
  2023-04-26 16:24 ` [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2) Gerd Hoffmann
  2023-04-26 16:24 ` [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12) Gerd Hoffmann
@ 2023-05-02 15:47 ` Yao, Jiewen
  2 siblings, 0 replies; 6+ messages in thread
From: Yao, Jiewen @ 2023-05-02 15:47 UTC (permalink / raw)
  To: devel@edk2.groups.io, kraxel@redhat.com
  Cc: Wang, Jian J, Pawel Polawski, Oliver Steffen

Merged https://github.com/tianocore/edk2/pull/4325

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd
> Hoffmann
> Sent: Thursday, April 27, 2023 12:24 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Oliver Steffen <osteffen@redhat.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
> Subject: [edk2-devel] [PATCH 0/2] SecurityPkg: add TIS sanity check
> 
> 
> 
> Gerd Hoffmann (2):
>   SecurityPkg: add TIS sanity check (tpm2)
>   SecurityPkg: add TIS sanity check (tpm12)
> 
>  SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c | 6 +++++-
>  SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c   | 6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> --
> 2.40.0
> 
> 
> 
> 
> 


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

end of thread, other threads:[~2023-05-02 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26 16:24 [PATCH 0/2] SecurityPkg: add TIS sanity check Gerd Hoffmann
2023-04-26 16:24 ` [PATCH 1/2] SecurityPkg: add TIS sanity check (tpm2) Gerd Hoffmann
2023-04-27 14:37   ` [edk2-devel] " Yao, Jiewen
2023-04-26 16:24 ` [PATCH 2/2] SecurityPkg: add TIS sanity check (tpm12) Gerd Hoffmann
2023-04-27 14:36   ` Yao, Jiewen
2023-05-02 15:47 ` [edk2-devel] [PATCH 0/2] SecurityPkg: add TIS sanity check Yao, Jiewen

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