From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=ting.ye@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3953221962301 for ; Fri, 30 Nov 2018 00:16:42 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Nov 2018 00:16:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,297,1539673200"; d="scan'208";a="94510776" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 30 Nov 2018 00:16:42 -0800 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 30 Nov 2018 00:16:41 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 30 Nov 2018 00:16:40 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.59]) by shsmsx102.ccr.corp.intel.com ([169.254.2.182]) with mapi id 14.03.0415.000; Fri, 30 Nov 2018 16:15:59 +0800 From: "Ye, Ting" To: Jagadeesh Ujja , "edk2-devel@lists.01.org" , "Gao, Liming" , "Zhang, Chao B" , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [RFC PATCH v3 11/11] CryptoPkg/BaseCryptLib: Hack to get time in MM Standalone mode Thread-Index: AQHUhxEj7rjNtUhvjk+ym/oqP0lBr6Vn+FwA Date: Fri, 30 Nov 2018 08:15:59 +0000 Message-ID: References: <1543397709-31847-1-git-send-email-jagadeesh.ujja@arm.com> <1543397709-31847-12-git-send-email-jagadeesh.ujja@arm.com> In-Reply-To: <1543397709-31847-12-git-send-email-jagadeesh.ujja@arm.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [RFC PATCH v3 11/11] CryptoPkg/BaseCryptLib: Hack to get time in MM Standalone mode 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, 30 Nov 2018 08:16:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jagadeesh, I don't suggest to update BaseCryptLib to use a PCD in StandaloneMmPkg, it = makes other consumer of BaseCryptLib has dependency of StandaloneMmPkg.=20 Also ToDo code below is not acceptable to me. I am thinking you could cons= ider creating a new instance for BaseCryptLib such as "MmCryptLib" if the u= pdate to TimerWrapp.c is necessary for MM Standalone mode. Thanks, Ting -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jaga= deesh Ujja Sent: Wednesday, November 28, 2018 5:35 PM To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Cha= o B ; leif.lindholm@linaro.org; ard.biesheuvel@lina= ro.org Subject: [edk2] [RFC PATCH v3 11/11] CryptoPkg/BaseCryptLib: Hack to get ti= me in MM Standalone mode This is hack to get the time when executing in MM Standalone mode. It is no= t clear how to implement a function that gets the current time. So using th= is as a hack for now. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jagadeesh Ujja --- 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/Li= brary/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 =20 [LibraryClasses] BaseLib @@ -86,6 +87,10 @@ [LibraryClasses] OpensslLib IntrinsicLib PrintLib + PcdLib + +[FeaturePcd] + gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable =20 # # Remove these [BuildOptions] after this library is cleaned up diff --git = a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf b/CryptoPkg/Library/Ba= seCryptLib/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 =20 [LibraryClasses] BaseLib @@ -91,6 +92,10 @@ [LibraryClasses] OpensslLib IntrinsicLib PrintLib + PcdLib + +[FeaturePcd] + gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable =20 # # 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). =20 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 availab= le under the terms and conditions of the BSD License which accompanies thi= s 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; =20 - // - // Get the current time and date information - // - Status =3D gRT->GetTime (&Time, NULL); - if (EFI_ERROR (Status) || (Time.Year < 1970)) { - return 0; + if (!PcdGetBool (PcdStandaloneMmEnable)) { + // + // Get the current time and date information + // + Status =3D 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 =3D 2007; + Time.Month =3D 11; + Time.Day =3D 29; + Time.Hour =3D 17; + Time.Minute =3D 43; + Time.Second =3D 30; + + Year =3D (UINTN) (Time.Year % 100); } =20 // -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel