From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.14715.1655033090662384578 for ; Sun, 12 Jun 2022 04:24:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=abLNQt2t; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655033090; x=1686569090; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HW7zmZFvJmJI+JoJv12BXZtZ1gfzVRYLMqpkyf5EoXI=; b=abLNQt2tydVt/kvq8etHp8631ce0CZrZwn0uvXUji3kXYUsk84NXDBlR PRI9rEOA4HTMGiGF1sQ+WvOaZX/hf+se4oZ4RcXTH8EwBrh7KhkaUS5pD H3ql05w25IYl4Hrd0kTFcl4vmhSzTmCLSJK7CCryW6nTpv5yiiJrsw65a gCIrP1rDkkO/rt6uCojSFljMXaLSvK6Ieuv5Xy1yXRgKbvFQmQzFMcSDt ru8lPV3Xauznhp4jSaWP0QBryz97rgX1kiO4WsFd5GUYi4ByHyTjHjdHE /Gqmt+uB1CspzENG1mmWZ/RujRy86PflUdA+8+UFwqLokZ9yT1YHxSW6b Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10375"; a="276807160" X-IronPort-AV: E=Sophos;i="5.91,294,1647327600"; d="scan'208";a="276807160" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2022 04:24:50 -0700 X-IronPort-AV: E=Sophos;i="5.91,294,1647327600"; d="scan'208";a="639151765" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.28.104]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2022 04:24:49 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Gerd Hoffmann , Jiewen Yao , Jian J Wang Subject: [PATCH 2/2] SecurityPkg/HashLibTdx: Return EFI_UNSUPPORTED if it is not Tdx guest Date: Sun, 12 Jun 2022 19:24:34 +0800 Message-Id: <20220612112434.1829-2-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20220612112434.1829-1-min.m.xu@intel.com> References: <20220612112434.1829-1-min.m.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Min M Xu HashLibTdx is designed for the Tdx guest. So if is not a Tdx guest, return EFI_UNSUPPORTED in RegisterHashInterfaceLib. Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Jian J Wang Signed-off-by: Min Xu --- 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