1 /*
2  * Copyright 2015 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #ifndef __TPM2_PCR_FP_H
8 #define __TPM2_PCR_FP_H
9 
10 TPM_RC PCRAllocate(TPML_PCR_SELECTION *allocate,  //   IN: required allocation
11                    UINT32 *maxPCR,        //   OUT: Maximum number of PCR
12                    UINT32 *sizeNeeded,    //   OUT: required space
13                    UINT32 *sizeAvailable  //   OUT: available space
14                    );
15 BOOL PCRBelongsAuthGroup(TPMI_DH_PCR handle,  // IN: handle of PCR
16                          UINT32 *groupIndex   // OUT: group index if PCR belongs
17                                               // a group that allows authValue.
18                                               // If PCR does not belong to an
19                                               // auth group, the value in this
20                                               // parameter is invalid
21                          );
22 BOOL PCRBelongsPolicyGroup(TPMI_DH_PCR handle,  // IN: handle of PCR
23                            UINT32 *groupIndex   // OUT: group index if PCR
24                                                 // belongs a group that allows
25                                                // policy. If PCR does not belong
26                                                // to a policy group, the value
27                                                // in this parameter is invalid
28                            );
29 TPMI_YES_NO PCRCapGetAllocation(
30     UINT32 count,                     // IN: count of return
31     TPML_PCR_SELECTION *pcrSelection  // OUT: PCR allocation list
32     );
33 void PCRChanged(TPM_HANDLE pcrHandle  // IN: the handle of the PCR that changed.
34                 );
35 void PCRComputeCurrentDigest(
36     TPMI_ALG_HASH hashAlg,  // IN: hash algorithm to compute digest
37     TPML_PCR_SELECTION *
38         selection,        // IN/OUT: PCR selection (filtered on output)
39     TPM2B_DIGEST *digest  // OUT: digest
40     );
41 TPMI_ALG_HASH PCRGetAuthPolicy(TPMI_DH_PCR handle,   // IN: PCR handle
42                                TPM2B_DIGEST *policy  // OUT: policy of PCR
43                                );
44 TPMI_YES_NO PCRCapGetHandles(TPMI_DH_PCR handle,  // IN: start handle
45                              UINT32 count,  // IN: count of returned handle
46                              TPML_HANDLE *handleList  // OUT: list of handle
47                              );
48 TPMI_YES_NO PCRCapGetProperties(
49     TPM_PT_PCR property,              // IN: the starting PCR property
50     UINT32 count,                     // IN: count of returned propertie
51     TPML_TAGGED_PCR_PROPERTY *select  // OUT: PCR select
52     );
53 void PCRGetAuthValue(TPMI_DH_PCR handle,  // IN: PCR handle
54                      TPM2B_AUTH *auth     // OUT: authValue of PCR
55                      );
56 void PCRExtend(TPMI_DH_PCR handle,  //   IN:    PCR handle to be extended
57                TPMI_ALG_HASH hash,  //   IN:    hash algorithm of PCR
58                UINT32 size,         //   IN:    size of data to be extended
59                BYTE *data           //   IN:    data to be extended
60                );
61 void PCRResetDynamics(void);
62 void PcrDrtm(
63     const TPMI_DH_PCR pcrHandle,  // IN: the index of the PCR to be modified
64     const TPMI_ALG_HASH hash,     // IN: the bank identifier
65     const TPM2B_DIGEST *digest    // IN: the digest to modify the PCR
66     );
67 BOOL PcrIsAllocated(UINT32 pcr,            // IN: The number of the PCR
68                     TPMI_ALG_HASH hashAlg  // IN: The PCR algorithm
69                     );
70 BOOL PCRIsExtendAllowed(TPMI_DH_PCR handle  // IN: PCR handle to be extended
71                         );
72 BOOL PCRIsResetAllowed(TPMI_DH_PCR handle  // IN: PCR handle to be extended
73                        );
74 BOOL PCRIsStateSaved(TPMI_DH_PCR handle  // IN: PCR handle to be extended
75                      );
76 BOOL PCRPolicyIsAvailable(TPMI_DH_PCR handle  // IN: PCR handle
77                           );
78 void PCRRead(
79     TPML_PCR_SELECTION *
80         selection,        // IN/OUT: PCR selection (filtered on output)
81     TPML_DIGEST *digest,  // OUT: digest
82     UINT32 *pcrCounter    // OUT: the current value of PCR generation number
83     );
84 void PCRSetValue(TPM_HANDLE handle,  // IN: the handle of the PCR to set
85                  INT8 initialValue   // IN: the value to set
86                  );
87 void PCRSimStart(void);
88 void PCRStartup(STARTUP_TYPE type,  // IN: startup type
89                 BYTE locality       // IN: startup locality
90                 );
91 void PCRStateSave(TPM_SU type  // IN: startup type
92                   );
93 
94 #endif  // __TPM2_PCR_FP_H
95