This is hack to get the time when executing in MM Standalone mode. It is not clear how to implement a function that gets the current time. So using this as a hack for now.
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jagadeesh Ujja <[email protected]> --- CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 5 ++++ CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 5 ++++ CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 27 +++++++++++++++----- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf index c8aafefbab9c..df4aca6c20e2 100644 --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf @@ -76,6 +76,7 @@ [Sources.AARCH64] [Packages] MdePkg/MdePkg.dec CryptoPkg/CryptoPkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] BaseLib @@ -86,6 +87,10 @@ [LibraryClasses] OpensslLib IntrinsicLib PrintLib + PcdLib + +[FeaturePcd] + gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable # # Remove these [BuildOptions] after this library is cleaned up diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf index 32628c8835a6..651a6736ba48 100644 --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf @@ -80,6 +80,7 @@ [Sources.AARCH64] [Packages] MdePkg/MdePkg.dec CryptoPkg/CryptoPkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] BaseLib @@ -91,6 +92,10 @@ [LibraryClasses] OpensslLib IntrinsicLib PrintLib + PcdLib + +[FeaturePcd] + gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable # # 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 5f9b0c20d75d..d01b5c5fc113 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.<BR> +Copyright (c) 2018, ARM Limited. All rights reserved.<BR> 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,26 @@ 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 (PcdStandaloneMmEnable)) { + // + // Get the current time and date information + // + Status = gRT->GetTime (&Time, NULL); + if (EFI_ERROR (Status) || (Time.Year < 1970)) { + return 0; + } + } else { + // + //[ToDo] Find out a way to get the current time for code executing as MM_STANDALONE + // + Time.Year = 2007; + Time.Month = 11; + Time.Day = 29; + Time.Hour = 17; + Time.Minute = 43; + Time.Second = 30; + + Year = (UINTN) (Time.Year % 100); } // -- 2.7.4 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

