diff --git a/SecurityPkg/Library/HashLibTdx/HashLibTdx.c b/SecurityPkg/Library/HashLibTdx/HashLibTdx.c index 75d96ee64b..3cebbc70d3 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.