TianoCore EDK2 master
Loading...
Searching...
No Matches
SecurityStub.c
Go to the documentation of this file.
1
9#include <Uefi.h>
10#include <Protocol/Security.h>
11#include <Protocol/Security2.h>
12#include <Library/DebugLib.h>
17
18//
19// Handle for the Security Architectural Protocol instance produced by this driver
20//
21EFI_HANDLE mSecurityArchProtocolHandle = NULL;
22
59EFIAPI
62 IN UINT32 AuthenticationStatus,
64 )
65{
66 EFI_STATUS Status;
67
69 EFI_AUTH_OPERATION_AUTHENTICATION_STATE,
70 AuthenticationStatus,
71 File,
72 NULL,
73 0,
74 FALSE
75 );
76 if (Status == EFI_SUCCESS) {
77 Status = ExecuteSecurityHandlers (AuthenticationStatus, File);
78 }
79
80 return Status;
81}
82
129EFIAPI
132 IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL,
133 IN VOID *FileBuffer,
134 IN UINTN FileSize,
135 IN BOOLEAN BootPolicy
136 )
137{
138 EFI_STATUS Status;
139
140 if (FileBuffer != NULL) {
141 Status = Defer3rdPartyImageLoad (File, BootPolicy);
142 if (EFI_ERROR (Status)) {
143 return Status;
144 }
145 }
146
148 EFI_AUTH_OPERATION_VERIFY_IMAGE |
149 EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD |
150 EFI_AUTH_OPERATION_MEASURE_IMAGE |
151 EFI_AUTH_OPERATION_CONNECT_POLICY,
152 0,
153 File,
154 FileBuffer,
155 FileSize,
156 BootPolicy
157 );
158}
159
160//
161// Security2 and Security Architectural Protocol instance produced by this driver
162//
163EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = {
165};
166
167EFI_SECURITY2_ARCH_PROTOCOL mSecurity2Stub = {
169};
170
181EFIAPI
183 IN EFI_HANDLE ImageHandle,
184 IN EFI_SYSTEM_TABLE *SystemTable
185 )
186{
187 EFI_STATUS Status;
188
189 //
190 // Make sure the Security Architectural Protocol is not already installed in the system
191 //
192 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurity2ArchProtocolGuid);
193 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);
194
195 //
196 // Install the Security Architectural Protocol onto a new handle
197 //
198 Status = gBS->InstallMultipleProtocolInterfaces (
199 &mSecurityArchProtocolHandle,
200 &gEfiSecurity2ArchProtocolGuid,
201 &mSecurity2Stub,
202 &gEfiSecurityArchProtocolGuid,
203 &mSecurityStub,
204 NULL
205 );
206 ASSERT_EFI_ERROR (Status);
207
209
210 return EFI_SUCCESS;
211}
UINT64 UINTN
EFI_STATUS Defer3rdPartyImageLoad(IN CONST EFI_DEVICE_PATH_PROTOCOL *File, IN BOOLEAN BootPolicy)
VOID Defer3rdPartyImageLoadInitialize(VOID)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)
Definition: DebugLib.h:535
EFI_STATUS EFIAPI ExecuteSecurity2Handlers(IN UINT32 AuthenticationOperation, IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, IN VOID *FileBuffer, IN UINTN FileSize, IN BOOLEAN BootPolicy)
EFI_STATUS EFIAPI ExecuteSecurityHandlers(IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath)
EFI_STATUS EFIAPI Security2StubAuthenticate(IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This, IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL, IN VOID *FileBuffer, IN UINTN FileSize, IN BOOLEAN BootPolicy)
Definition: SecurityStub.c:130
EFI_STATUS EFIAPI SecurityStubInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: SecurityStub.c:182
EFI_STATUS EFIAPI SecurityStubAuthenticateState(IN CONST EFI_SECURITY_ARCH_PROTOCOL *This, IN UINT32 AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *File)
Definition: SecurityStub.c:60
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS