2 Implement image authentication status check in UEFI2.3.1.
4 Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/SecurityManagementLib.h>
13 Check image authentication status returned from Section Extraction Protocol
15 @param[in] AuthenticationStatus This is the authentication status returned from
16 the Section Extraction Protocol when reading the input file.
17 @param[in] File This is a pointer to the device path of the file that is
18 being dispatched. This will optionally be used for logging.
19 @param[in] FileBuffer File buffer matches the input file device path.
20 @param[in] FileSize Size of File buffer matches the input file device path.
21 @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
23 @retval EFI_SUCCESS The input file specified by File did authenticate, and the
24 platform policy dictates that the DXE Core may use File.
25 @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
26 authenticate, and the platform policy dictates that the DXE
27 Foundation many not use File.
32 DxeImageAuthenticationStatusHandler (
33 IN UINT32 AuthenticationStatus
,
34 IN CONST EFI_DEVICE_PATH_PROTOCOL
*File OPTIONAL
,
40 if ((AuthenticationStatus
& EFI_AUTH_STATUS_IMAGE_SIGNED
) != 0) {
41 if ((AuthenticationStatus
& (EFI_AUTH_STATUS_TEST_FAILED
| EFI_AUTH_STATUS_NOT_TESTED
)) != 0) {
42 return EFI_ACCESS_DENIED
;
50 Register image authentication status check handler.
52 @param ImageHandle ImageHandle of the loaded driver.
53 @param SystemTable Pointer to the EFI System Table.
55 @retval EFI_SUCCESS The handlers were registered successfully.
59 DxeImageAuthenticationStatusLibConstructor (
60 IN EFI_HANDLE ImageHandle
,
61 IN EFI_SYSTEM_TABLE
*SystemTable
64 return RegisterSecurity2Handler (
65 DxeImageAuthenticationStatusHandler
,
66 EFI_AUTH_OPERATION_AUTHENTICATION_STATE