]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
Code scrub for the following drivers and librarys.
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / SecurityStub.c
CommitLineData
ce2f5557 1/** @file\r
109e9a61 2 This driver implements a sample platform security service, which does \r
5d69642d 3 nothing and always return EFI_SUCCESS.\r
ce2f5557 4 \r
5d69642d 5 Copyright (c) 2006 - 2008, Intel Corporation \r
ce2f5557 6 All rights reserved. This program and the accompanying materials \r
7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14**/\r
15\r
16\r
109e9a61
LG
17#include <Uefi.h>\r
18#include <Protocol/Security.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/UefiBootServicesTableLib.h>\r
21#include <Library/UefiDriverEntryPoint.h>\r
ce2f5557 22\r
23//\r
24// Handle for the Security Architectural Protocol instance produced by this driver\r
25//\r
26EFI_HANDLE mSecurityArchProtocolHandle = NULL;\r
27\r
ce2f5557 28/**\r
29 The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
30 policy from the DXE core response to an attempt to use a file that returns a \r
31 given status for the authentication check from the section extraction protocol. \r
32\r
33 The possible responses in a given SAP implementation may include locking \r
34 flash upon failure to authenticate, attestation logging for all signed drivers, \r
35 and other exception operations. The File parameter allows for possible logging \r
36 within the SAP of the driver.\r
37\r
38 If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
39\r
40 If the file specified by File with an authentication status specified by \r
41 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r
42\r
43 If the file specified by File with an authentication status specified by \r
44 AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r
45 then EFI_ACCESS_DENIED is returned.\r
46\r
47 If the file specified by File with an authentication status specified by \r
48 AuthenticationStatus is not safe for the DXE Core to use right now, but it \r
49 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
50 returned.\r
51\r
52 @param This The EFI_SECURITY_ARCH_PROTOCOL instance.\r
53 @param AuthenticationStatus \r
54 This is the authentication type returned from the Section\r
55 Extraction protocol. See the Section Extraction Protocol\r
56 Specification for details on this type.\r
57 @param File This is a pointer to the device path of the file that is\r
58 being dispatched. This will optionally be used for logging.\r
59\r
109e9a61 60 @retval EFI_SUCCESS Do nothing and return success.\r
5d69642d 61 @retval EFI_INVALID_PARAMETER File is NULL.\r
ce2f5557 62**/\r
63EFI_STATUS\r
64EFIAPI\r
65SecurityStubAuthenticateState (\r
c48d41d2
LG
66 IN CONST EFI_SECURITY_ARCH_PROTOCOL *This,\r
67 IN UINT32 AuthenticationStatus,\r
68 IN CONST EFI_DEVICE_PATH_PROTOCOL *File\r
ce2f5557 69 )\r
70{\r
71 if (File == NULL) {\r
72 return EFI_INVALID_PARAMETER;\r
73 }\r
74\r
75 return EFI_SUCCESS;\r
76}\r
77\r
109e9a61
LG
78//\r
79// Security Architectural Protocol instance produced by this driver\r
80//\r
81EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = { \r
82 SecurityStubAuthenticateState \r
83};\r
ce2f5557 84\r
85/**\r
109e9a61 86 Installs Security Architectural Protocol.\r
ce2f5557 87\r
109e9a61
LG
88 @param ImageHandle The image handle of this driver.\r
89 @param SystemTable A pointer to the EFI System Table.\r
ce2f5557 90 \r
5d69642d 91 @retval EFI_SUCCESS Install the sample Security Architectural Protocol successfully.\r
ce2f5557 92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96SecurityStubInitialize (\r
97 IN EFI_HANDLE ImageHandle,\r
98 IN EFI_SYSTEM_TABLE *SystemTable\r
99 )\r
100{\r
101 EFI_STATUS Status;\r
102\r
103 //\r
104 // Make sure the Security Architectural Protocol is not already installed in the system\r
105 //\r
106 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);\r
107\r
108 //\r
109 // Install the Security Architectural Protocol onto a new handle\r
110 //\r
111 Status = gBS->InstallMultipleProtocolInterfaces (\r
112 &mSecurityArchProtocolHandle,\r
113 &gEfiSecurityArchProtocolGuid,\r
114 &mSecurityStub,\r
115 NULL\r
116 );\r
117 ASSERT_EFI_ERROR (Status);\r
118\r
5d69642d 119 return EFI_SUCCESS;\r
ce2f5557 120}\r