public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Judah Vang" <judah.vang@intel.com>
To: devel@edk2.groups.io
Cc: Judah Vang <judah.vang@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Nishant C Mistry <nishant.c.mistry@intel.com>
Subject: [PATCH v1 14/28] SecurityPkg: Add null encryption variable libs
Date: Fri, 25 Mar 2022 16:28:11 -0700	[thread overview]
Message-ID: <20220325232825.2167-10-judah.vang@intel.com> (raw)
In-Reply-To: <20220325232825.2167-1-judah.vang@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2594

Provide null ecryption variable libraries.
These will be used by default.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Nishant C Mistry <nishant.c.mistry@intel.com>
Signed-off-by: Judah Vang <judah.vang@intel.com>
---
 SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf |  38 +++++++
 SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c          | 107 ++++++++++++++++++++
 SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.uni |  16 +++
 3 files changed, 161 insertions(+)

diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf
new file mode 100644
index 000000000000..ff5631b336eb
--- /dev/null
+++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf
@@ -0,0 +1,38 @@
+## @file
+#  Provides NULL version of encryption variable services.
+#
+#  Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = EncryptionVariableLibNull
+  MODULE_UNI_FILE                = EncryptionVariableLib.uni
+  FILE_GUID                      = 3972E6FE-74D5-45C3-A9FB-DB9E5E5C9C17
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = EncryptionVariableLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = 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/EncryptionVariable.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 VariableServiceQueryVariableInfo() are external API.
+  They need check input parameter.
+
+  VariableServiceGetVariable() and VariableServiceSetVariable() are external API
+  to receive datasize and data buffer. The size should be checked carefully.
+
+  VariableServiceSetVariable() should also check authenticate data to avoid buffer overflow,
+  integer overflow. It should also check attribute to avoid authentication bypass.
+
+Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+#include <Library/EncryptionVariableLib.h>
+#include <Library/DebugLib.h>
+
+/**
+  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/EncryptionVariableLibNull.uni b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.uni
new file mode 100644
index 000000000000..856fa201b8df
--- /dev/null
+++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.uni
@@ -0,0 +1,16 @@
+// /** @file
+// Provides authenticated variable services.
+//
+// Provides authenticated variable services.
+//
+// Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT             #language en-US "Provides authenticated variable services"
+
+#string STR_MODULE_DESCRIPTION          #language en-US "Provides authenticated variable services."
+
-- 
2.26.2.windows.1


  parent reply	other threads:[~2022-03-25 23:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 23:28 [PATCH v1 05/28] MdeModulePkg: Add new ProtectedVariable GUIDs Judah Vang
2022-03-25 23:28 ` [PATCH v1 06/28] MdeModulePkg: Add new include files Judah Vang
2022-03-25 23:28 ` [PATCH v1 07/28] MdeModulePkg: Add Null ProtectedVariable Library Judah Vang
2022-03-25 23:28 ` [PATCH v1 08/28] MdeModulePkg: Add new Variable functionality Judah Vang
2022-03-25 23:28 ` [PATCH v1 09/28] MdeModulePkg: Add support for Protected Variables Judah Vang
2022-03-25 23:28 ` [PATCH v1 10/28] SecurityPkg: Add new KeyService types and defines Judah Vang
2022-03-25 23:28 ` [PATCH v1 11/28] SecurityPkg: Update RPMC APIs with index Judah Vang
2022-03-25 23:28 ` [PATCH v1 12/28] SecurityPkg: Add new variable types and functions Judah Vang
2022-03-25 23:28 ` [PATCH v1 13/28] SecurityPkg: Fix GetVariableKey API Judah Vang
2022-03-25 23:28 ` Judah Vang [this message]
2022-03-25 23:28 ` [PATCH v1 15/28] SecurityPkg: Add VariableKey library function Judah Vang
2022-03-25 23:28 ` [PATCH v1 16/28] SecurityPkg: Add EncryptionVariable lib with AES Judah Vang
2022-03-25 23:28 ` [PATCH v1 17/28] SecurityPkg: Add Protected Variable Services Judah Vang
2022-03-25 23:28 ` [PATCH v1 18/28] MdeModulePkg: Reference Null ProtectedVariableLib Judah Vang
2022-03-25 23:28 ` [PATCH v1 19/28] SecurityPkg: Add references to new *.inf files Judah Vang
2022-03-25 23:28 ` [PATCH v1 20/28] ArmVirtPkg: Add reference to ProtectedVariableNull Judah Vang
2022-03-25 23:28 ` [PATCH v1 21/28] UefiPayloadPkg: Add ProtectedVariable reference Judah Vang
2022-03-28  1:31   ` Ni, Ray
2022-03-25 23:28 ` [PATCH v1 22/28] EmulatorPkg: " Judah Vang
2022-03-28  1:30   ` Ni, Ray
2022-03-25 23:28 ` [PATCH v1 23/28] OvmfPkg: " Judah Vang
2022-03-25 23:28 ` [PATCH v1 24/28] OvmfPkg: Add ProtectedVariableLib reference Judah Vang
2022-03-25 23:28 ` [PATCH v1 25/28] " Judah Vang
2022-03-25 23:28 ` [PATCH v1 26/28] " Judah Vang
2022-03-25 23:28 ` [PATCH v1 27/28] OvmfPkg: Add ProtectedVariable reference Judah Vang
2022-03-28  7:42   ` Boeuf, Sebastien
2022-03-25 23:28 ` [PATCH v1 28/28] CryptoPkg: Enable cypto HMAC KDF library Judah Vang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220325232825.2167-10-judah.vang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox