From: Min M Xu <[email protected]>

HashLibTdx is designed for the Tdx guest. So if is not a Tdx guest,
return EFI_UNSUPPORTED in RegisterHashInterfaceLib.

Cc: Gerd Hoffmann <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Jian J Wang <[email protected]>
Signed-off-by: Min Xu <[email protected]>
---
 SecurityPkg/Library/HashLibTdx/HashLibTdx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/HashLibTdx/HashLibTdx.c 
b/SecurityPkg/Library/HashLibTdx/HashLibTdx.c
index 75d96ee64b44..3cebbc70d3ec 100644
--- a/SecurityPkg/Library/HashLibTdx/HashLibTdx.c
+++ b/SecurityPkg/Library/HashLibTdx/HashLibTdx.c
@@ -186,7 +186,13 @@ RegisterHashInterfaceLib (
   IN HASH_INTERFACE  *HashInterface
   )
 {
-  ASSERT (TdIsEnabled ());
+  //
+  // HashLibTdx is designed for Tdx guest. So if it is not Tdx guest,
+  // return EFI_UNSUPPORTED.
+  //
+  if (!TdIsEnabled ()) {
+    return EFI_UNSUPPORTED;
+  }
 
   //
   // Only SHA384 is allowed.
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90462): https://edk2.groups.io/g/devel/message/90462
Mute This Topic: https://groups.io/mt/91704053/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to