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>
14 Check image authentication status returned from Section Extraction Protocol
16 @param[in] AuthenticationStatus This is the authentication status returned from
17 the Section Extraction Protocol when reading the input file.
18 @param[in] File This is a pointer to the device path of the file that is
19 being dispatched. This will optionally be used for logging.
20 @param[in] FileBuffer File buffer matches the input file device path.
21 @param[in] FileSize Size of File buffer matches the input file device path.
22 @param[in] BootPolicy A boot policy that was used to call LoadImage() UEFI service.
24 @retval EFI_SUCCESS The input file specified by File did authenticate, and the
25 platform policy dictates that the DXE Core may use File.
26 @retval EFI_ACCESS_DENIED The file specified by File and FileBuffer did not
27 authenticate, and the platform policy dictates that the DXE
28 Foundation many not use File.
33 DxeImageAuthenticationStatusHandler (
34 IN UINT32 AuthenticationStatus
,
35 IN CONST EFI_DEVICE_PATH_PROTOCOL
*File
, OPTIONAL
41 if ((AuthenticationStatus
& EFI_AUTH_STATUS_IMAGE_SIGNED
) != 0) {
42 if ((AuthenticationStatus
& (EFI_AUTH_STATUS_TEST_FAILED
| EFI_AUTH_STATUS_NOT_TESTED
)) != 0) {
43 return EFI_ACCESS_DENIED
;
52 Register image authentication status check handler.
54 @param ImageHandle ImageHandle of the loaded driver.
55 @param SystemTable Pointer to the EFI System Table.
57 @retval EFI_SUCCESS The handlers were registered successfully.
61 DxeImageAuthenticationStatusLibConstructor (
62 IN EFI_HANDLE ImageHandle
,
63 IN EFI_SYSTEM_TABLE
*SystemTable
66 return RegisterSecurity2Handler (
67 DxeImageAuthenticationStatusHandler
,
68 EFI_AUTH_OPERATION_AUTHENTICATION_STATE