diff options
author | Min M Xu <min.m.xu@intel.com> | 2022-06-12 19:24:34 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-06-16 08:08:19 +0000 |
commit | 05e57cc9ced67d2cd633c2bdcf70b5e1352bf635 (patch) | |
tree | 1344931a6de39bd048f4718b217e304e4eacd798 /SecurityPkg | |
parent | 16d97fa6010b89d859aff5744b957f328c5848ef (diff) | |
download | edk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.zip edk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.tar.gz edk2-05e57cc9ced67d2cd633c2bdcf70b5e1352bf635.tar.bz2 |
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.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/SecurityPkg/Library/HashLibTdx/HashLibTdx.c b/SecurityPkg/Library/HashLibTdx/HashLibTdx.c index 75d96ee..3cebbc7 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.
|