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