1 /** @file
2   This file declares Pei Security2 PPI.
3 
4   This PPI is installed by some platform PEIM that abstracts the security
5   policy to the PEI Foundation, namely the case of a PEIM's authentication
6   state being returned during the PEI section extraction process.
7 
8   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
9   This program and the accompanying materials
10   are licensed and made available under the terms and conditions of the BSD License
11   which accompanies this distribution.  The full text of the license may be found at
12   http://opensource.org/licenses/bsd-license.php
13 
14   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 
17   @par Revision Reference:
18   This PPI is introduced in PI Version 1.0.
19 
20 **/
21 
22 #ifndef __SECURITY2_PPI_H__
23 #define __SECURITY2_PPI_H__
24 
25 #define EFI_PEI_SECURITY2_PPI_GUID \
26   { 0xdcd0be23, 0x9586, 0x40f4, { 0xb6, 0x43, 0x6, 0x52, 0x2c, 0xed, 0x4e, 0xde } }
27 
28 
29 typedef struct _EFI_PEI_SECURITY2_PPI  EFI_PEI_SECURITY2_PPI;
30 
31 /**
32   Allows the platform builder to implement a security policy
33   in response to varying file authentication states.
34 
35   This service is published by some platform PEIM. The purpose of
36   this service is to expose a given platform's policy-based
37   response to the PEI Foundation. For example, if there is a PEIM
38   in a GUIDed encapsulation section and the extraction of the PEI
39   file section yields an authentication failure, there is no a
40   priori policy in the PEI Foundation. Specifically, this
41   situation leads to the question whether PEIMs that are either
42   not in GUIDed sections or are in sections whose authentication
43   fails should still be executed.
44 
45   @param PeiServices             An indirect pointer to the PEI Services
46                                  Table published by the PEI Foundation.
47   @param This                    Interface pointer that implements the
48                                  particular EFI_PEI_SECURITY2_PPI instance.
49   @param AuthenticationStatus    Authentication status of the file.
50                                  xx00 Image was not signed.
51                                  xxx1 Platform security policy override.
52                                       Assumes same meaning as 0010 (the image was signed, the
53                                       signature was tested, and the signature passed authentication test).
54                                  0010 Image was signed, the signature was tested,
55                                       and the signature passed authentication test.
56                                  0110 Image was signed and the signature was not tested.
57                                  1010 Image was signed, the signature was tested,
58                                       and the signature failed the authentication test.
59   @param FvHandle                Handle of the volume in which the file
60                                  resides. This allows different policies
61                                  depending on different firmware volumes.
62   @param FileHandle              Handle of the file under review.
63   @param DeferExecution          Pointer to a variable that alerts the
64                                  PEI Foundation to defer execution of a
65                                  PEIM.
66 
67   @retval EFI_SUCCESS            The service performed its action successfully.
68   @retval EFI_SECURITY_VIOLATION The object cannot be trusted.
69 
70 **/
71 typedef
72 EFI_STATUS
73 (EFIAPI *EFI_PEI_SECURITY_AUTHENTICATION_STATE)(
74   IN CONST  EFI_PEI_SERVICES      **PeiServices,
75   IN CONST  EFI_PEI_SECURITY2_PPI *This,
76   IN UINT32                       AuthenticationStatus,
77   IN EFI_PEI_FV_HANDLE            FvHandle,
78   IN EFI_PEI_FILE_HANDLE          FileHandle,
79   IN OUT    BOOLEAN               *DeferExecution
80 );
81 
82 ///
83 /// This PPI is a means by which the platform builder can indicate
84 /// a response to a PEIM's authentication state. This can be in
85 /// the form of a requirement for the PEI Foundation to skip a
86 /// module using the DeferExecution Boolean output in the
87 /// AuthenticationState() member function. Alternately, the
88 /// Security PPI can invoke something like a cryptographic PPI
89 /// that hashes the PEIM contents to log attestations, for which
90 /// the FileHandle parameter in AuthenticationState() will be
91 /// useful. If this PPI does not exist, PEIMs will be considered
92 /// trusted.
93 ///
94 struct _EFI_PEI_SECURITY2_PPI {
95   EFI_PEI_SECURITY_AUTHENTICATION_STATE   AuthenticationState;
96 };
97 
98 
99 extern EFI_GUID gEfiPeiSecurity2PpiGuid;
100 
101 #endif
102