]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add PI1.2.1 SAP2 support and UEFI231B mantis 896
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 22 Aug 2012 01:30:23 +0000 (01:30 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 22 Aug 2012 01:30:23 +0000 (01:30 +0000)
1. Add SAP2 protocol definition in MdePkg

Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Guo Dong <dong.guo@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13658 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Protocol/Security2.h [new file with mode: 0644]
MdePkg/Include/Uefi/UefiSpec.h
MdePkg/MdePkg.dec

diff --git a/MdePkg/Include/Protocol/Security2.h b/MdePkg/Include/Protocol/Security2.h
new file mode 100644 (file)
index 0000000..d282837
--- /dev/null
@@ -0,0 +1,107 @@
+/** @file\r
+  Security2 Architectural Protocol as defined in PI Specification1.2.1 VOLUME 2 DXE\r
+\r
+  Abstracts security-specific functions from the DXE Foundation of UEFI Image Verification,\r
+  Trusted Computing Group (TCG) measured boot, and User Identity policy for image loading and\r
+  consoles. This protocol must be produced by a boot service or runtime DXE driver.\r
+  \r
+  This protocol is optional and must be published prior to the EFI_SECURITY_ARCH_PROTOCOL.\r
+  As a result, the same driver must publish both of these interfaces.\r
+  \r
+  When both Security and Security2 Architectural Protocols are published, LoadImage must use\r
+  them in accordance with the following rules:\r
+    The Security2 protocol must be used on every image being loaded.\r
+    The Security protocol must be used after the Securiy2 protocol and only on images that \r
+    have been read using Firmware Volume protocol.\r
+\r
+  When only Security architectural protocol is published, LoadImage must use it on every image\r
+  being loaded.\r
+\r
+  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+**/\r
+\r
+#ifndef __ARCH_PROTOCOL_SECURITY2_H__\r
+#define __ARCH_PROTOCOL_SECURITY2_H__\r
+\r
+///\r
+/// Global ID for the Security2 Code Architectural Protocol\r
+///\r
+#define EFI_SECURITY2_ARCH_PROTOCOL_GUID \\r
+  { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }\r
+  \r
+typedef struct _EFI_SECURITY2_ARCH_PROTOCOL    EFI_SECURITY2_ARCH_PROTOCOL;\r
+\r
+/**\r
+  The DXE Foundation uses this service to measure and/or verify a UEFI image.\r
+\r
+  This service abstracts the invocation of Trusted Computing Group (TCG) measured boot, UEFI\r
+  Secure boot, and UEFI User Identity infrastructure. For the former two, the DXE Foundation\r
+  invokes the FileAuthentication() with a DevicePath and corresponding image in\r
+  FileBuffer memory. The TCG measurement code will record the FileBuffer contents into the\r
+  appropriate PCR. The image verification logic will confirm the integrity and provenance of the\r
+  image in FileBuffer of length FileSize . The origin of the image will be DevicePath in\r
+  these cases.\r
+  If the FileBuffer is NULL, the interface will determine if the DevicePath can be connected\r
+  in order to support the User Identification policy.\r
+  \r
+  @param  This             The EFI_SECURITY2_ARCH_PROTOCOL instance.\r
+  @param  File             A pointer to the device path of the file that is\r
+                           being dispatched. This will optionally be used for logging.\r
+  @param  FileBuffer       A pointer to the buffer with the UEFI file image.\r
+  @param  FileSize         The size of the file.\r
+  @param  BootPolicy       A boot policy that was used to call LoadImage() UEFI service. If\r
+                           FileAuthentication() is invoked not from the LoadImage(),\r
+                           BootPolicy must be set to FALSE.\r
+  \r
+  @retval EFI_SUCCESS             The file specified by DevicePath and non-NULL\r
+                                  FileBuffer did authenticate, and the platform policy dictates\r
+                                  that the DXE Foundation may use the file.\r
+  @retval EFI_SUCCESS             The device path specified by NULL device path DevicePath\r
+                                  and non-NULL FileBuffer did authenticate, and the platform\r
+                                  policy dictates that the DXE Foundation may execute the image in\r
+                                  FileBuffer.\r
+  @retval EFI_SUCCESS             FileBuffer is NULL and current user has permission to start\r
+                                  UEFI device drivers on the device path specified by DevicePath.\r
+  @retval EFI_SECURITY_VIOLATION  The file specified by DevicePath and FileBuffer did not\r
+                                  authenticate, and the platform policy dictates that the file should be\r
+                                  placed in the untrusted state. The image has been added to the file\r
+                                  execution table.\r
+  @retval EFI_ACCESS_DENIED       The file specified by File and FileBuffer did not\r
+                                  authenticate, and the platform policy dictates that the DXE\r
+                                  Foundation may not use File.\r
+  @retval EFI_SECURITY_VIOLATION  FileBuffer is NULL and the user has no\r
+                                  permission to start UEFI device drivers on the device path specified\r
+                                  by DevicePath.\r
+  @retval EFI_SECURITY_VIOLATION  FileBuffer is not NULL and the user has no permission to load\r
+                                  drivers from the device path specified by DevicePath. The\r
+                                  image has been added into the list of the deferred images.\r
+**/\r
+typedef EFI_STATUS (EFIAPI *EFI_SECURITY2_FILE_AUTHENTICATION) (  \r
+  IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This,\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL    *DevicePath,\r
+  IN VOID                              *FileBuffer,\r
+  IN UINTN                             FileSize,\r
+  IN BOOLEAN                           BootPolicy\r
+);\r
+\r
+///\r
+/// The EFI_SECURITY2_ARCH_PROTOCOL is used to abstract platform-specific policy from the\r
+/// DXE Foundation. This includes measuring the PE/COFF image prior to invoking, comparing the\r
+/// image against a policy (whether a white-list/black-list of public image verification keys\r
+/// or registered hashes).\r
+///\r
+struct _EFI_SECURITY2_ARCH_PROTOCOL {\r
+  EFI_SECURITY2_FILE_AUTHENTICATION FileAuthentication;\r
+};\r
+\r
+extern EFI_GUID gEfiSecurity2ArchProtocolGuid;\r
+\r
+#endif\r
index f3896938454c94e1f5e036e696b150850fb67c58..ffdfcd6398ea573ef6fd5a16de9f525cf2cad7f0 100644 (file)
@@ -281,7 +281,9 @@ EFI_STATUS
   @retval EFI_NOT_FOUND         1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
                                 present in the system.\r
                                 2) No drivers were connected to ControllerHandle.\r
   @retval EFI_NOT_FOUND         1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
                                 present in the system.\r
                                 2) No drivers were connected to ControllerHandle.\r
-\r
+  @retval EFI_SECURITY_VIOLATION \r
+                                The user has no permission to start UEFI device drivers on the device path \r
+                                associated with the ControllerHandle or specified by the RemainingDevicePath.\r
 **/\r
 typedef\r
 EFI_STATUS\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -848,8 +850,9 @@ EFI_STATUS
   @param  ExitData              The pointer to a pointer to a data buffer that includes a Null-terminated\r
                                 string, optionally followed by additional binary data.\r
 \r
   @param  ExitData              The pointer to a pointer to a data buffer that includes a Null-terminated\r
                                 string, optionally followed by additional binary data.\r
 \r
-  @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image\r
-                                has already been initialized with StartImage.\r
+  @retval EFI_INVALID_PARAMETER  ImageHandle is either an invalid image handle or the image\r
+                                 has already been initialized with StartImage.\r
+  @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
   @return Exit code from image\r
 \r
 **/\r
   @return Exit code from image\r
 \r
 **/\r
index 59b7ac4838d8c8d715b39c04c4d8765a825d2923..b29cb01c27cefcabb83472a96e943e3f488ddd4b 100644 (file)
   gEfiExtendedSalCacheServicesProtocolGuid = { 0xedc9494, 0x2743, 0x4ba5, { 0x88, 0x18, 0x0a, 0xef, 0x52, 0x13, 0xf1, 0x88 } }\r
   gEfiExtendedSalMcaLogServicesProtocolGuid = { 0xcb3fd86e, 0x38a3, 0x4c03, {0x9a, 0x5c, 0x90, 0xcf, 0xa3, 0xa2, 0xab, 0x7a } }\r
 \r
   gEfiExtendedSalCacheServicesProtocolGuid = { 0xedc9494, 0x2743, 0x4ba5, { 0x88, 0x18, 0x0a, 0xef, 0x52, 0x13, 0xf1, 0x88 } }\r
   gEfiExtendedSalMcaLogServicesProtocolGuid = { 0xcb3fd86e, 0x38a3, 0x4c03, {0x9a, 0x5c, 0x90, 0xcf, 0xa3, 0xa2, 0xab, 0x7a } }\r
 \r
+  #\r
+  # Protocols defined in PI1.2.1\r
+  #\r
+  ## Include/Protocol/Security2.h\r
+  gEfiSecurity2ArchProtocolGuid   = { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }\r
+\r
   #\r
   # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1\r
   #\r
   #\r
   # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1\r
   #\r