summaryrefslogtreecommitdiffstats
path: root/SecurityPkg
diff options
context:
space:
mode:
authorMin M Xu <min.m.xu@intel.com>2022-06-12 19:24:34 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-06-16 08:08:19 +0000
commit05e57cc9ced67d2cd633c2bdcf70b5e1352bf635 (patch)
tree1344931a6de39bd048f4718b217e304e4eacd798 /SecurityPkg
parent16d97fa6010b89d859aff5744b957f328c5848ef (diff)
downloadedk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.tar.gz
edk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.tar.bz2
edk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.zip
SecurityPkg/HashLibTdx: Return EFI_UNSUPPORTED if it is not Tdx guest
HashLibTdx is designed for the Tdx guest. So if is not a Tdx guest, return EFI_UNSUPPORTED in RegisterHashInterfaceLib. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/Library/HashLibTdx/HashLibTdx.c8
1 files changed, 7 insertions, 1 deletions
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.