From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.14178.1667720143243526126 for ; Sun, 06 Nov 2022 00:35:44 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=NRSS8eHx; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: judah.vang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667720144; x=1699256144; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=goJhakrgDxbT4Ekf7Ic6b/cQKP43IBQ22x0iu64UI10=; b=NRSS8eHxwMuipUKXRn/jLuRvJ/9QlAC54Wgi/FbK+A5L4ZsT4z4GVEpj zyOYbf6dH5HPaPBlbyLyc2D1PfDAgK07hGYYbHT0ievzGQdhyK1S+6Gf9 mKX/9tonZg+T4xCJ7EF5/jVTOFzyoStNcu3OOo/ec3MJhBvT8zcv9LVph ma8N9fP8lCtYFintZoy3toz9hH6pyJh+I5cYm1dE1l1B9/r6kRKcFTYDb 8U2fm1ix5UhlyItIw2Bz+bLlCEgQIssXOuxgpKX2op6NZQRj/+C8BJOzf NjWTl8HBgbgqIpRH4SxIfI3DdeFpKFB1LJYmG4kVPhblOgusswSGwLu+u A==; X-IronPort-AV: E=McAfee;i="6500,9779,10522"; a="396534278" X-IronPort-AV: E=Sophos;i="5.96,142,1665471600"; d="scan'208";a="396534278" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2022 00:35:32 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10522"; a="810513479" X-IronPort-AV: E=Sophos;i="5.96,142,1665471600"; d="scan'208";a="810513479" Received: from jvang-mobl.amr.corp.intel.com ([10.209.139.244]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2022 00:35:31 -0700 From: "Judah Vang" To: devel@edk2.groups.io Cc: Jian J Wang , Jiewen Yao , Nishant C Mistry Subject: [PATCH v5 15/19] SecurityPkg: Add null encryption variable libs Date: Sun, 6 Nov 2022 00:35:05 -0700 Message-Id: <20221106073509.3071-16-judah.vang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20221106073509.3071-1-judah.vang@intel.com> References: <20221106073509.3071-1-judah.vang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2594 V4: Applied code review - Remove empty Guids section from .inf file. Update description in *.c. Remove *.uni file and reference to it. V1: 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.inf | 34 ++++++++ SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c | 92 ++++++++++++++++++++ 2 files changed, 126 insertions(+) diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf new file mode 100644 index 000000000000..185b6f9bedf7 --- /dev/null +++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariableLibNull.inf @@ -0,0 +1,34 @@ +## @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 = 0x00010005 + BASE_NAME = EncryptionVariableLibNull + 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 diff --git a/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c new file mode 100644 index 000000000000..52ee8a7b5aae --- /dev/null +++ b/SecurityPkg/Library/EncryptionVariableLibNull/EncryptionVariable.c @@ -0,0 +1,92 @@ +/** @file + NULL implementation of EncryptionVariableLib. + +Copyright (c) 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; +} -- 2.35.1.windows.2