From nobody Fri Apr 26 19:58:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+89430+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+89430+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1651255522; cv=none; d=zohomail.com; s=zohoarc; b=GMgfBruSlW4UyQwM/YWxvxt+cvVCwM6ZUVtzs3L9DLfyy1TZ/GCp9rJdNE9iUqxXqQ2DOQ55I1ZALMb/+dJF4CZTkHAWnEi6alevOWanrg8J3QMK/gyr3JNqtGWfmy4WdX2flCyvcilNWR5/BLGBy2QkxPIhls6SAgGUfDuKeX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651255522; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=W/uVJLyqHpxzi2d8Ms3QG2OXemG8TYEkmCkc7RTJUUE=; b=TFMFJwmwNGsiHVqistakDr6B8VjxFvKR77gl9/EBImsHmmnzmNdVEN/6LnbGqmpzoHg3Cl0vxhHe1O0UMyRaUrNQh8MpVIyJo2ZVO4a32Ct/gWRIVLgzzwsLZMciQkIVvDikkNlVQoWNaQUloySWBIa58FymSvEwROuTHFJX5Uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+89430+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1651255522478753.7649604286128; Fri, 29 Apr 2022 11:05:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bjErYY1788612x3DSZ8OxMgi; Fri, 29 Apr 2022 11:05:22 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.13472.1651255521036807512 for ; Fri, 29 Apr 2022 11:05:21 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10332"; a="266550638" X-IronPort-AV: E=Sophos;i="5.91,186,1647327600"; d="scan'208";a="266550638" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 11:05:19 -0700 X-IronPort-AV: E=Sophos;i="5.91,186,1647327600"; d="scan'208";a="514955727" X-Received: from jvang-mobl.amr.corp.intel.com ([10.212.198.238]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2022 11:05:19 -0700 From: "Judah Vang" To: devel@edk2.groups.io Cc: Jian J Wang , Jiewen Yao , Nishant C Mistry Subject: [edk2-devel] [Patch v2 14/28] SecurityPkg: Add null encryption variable libs Date: Fri, 29 Apr 2022 11:04:16 -0700 Message-Id: <20220429180430.3292-15-judah.vang@intel.com> In-Reply-To: <20220429180430.3292-1-judah.vang@intel.com> References: <20220429180430.3292-1-judah.vang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,judah.vang@intel.com X-Gm-Message-State: fWnRdVUYPosLBDI7TwKYAq8xx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1651255522; bh=4/E8O+zeFGmBizFLLoU5o4VHX8Ps10msuMe6W0F0zPQ=; h=Cc:Date:From:Reply-To:Subject:To; b=GZkLNOafqbtViySeEdelxBvLXcWXynArW6lvcaeOVtmg4TZFDTC7CbPz8daFDoOpGc2 2+FwVi774t+bqvVat626/Bud25/HJ85tbpTDSFVc28ayOHWojXj/oLWSQ86U1qgtkqGNw Fa8O/O+PgyHwEi0wuJ4YbAOIcKfdmkBslg4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1651255522840100022 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2594 Provide null ecryption variable libraries. These will be used by default for platforms that don't support protected variable encryption. Cc: Jian J Wang Cc: Jiewen Yao Cc: Nishant C Mistry Signed-off-by: Jian J Wang Signed-off-by: Nishant C Mistry Signed-off-by: Judah Vang --- SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.in= f | 38 +++++++ SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c = | 107 ++++++++++++++++++++ SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.un= i | 16 +++ 3 files changed, 161 insertions(+) diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariab= leLibNull.inf b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVar= iableLibNull.inf new file mode 100644 index 000000000000..ff5631b336eb --- /dev/null +++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNu= ll.inf @@ -0,0 +1,38 @@ +## @file +# Provides NULL version of encryption variable services. +# +# Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D EncryptionVariableLibNull + MODULE_UNI_FILE =3D EncryptionVariableLib.uni + FILE_GUID =3D 3972E6FE-74D5-45C3-A9FB-DB9E5E5C9C17 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D EncryptionVariableLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + EncryptionVariable.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + SecurityPkg/SecurityPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + +[Guids] + diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariab= le.c b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c new file mode 100644 index 000000000000..58a4ae9f4282 --- /dev/null +++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c @@ -0,0 +1,107 @@ +/** @file + The common variable operation routines shared by DXE_RUNTIME variable + module and DXE_SMM variable module. + + Caution: This module requires additional review when modified. + This driver will have external input - variable data. They may be input = in SMM mode. + This external input must be validated carefully to avoid security issue = like + buffer overflow, integer overflow. + + VariableServiceGetNextVariableName () and VariableServiceQueryVariableIn= fo() are external API. + They need check input parameter. + + VariableServiceGetVariable() and VariableServiceSetVariable() are extern= al API + to receive datasize and data buffer. The size should be checked carefull= y. + + VariableServiceSetVariable() should also check authenticate data to avoi= d buffer overflow, + integer overflow. It should also check attribute to avoid authentication= bypass. + +Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include + +/** + Encrypt variable data. + + Null version. + + @param[in, out] VarEncInfo Pointer to structure containing detailed + information about a variable. + + @retval EFI_UNSUPPORTED Unsupported to encrypt variable. + +**/ +EFI_STATUS +EFIAPI +EncryptVariable ( + IN OUT VARIABLE_ENCRYPTION_INFO *VarEncInfo + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Decrypt variable data. + + Null version. + + @param[in, out] VarEncInfo Pointer to structure containing detailed + information about a variable. + + @retval EFI_UNSUPPORTED Unsupported to encrypt variable. + +**/ +EFI_STATUS +EFIAPI +DecryptVariable ( + IN OUT VARIABLE_ENCRYPTION_INFO *VarEncInfo + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Get cipher information. + + Null version. + + @param[in] VarEncInfo Pointer to structure containing detailed + information about a variable. + + @retval EFI_UNSUPPORTED Unsupported interface. + +**/ +EFI_STATUS +EFIAPI +GetCipherDataInfo ( + IN VARIABLE_ENCRYPTION_INFO *VarEncInfo + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Set cipher information for a variable. + + Null version. + + @param[in] VarEncInfo Pointer to structure containing detailed + information about a variable. + + @retval EFI_UNSUPPORTED If this method is not supported. + +**/ +EFI_STATUS +EFIAPI +SetCipherDataInfo ( + IN VARIABLE_ENCRYPTION_INFO *VarEncInfo + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariab= leLibNull.uni b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVar= iableLibNull.uni new file mode 100644 index 000000000000..856fa201b8df --- /dev/null +++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNu= ll.uni @@ -0,0 +1,16 @@ +// /** @file +// Provides authenticated variable services. +// +// Provides authenticated variable services. +// +// Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Provides authenti= cated variable services" + +#string STR_MODULE_DESCRIPTION #language en-US "Provides authenti= cated variable services." + --=20 2.35.1.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#89430): https://edk2.groups.io/g/devel/message/89430 Mute This Topic: https://groups.io/mt/90781898/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-