From nobody Sat Nov 2 16:31:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486455886547503.6414267245558; Tue, 7 Feb 2017 00:24:46 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 09BB3820E1; Tue, 7 Feb 2017 00:24:39 -0800 (PST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 912B1820C4 for ; Tue, 7 Feb 2017 00:24:37 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP; 07 Feb 2017 00:24:37 -0800 Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.21.101]) by orsmga005.jf.intel.com with ESMTP; 07 Feb 2017 00:24:36 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="61704880" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 00:24:24 -0800 Message-Id: <1486455866-7896-5-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1486455866-7896-1-git-send-email-jiewen.yao@intel.com> References: <1486455866-7896-1-git-send-email-jiewen.yao@intel.com> Subject: [edk2] [PATCH V2 4/6] SecurityPkg/PlatformPasswordLibNull: Add PlatformPasswordLib instance. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chao Zhang , Qin Long MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This lib instance is to return if the password is cleared based upon PCD. Cc: Qin Long Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao Reviewed-by: Qin Long --- SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c | = 84 ++++++++++++++++++++ SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.inf | = 44 ++++++++++ SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.uni | = 24 ++++++ 3 files changed, 152 insertions(+) diff --git a/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLi= bNull.c b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNu= ll.c new file mode 100644 index 0000000..9722607 --- /dev/null +++ b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.c @@ -0,0 +1,84 @@ +/** @file + NULL PlatformPasswordLib instance does NOT really detect whether the pas= sword is cleared + but returns the PCD value directly. This instance can be used to verify = security + related features during platform enabling and development. It should be = replaced + by a platform-specific method(e.g. Button pressed) in a real platform fo= r product. + +Copyright (c) 2017, Intel Corporation. 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 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. + +**/ + +BOOLEAN mPasswordCleared =3D FALSE; + +/** + This function is called at password driver entrypoint. + This function should be called only once, to clear the password. + + This function provides a way to reset the password, just in case + the platform owner forgets the password. + The platform should provide a secure way to make sure + only the platform owner is allowed to clear password. + + Once the password is cleared, the platform should provide a way + to set a new password. + + @retval TRUE There is a platform request to clear the password. + @retval FALSE There is no platform request to clear the password. +**/ +BOOLEAN +EFIAPI +IsPasswordCleared ( + VOID + ) +{ + return mPasswordCleared; +} + +/** + This function is called if the password driver finds that the password i= s not enrolled, + when the password is required to input. + + This function should return the action accroding to platform policy. + + @retval TRUE The caller should force the user to enroll the password. + @retval FALSE The caller may skip the password enroll. +**/ +BOOLEAN +EFIAPI +NeedEnrollPassword ( + VOID + ) +{ + return FALSE; +} + + +/** + Save password clear state from a PCD to mPasswordCleared. + + @param ImageHandle ImageHandle of the loaded driver. + @param SystemTable Pointer to the EFI System Table. + + @retval EFI_SUCCESS PcdPasswordCleared is got successfully. + +**/ +EFI_STATUS +EFIAPI +PlatformPasswordLibNullConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + mPasswordCleared =3D PcdGetBool(PcdPasswordCleared); + + return EFI_SUCCESS; +} + diff --git a/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLi= bNull.inf b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLib= Null.inf new file mode 100644 index 0000000..74e9bda --- /dev/null +++ b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.i= nf @@ -0,0 +1,44 @@ +## @file +# NULL platform password library instance that returns the password clear= state based upon PCD. +# +# NULL PlatformPasswordLib instance does NOT really detect whether the pa= ssword is cleared +# but returns the PCD value directly. This instance can be used to verify= security +# related features during platform enabling and development. It should be= replaced +# by a platform-specific method(e.g. Button pressed) in a real platform f= or product. +# +# Copyright (c) 2017, Intel Corporation. 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 be= found at +# http://opensource.org/licenses/bsd-license.php +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010006 + BASE_NAME =3D PlatformPasswordLibNull + MODULE_UNI_FILE =3D PlatformPasswordLibNull.uni + FILE_GUID =3D 27417BCA-0CCD-4089-9711-AD069A33C555 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PlatformPasswordLib|DXE_RUNTIME_DRIVE= R DXE_SMM_DRIVER DXE_DRIVER + CONSTRUCTOR =3D PlatformPasswordLibNullConstructor + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + PlatformPasswordLibNull.c + +[Packages] + MdePkg/MdePkg.dec + SecurityPkg/SecurityPkg.dec + +[Pcd] + gEfiSecurityPkgTokenSpaceGuid.PcdPasswordCleared ## CONSUMES + diff --git a/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLi= bNull.uni b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLib= Null.uni new file mode 100644 index 0000000..5369ac5 --- /dev/null +++ b/SecurityPkg/Library/PlatformPasswordLibNull/PlatformPasswordLibNull.u= ni @@ -0,0 +1,24 @@ +// /** @file +// NULL platform password library instance that returns the password clear= state based upon PCD. +// +// NULL PlatformPasswordLib instance does NOT really detect whether the pa= ssword is cleared +// but returns the PCD value directly. This instance can be used to verify= security +// related features during platform enabling and development. It should be= replaced +// by a platform-specific method(e.g. Button pressed) in a real platform f= or product. +// +// Copyright (c) 2017, Intel Corporation. All rights reserved.
+// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the B= SD License +// which accompanies this distribution. The full text of the license may b= e found at +// http://opensource.org/licenses/bsd-license.php +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "NULL platform pas= sword library instance that returns the password clear state based upon PCD= ." + +#string STR_MODULE_DESCRIPTION #language en-US "NULL PlatformPass= wordLib instance does NOT really detect whether the password is cleared but= returns the PCD value directly. This instance can be used to verify securi= ty related features during platform enabling and development. It should be = replaced by a platform-specific method(e.g. Button pressed) in a real platf= orm for product." + --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel