3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 This driver supports platform security service
23 // Include common header file for this module.
25 #include "CommonHeader.h"
27 #include "SecurityStub.h"
30 // Handle for the Security Architectural Protocol instance produced by this driver
32 EFI_HANDLE mSecurityArchProtocolHandle
= NULL
;
35 // Security Architectural Protocol instance produced by this driver
37 EFI_SECURITY_ARCH_PROTOCOL mSecurityStub
= {
38 SecurityStubAuthenticateState
46 SecurityStubAuthenticateState (
47 IN EFI_SECURITY_ARCH_PROTOCOL
*This
,
48 IN UINT32 AuthenticationStatus
,
49 IN EFI_DEVICE_PATH_PROTOCOL
*File
55 The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific
56 policy from the DXE core response to an attempt to use a file that returns a
57 given status for the authentication check from the section extraction protocol.
59 The possible responses in a given SAP implementation may include locking
60 flash upon failure to authenticate, attestation logging for all signed drivers,
61 and other exception operations. The File parameter allows for possible logging
62 within the SAP of the driver.
64 If File is NULL, then EFI_INVALID_PARAMETER is returned.
66 If the file specified by File with an authentication status specified by
67 AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
69 If the file specified by File with an authentication status specified by
70 AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
71 then EFI_ACCESS_DENIED is returned.
73 If the file specified by File with an authentication status specified by
74 AuthenticationStatus is not safe for the DXE Core to use right now, but it
75 might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
80 This - The EFI_SECURITY_ARCH_PROTOCOL instance.
82 AuthenticationStatus - This is the authentication type returned from the Section
83 Extraction protocol. See the Section Extraction Protocol
84 Specification for details on this type.
86 File - This is a pointer to the device path of the file that is
87 being dispatched. This will optionally be used for logging.
91 EFI_SUCCESS - The file specified by File did authenticate, and the
92 platform policy dictates that the DXE Core may use File.
94 EFI_INVALID_PARAMETER - File is NULL.
96 EFI_SECURITY_VIOLATION - The file specified by File did not authenticate, and
97 the platform policy dictates that File should be placed
98 in the untrusted state. A file may be promoted from
99 the untrusted to the trusted state at a future time
100 with a call to the Trust() DXE Service.
102 EFI_ACCESS_DENIED - The file specified by File did not authenticate, and
103 the platform policy dictates that File should not be
104 used for any purpose.
109 return EFI_INVALID_PARAMETER
;
117 SecurityStubInitialize (
118 IN EFI_HANDLE ImageHandle
,
119 IN EFI_SYSTEM_TABLE
*SystemTable
125 Initialize the state information for the Security Architectural Protocol
129 ImageHandle of the loaded driver
130 Pointer to the System Table
136 EFI_SUCCESS - successful installation of the service
137 EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
138 EFI_DEVICE_ERROR - cannot create the timer service
145 // Make sure the Security Architectural Protocol is not already installed in the system
147 ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL
, &gEfiSecurityArchProtocolGuid
);
150 // Install the Security Architectural Protocol onto a new handle
152 Status
= gBS
->InstallMultipleProtocolInterfaces (
153 &mSecurityArchProtocolHandle
,
154 &gEfiSecurityArchProtocolGuid
,
158 ASSERT_EFI_ERROR (Status
);