]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
Remove package dependency of IntelFrameworkPkg
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / SecurityStub.c
CommitLineData
ce2f5557 1/** @file\r
2 This driver supports platform security service.\r
3 \r
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
9\r
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
14\r
15\r
16#include "SecurityStub.h"\r
17\r
18//\r
19// Handle for the Security Architectural Protocol instance produced by this driver\r
20//\r
21EFI_HANDLE mSecurityArchProtocolHandle = NULL;\r
22\r
23//\r
24// Security Architectural Protocol instance produced by this driver\r
25//\r
26EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = { \r
27 SecurityStubAuthenticateState \r
28};\r
29\r
30\r
31/**\r
32 The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
33 policy from the DXE core response to an attempt to use a file that returns a \r
34 given status for the authentication check from the section extraction protocol. \r
35\r
36 The possible responses in a given SAP implementation may include locking \r
37 flash upon failure to authenticate, attestation logging for all signed drivers, \r
38 and other exception operations. The File parameter allows for possible logging \r
39 within the SAP of the driver.\r
40\r
41 If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
42\r
43 If the file specified by File with an authentication status specified by \r
44 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r
45\r
46 If the file specified by File with an authentication status specified by \r
47 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r
48 then EFI_ACCESS_DENIED is returned.\r
49\r
50 If the file specified by File with an authentication status specified by \r
51 AuthenticationStatus is not safe for the DXE Core to use right now, but it \r
52 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
53 returned.\r
54\r
55 @param This The EFI_SECURITY_ARCH_PROTOCOL instance.\r
56 @param AuthenticationStatus \r
57 This is the authentication type returned from the Section\r
58 Extraction protocol. See the Section Extraction Protocol\r
59 Specification for details on this type.\r
60 @param File This is a pointer to the device path of the file that is\r
61 being dispatched. This will optionally be used for logging.\r
62\r
63 @retval EFI_SUCCESS The file specified by File did authenticate, and the\r
64 platform policy dictates that the DXE Core may use File.\r
65 @retval EFI_INVALID_PARAMETER Driver is NULL.\r
66 @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
67 the platform policy dictates that File should be placed\r
68 in the untrusted state. A file may be promoted from\r
69 the untrusted to the trusted state at a future time\r
70 with a call to the Trust() DXE Service.\r
71 @retval EFI_ACCESS_DENIED The file specified by File did not authenticate, and\r
72 the platform policy dictates that File should not be\r
73 used for any purpose.\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78SecurityStubAuthenticateState (\r
79 IN EFI_SECURITY_ARCH_PROTOCOL *This,\r
80 IN UINT32 AuthenticationStatus,\r
81 IN EFI_DEVICE_PATH_PROTOCOL *File\r
82 )\r
83{\r
84 if (File == NULL) {\r
85 return EFI_INVALID_PARAMETER;\r
86 }\r
87\r
88 return EFI_SUCCESS;\r
89}\r
90\r
91\r
92/**\r
93 The user Entry Point for DXE driver. The user code starts with this function\r
94 as the real entry point for the image goes into a library that calls this \r
95 function.\r
96\r
97 @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
98 @param[in] SystemTable A pointer to the EFI System Table.\r
99 \r
100 @retval EFI_SUCCESS The entry point is executed successfully.\r
101 @retval other Some error occurs when executing this entry point.\r
102\r
103**/\r
104EFI_STATUS\r
105EFIAPI\r
106SecurityStubInitialize (\r
107 IN EFI_HANDLE ImageHandle,\r
108 IN EFI_SYSTEM_TABLE *SystemTable\r
109 )\r
110{\r
111 EFI_STATUS Status;\r
112\r
113 //\r
114 // Make sure the Security Architectural Protocol is not already installed in the system\r
115 //\r
116 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);\r
117\r
118 //\r
119 // Install the Security Architectural Protocol onto a new handle\r
120 //\r
121 Status = gBS->InstallMultipleProtocolInterfaces (\r
122 &mSecurityArchProtocolHandle,\r
123 &gEfiSecurityArchProtocolGuid,\r
124 &mSecurityStub,\r
125 NULL\r
126 );\r
127 ASSERT_EFI_ERROR (Status);\r
128\r
129 return Status;\r
130}\r