]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
Code scrub for the Capsule, SecurityStub, and Crc32 library instance.
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / SecurityStub.c
CommitLineData
ce2f5557 1/** @file\r
5d69642d
LG
2 This driver implements one sample platform security service, which does \r
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
17#include "SecurityStub.h"\r
18\r
19//\r
20// Handle for the Security Architectural Protocol instance produced by this driver\r
21//\r
22EFI_HANDLE mSecurityArchProtocolHandle = NULL;\r
23\r
24//\r
25// Security Architectural Protocol instance produced by this driver\r
26//\r
27EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = { \r
28 SecurityStubAuthenticateState \r
29};\r
30\r
31\r
32/**\r
33 The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
34 policy from the DXE core response to an attempt to use a file that returns a \r
35 given status for the authentication check from the section extraction protocol. \r
36\r
37 The possible responses in a given SAP implementation may include locking \r
38 flash upon failure to authenticate, attestation logging for all signed drivers, \r
39 and other exception operations. The File parameter allows for possible logging \r
40 within the SAP of the driver.\r
41\r
42 If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
43\r
44 If the file specified by File with an authentication status specified by \r
45 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS 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 under any circumstances, \r
49 then EFI_ACCESS_DENIED 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 right now, but it \r
53 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
54 returned.\r
55\r
56 @param This The EFI_SECURITY_ARCH_PROTOCOL instance.\r
57 @param AuthenticationStatus \r
58 This is the authentication type returned from the Section\r
59 Extraction protocol. See the Section Extraction Protocol\r
60 Specification for details on this type.\r
61 @param File This is a pointer to the device path of the file that is\r
62 being dispatched. This will optionally be used for logging.\r
63\r
5d69642d
LG
64 @retval EFI_SUCCESS Do nothing and return.\r
65 @retval EFI_INVALID_PARAMETER File is NULL.\r
ce2f5557 66**/\r
67EFI_STATUS\r
68EFIAPI\r
69SecurityStubAuthenticateState (\r
70 IN EFI_SECURITY_ARCH_PROTOCOL *This,\r
71 IN UINT32 AuthenticationStatus,\r
72 IN EFI_DEVICE_PATH_PROTOCOL *File\r
73 )\r
74{\r
75 if (File == NULL) {\r
76 return EFI_INVALID_PARAMETER;\r
77 }\r
78\r
79 return EFI_SUCCESS;\r
80}\r
81\r
82\r
83/**\r
5d69642d 84 The user Entry Point installs SAP. The user code starts with this function\r
ce2f5557 85 as the real entry point for the image goes into a library that calls this \r
86 function.\r
87\r
5d69642d
LG
88 @param ImageHandle The firmware allocated handle for the EFI image. \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