From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::144; helo=mail-it1-x144.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x144.google.com (mail-it1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2207B211A4587 for ; Fri, 21 Dec 2018 02:13:43 -0800 (PST) Received: by mail-it1-x144.google.com with SMTP id w18so6094967ite.1 for ; Fri, 21 Dec 2018 02:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZcpsUAsJMehZRyLltrJJK7zJhC31xMR+5aLjrm6fECo=; b=OPqLNPoy1fDabOuWOAB9K1goLm9h8p+TspnXoZ8zVKYptO3b9BeK024qq3PZEWADfB /BCfpb4PyRVhyt0OKjuNeS9Tbe9i2dMrfVlsh5UEXK3OPkl+Y1CP8uph9J3X/rDCM5Pb BH47LNZjsiUF9XUG/KDy7D0uKnz64igDQCdRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZcpsUAsJMehZRyLltrJJK7zJhC31xMR+5aLjrm6fECo=; b=OpT8FgoWsJ52JMUgdbKBhC/MGHidGOeYkAnrZtUnBv3DT/025xtjqyqtI8bUyVeZPp aTZwSzNOOkugZPPp7Q1qbRsqAIvwptsKaIPhgQnDIedEU6jIuxL3xuXI2wWHlzCMjq58 Vp72TT2x6nSP4OSeutoCH4RR3JY1R/ChWNUJPla7YT10Jr7G00l5UEXi7q9N/q6N2KKY X/gGHxjwSpx+HZ3MS1zTWwy6U0nutqx8exjS2eT1AdmOPNks+m6qVsvjVKd2NRCTwqv+ +cbRLY4iMW4UI5zVimzRkvv3F4PkO9JySOKVACja5SapMp3I0q93cGfOwu2c9DppLuro 5DkA== X-Gm-Message-State: AA+aEWaxxBlol4A4Ykr9yafD4qbAW60K7jIoDsqtfcv88MXVxk/HdGSM 6W5vKmc8xjWsVl/5qX4oamyq9RbaEZ8K5Pzh1ITzRw== X-Google-Smtp-Source: AFSGD/V3ELqjLQJtxBCe7KXHoJCSQHvfTrOkO70ktgzfvC4piMds7aPbkojnDrpBru/fLHb7tUlbOwzz7TrWVVq29sg= X-Received: by 2002:a05:660c:4b:: with SMTP id p11mr1575053itk.71.1545387222164; Fri, 21 Dec 2018 02:13:42 -0800 (PST) MIME-Version: 1.0 References: <1544789607-11316-1-git-send-email-jagadeesh.ujja@arm.com> <1544789607-11316-14-git-send-email-jagadeesh.ujja@arm.com> In-Reply-To: <1544789607-11316-14-git-send-email-jagadeesh.ujja@arm.com> From: Ard Biesheuvel Date: Fri, 21 Dec 2018 11:13:30 +0100 Message-ID: To: Jagadeesh Ujja Cc: "edk2-devel@lists.01.org" , "Gao, Liming" , "Zhang, Chao B" , Leif Lindholm Subject: Re: [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, 21 Dec 2018 10:13:43 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 14 Dec 2018 at 13:14, Jagadeesh Ujja wrote= : > > =E2=80=9CBaseCryptLib=E2=80=9D library can be used by MM_STANDALONE drive= rs as well. > So add MM_STANDALONE as the module type this library supports. > This patch affects other drivers as well. Also, shouldn't we be using SmmCryptLib for MM_STANDALONE? The MODULE_TYPE of SmmCryptLib can be changed to BASE since it doesn't have a constructor. I think that should also address your time() issue, no? > 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 ma= y be found at > @@ -24,7 +25,7 @@ > FILE_GUID =3D be3bb803-91b6-4da0-bd91-a8b21c18ca5= d > MODULE_TYPE =3D DXE_DRIVER > VERSION_STRING =3D 1.0 > - LIBRARY_CLASS =3D BaseCryptLib|DXE_DRIVER DXE_CORE UE= FI_APPLICATION UEFI_DRIVER > + LIBRARY_CLASS =3D BaseCryptLib|DXE_DRIVER DXE_CORE UE= FI_APPLICATION UEFI_DRIVER MM_STANDALONE > > # > # The following information is for reference only and not required by th= e 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/CryptoP= kg/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/Cryp= toPkg/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 BS= D License > which accompanies this distribution. The full text of the license may b= e 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 =3D gRT->GetTime (&Time, NULL); > - if (EFI_ERROR (Status) || (Time.Year < 1970)) { > - return 0; > + if (!PcdGetBool (PcdStandaloneMmCodeEnabled)) { > + // > + // Get the current time and date information > + // > + Status =3D gRT->GetTime (&Time, NULL); > + if (EFI_ERROR (Status) || (Time.Year < 1970)) { > + return 0; > + } > } > > // > -- > 2.7.4 >