From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=jagadeesh.ujja@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 9203F21CAD9B2 for ; Fri, 14 Dec 2018 04:14:08 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F655EBD; Fri, 14 Dec 2018 04:14:08 -0800 (PST) Received: from usa.arm.com (a075555-lin.blr.arm.com [10.162.2.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 784403F575; Fri, 14 Dec 2018 04:14:06 -0800 (PST) From: Jagadeesh Ujja To: edk2-devel@lists.01.org, liming.gao@intel.com, chao.b.zhang@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org Date: Fri, 14 Dec 2018 17:43:27 +0530 Message-Id: <1544789607-11316-14-git-send-email-jagadeesh.ujja@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544789607-11316-1-git-send-email-jagadeesh.ujja@arm.com> References: <1544789607-11316-1-git-send-email-jagadeesh.ujja@arm.com> MIME-Version: 1.0 Subject: [PATCH 13/13] CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 12:14:08 -0000 X-List-Received-Date: Fri, 14 Dec 2018 12:14:08 -0000 X-List-Received-Date: Fri, 14 Dec 2018 12:14:08 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “BaseCryptLib” library can be used by MM_STANDALONE drivers as well. So add MM_STANDALONE as the module type this library supports. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jagadeesh Ujja --- CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 7 ++++++- CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 4 ++++ CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 15 +++++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf index f29445c..b6ebac5 100644 --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -7,6 +7,7 @@ # buffer overflow or integer overflow. # # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018, ARM Limited. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -24,7 +25,7 @@ FILE_GUID = be3bb803-91b6-4da0-bd91-a8b21c18ca5d MODULE_TYPE = DXE_DRIVER VERSION_STRING = 1.0 - LIBRARY_CLASS = BaseCryptLib|DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER + LIBRARY_CLASS = BaseCryptLib|DXE_DRIVER DXE_CORE UEFI_APPLICATION UEFI_DRIVER MM_STANDALONE # # The following information is for reference only and not required by the build tools. @@ -85,6 +86,10 @@ OpensslLib IntrinsicLib PrintLib + PcdLib + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmCodeEnabled # # Remove these [BuildOptions] after this library is cleaned up diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf index 32628c8..fb16451 100644 --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf @@ -91,6 +91,10 @@ OpensslLib IntrinsicLib PrintLib + PcdLib + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdStandaloneMmCodeEnabled # # Remove these [BuildOptions] after this library is cleaned up diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c index 5f9b0c2..de8e756 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c @@ -3,6 +3,7 @@ for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME). Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -77,12 +78,14 @@ time_t time (time_t *timer) time_t CalTime; UINTN Year; - // - // Get the current time and date information - // - Status = gRT->GetTime (&Time, NULL); - if (EFI_ERROR (Status) || (Time.Year < 1970)) { - return 0; + if (!PcdGetBool (PcdStandaloneMmCodeEnabled)) { + // + // Get the current time and date information + // + Status = gRT->GetTime (&Time, NULL); + if (EFI_ERROR (Status) || (Time.Year < 1970)) { + return 0; + } } // -- 2.7.4