]>
Commit | Line | Data |
---|---|---|
b9575d60 A |
1 | /** @file\r |
2 | This driver supports platform security service.\r | |
79840ee1 | 3 | \r |
b9575d60 A |
4 | Copyright (c) 2006 - 2007, Intel Corporation \r |
5 | All rights reserved. This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
79840ee1 | 9 | \r |
b9575d60 A |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | **/\r | |
79840ee1 | 14 | \r |
79840ee1 | 15 | \r |
d8a43975 | 16 | //\r |
17 | // Include common header file for this module.\r | |
18 | //\r | |
19 | #include "CommonHeader.h"\r | |
20 | \r | |
79840ee1 | 21 | #include "SecurityStub.h"\r |
22 | \r | |
23 | //\r | |
24 | // Handle for the Security Architectural Protocol instance produced by this driver\r | |
25 | //\r | |
26 | EFI_HANDLE mSecurityArchProtocolHandle = NULL;\r | |
27 | \r | |
28 | //\r | |
29 | // Security Architectural Protocol instance produced by this driver\r | |
30 | //\r | |
31 | EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = { \r | |
32 | SecurityStubAuthenticateState \r | |
33 | };\r | |
34 | \r | |
79840ee1 | 35 | \r |
b9575d60 | 36 | /**\r |
79840ee1 | 37 | The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r |
38 | policy from the DXE core response to an attempt to use a file that returns a \r | |
39 | given status for the authentication check from the section extraction protocol. \r | |
40 | \r | |
41 | The possible responses in a given SAP implementation may include locking \r | |
42 | flash upon failure to authenticate, attestation logging for all signed drivers, \r | |
43 | and other exception operations. The File parameter allows for possible logging \r | |
44 | within the SAP of the driver.\r | |
45 | \r | |
46 | If File is NULL, then EFI_INVALID_PARAMETER is returned.\r | |
47 | \r | |
48 | If the file specified by File with an authentication status specified by \r | |
49 | AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r | |
50 | \r | |
51 | If the file specified by File with an authentication status specified by \r | |
52 | AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r | |
53 | then EFI_ACCESS_DENIED is returned.\r | |
54 | \r | |
55 | If the file specified by File with an authentication status specified by \r | |
56 | AuthenticationStatus is not safe for the DXE Core to use right now, but it \r | |
57 | might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r | |
58 | returned.\r | |
59 | \r | |
b9575d60 A |
60 | @param This The EFI_SECURITY_ARCH_PROTOCOL instance.\r |
61 | @param AuthenticationStatus \r | |
62 | This is the authentication type returned from the Section\r | |
63 | Extraction protocol. See the Section Extraction Protocol\r | |
64 | Specification for details on this type.\r | |
65 | @param File This is a pointer to the device path of the file that is\r | |
66 | being dispatched. This will optionally be used for logging.\r | |
67 | \r | |
68 | @retval EFI_SUCCESS The file specified by File did authenticate, and the\r | |
69 | platform policy dictates that the DXE Core may use File.\r | |
70 | @retval EFI_INVALID_PARAMETER Driver is NULL.\r | |
71 | @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r | |
72 | the platform policy dictates that File should be placed\r | |
73 | in the untrusted state. A file may be promoted from\r | |
74 | the untrusted to the trusted state at a future time\r | |
75 | with a call to the Trust() DXE Service.\r | |
76 | @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and\r | |
77 | the platform policy dictates that File should not be\r | |
78 | used for any purpose.\r | |
79 | \r | |
80 | **/\r | |
81 | EFI_STATUS\r | |
82 | EFIAPI\r | |
83 | SecurityStubAuthenticateState (\r | |
84 | IN EFI_SECURITY_ARCH_PROTOCOL *This,\r | |
85 | IN UINT32 AuthenticationStatus,\r | |
86 | IN EFI_DEVICE_PATH_PROTOCOL *File\r | |
87 | )\r | |
79840ee1 | 88 | {\r |
89 | if (File == NULL) {\r | |
90 | return EFI_INVALID_PARAMETER;\r | |
91 | }\r | |
92 | \r | |
93 | return EFI_SUCCESS;\r | |
94 | }\r | |
95 | \r | |
b9575d60 A |
96 | \r |
97 | /**\r | |
98 | The user Entry Point for DXE driver. The user code starts with this function\r | |
99 | as the real entry point for the image goes into a library that calls this \r | |
100 | function.\r | |
101 | \r | |
102 | @param[in] ImageHandle The firmware allocated handle for the EFI image. \r | |
103 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
104 | \r | |
105 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
106 | @retval other Some error occurs when executing this entry point.\r | |
107 | \r | |
108 | **/\r | |
79840ee1 | 109 | EFI_STATUS\r |
110 | EFIAPI\r | |
111 | SecurityStubInitialize (\r | |
112 | IN EFI_HANDLE ImageHandle,\r | |
113 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
114 | )\r | |
79840ee1 | 115 | {\r |
116 | EFI_STATUS Status;\r | |
117 | \r | |
118 | //\r | |
119 | // Make sure the Security Architectural Protocol is not already installed in the system\r | |
120 | //\r | |
121 | ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);\r | |
122 | \r | |
123 | //\r | |
124 | // Install the Security Architectural Protocol onto a new handle\r | |
125 | //\r | |
126 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
127 | &mSecurityArchProtocolHandle,\r | |
128 | &gEfiSecurityArchProtocolGuid,\r | |
129 | &mSecurityStub,\r | |
130 | NULL\r | |
131 | );\r | |
132 | ASSERT_EFI_ERROR (Status);\r | |
133 | \r | |
134 | return Status;\r | |
135 | }\r |