]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Security2.h
MdePkg: Add definition for new warning code EFI_WARN_FILE_SYSTEM.
[mirror_edk2.git] / MdePkg / Include / Protocol / Security2.h
1 /** @file
2 Security2 Architectural Protocol as defined in PI Specification1.2.1 VOLUME 2 DXE
3
4 Abstracts security-specific functions from the DXE Foundation of UEFI Image Verification,
5 Trusted Computing Group (TCG) measured boot, and User Identity policy for image loading and
6 consoles. This protocol must be produced by a boot service or runtime DXE driver.
7
8 This protocol is optional and must be published prior to the EFI_SECURITY_ARCH_PROTOCOL.
9 As a result, the same driver must publish both of these interfaces.
10
11 When both Security and Security2 Architectural Protocols are published, LoadImage must use
12 them in accordance with the following rules:
13 The Security2 protocol must be used on every image being loaded.
14 The Security protocol must be used after the Securiy2 protocol and only on images that
15 have been read using Firmware Volume protocol.
16
17 When only Security architectural protocol is published, LoadImage must use it on every image
18 being loaded.
19
20 Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
21 This program and the accompanying materials
22 are licensed and made available under the terms and conditions of the BSD License
23 which accompanies this distribution. The full text of the license may be found at
24 http://opensource.org/licenses/bsd-license.php
25
26 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
27 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
28
29 **/
30
31 #ifndef __ARCH_PROTOCOL_SECURITY2_H__
32 #define __ARCH_PROTOCOL_SECURITY2_H__
33
34 ///
35 /// Global ID for the Security2 Code Architectural Protocol
36 ///
37 #define EFI_SECURITY2_ARCH_PROTOCOL_GUID \
38 { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }
39
40 typedef struct _EFI_SECURITY2_ARCH_PROTOCOL EFI_SECURITY2_ARCH_PROTOCOL;
41
42 /**
43 The DXE Foundation uses this service to measure and/or verify a UEFI image.
44
45 This service abstracts the invocation of Trusted Computing Group (TCG) measured boot, UEFI
46 Secure boot, and UEFI User Identity infrastructure. For the former two, the DXE Foundation
47 invokes the FileAuthentication() with a DevicePath and corresponding image in
48 FileBuffer memory. The TCG measurement code will record the FileBuffer contents into the
49 appropriate PCR. The image verification logic will confirm the integrity and provenance of the
50 image in FileBuffer of length FileSize . The origin of the image will be DevicePath in
51 these cases.
52 If the FileBuffer is NULL, the interface will determine if the DevicePath can be connected
53 in order to support the User Identification policy.
54
55 @param This The EFI_SECURITY2_ARCH_PROTOCOL instance.
56 @param File A pointer to the device path of the file that is
57 being dispatched. This will optionally be used for logging.
58 @param FileBuffer A pointer to the buffer with the UEFI file image.
59 @param FileSize The size of the file.
60 @param BootPolicy A boot policy that was used to call LoadImage() UEFI service. If
61 FileAuthentication() is invoked not from the LoadImage(),
62 BootPolicy must be set to FALSE.
63
64 @retval EFI_SUCCESS The file specified by DevicePath and non-NULL
65 FileBuffer did authenticate, and the platform policy dictates
66 that the DXE Foundation may use the file.
67 @retval EFI_SUCCESS The device path specified by NULL device path DevicePath
68 and non-NULL FileBuffer did authenticate, and the platform
69 policy dictates that the DXE Foundation may execute the image in
70 FileBuffer.
71 @retval EFI_SUCCESS FileBuffer is NULL and current user has permission to start
72 UEFI device drivers on the device path specified by DevicePath.
73 @retval EFI_SECURITY_VIOLATION The file specified by DevicePath and FileBuffer did not
74 authenticate, and the platform policy dictates that the file should be
75 placed in the untrusted state. The image has been added to the file
76 execution table.
77 @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
78 authenticate, and the platform policy dictates that the DXE
79 Foundation may not use File.
80 @retval EFI_SECURITY_VIOLATION FileBuffer is NULL and the user has no
81 permission to start UEFI device drivers on the device path specified
82 by DevicePath.
83 @retval EFI_SECURITY_VIOLATION FileBuffer is not NULL and the user has no permission to load
84 drivers from the device path specified by DevicePath. The
85 image has been added into the list of the deferred images.
86 **/
87 typedef EFI_STATUS (EFIAPI *EFI_SECURITY2_FILE_AUTHENTICATION) (
88 IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This,
89 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
90 IN VOID *FileBuffer,
91 IN UINTN FileSize,
92 IN BOOLEAN BootPolicy
93 );
94
95 ///
96 /// The EFI_SECURITY2_ARCH_PROTOCOL is used to abstract platform-specific policy from the
97 /// DXE Foundation. This includes measuring the PE/COFF image prior to invoking, comparing the
98 /// image against a policy (whether a white-list/black-list of public image verification keys
99 /// or registered hashes).
100 ///
101 struct _EFI_SECURITY2_ARCH_PROTOCOL {
102 EFI_SECURITY2_FILE_AUTHENTICATION FileAuthentication;
103 };
104
105 extern EFI_GUID gEfiSecurity2ArchProtocolGuid;
106
107 #endif