• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Microsoft Reference Implementation for TPM 2.0
2  *
3  *  The copyright in this software is being made available under the BSD License,
4  *  included below. This software may be subject to other third party and
5  *  contributor rights, including patent rights, and no such rights are granted
6  *  under this license.
7  *
8  *  Copyright (c) Microsoft Corporation
9  *
10  *  All rights reserved.
11  *
12  *  BSD License
13  *
14  *  Redistribution and use in source and binary forms, with or without modification,
15  *  are permitted provided that the following conditions are met:
16  *
17  *  Redistributions of source code must retain the above copyright notice, this list
18  *  of conditions and the following disclaimer.
19  *
20  *  Redistributions in binary form must reproduce the above copyright notice, this
21  *  list of conditions and the following disclaimer in the documentation and/or
22  *  other materials provided with the distribution.
23  *
24  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS""
25  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 /*(Auto-generated)
36  *  Created by TpmPrototypes; Version 3.0 July 18, 2017
37  *  Date: Apr  2, 2019  Time: 04:23:27PM
38  */
39 
40 #ifndef    _COMMAND_AUDIT_FP_H_
41 #define    _COMMAND_AUDIT_FP_H_
42 
43 //*** CommandAuditPreInstall_Init()
44 // This function initializes the command audit list. This function simulates
45 // the behavior of manufacturing. A function is used instead of a structure
46 // definition because this is easier than figuring out the initialization value
47 // for a bit array.
48 //
49 // This function would not be implemented outside of a manufacturing or
50 // simulation environment.
51 void
52 CommandAuditPreInstall_Init(
53     void
54 );
55 
56 //*** CommandAuditStartup()
57 // This function clears the command audit digest on a TPM Reset.
58 BOOL
59 CommandAuditStartup(
60     STARTUP_TYPE     type           // IN: start up type
61 );
62 
63 //*** CommandAuditSet()
64 // This function will SET the audit flag for a command. This function
65 // will not SET the audit flag for a command that is not implemented. This
66 // ensures that the audit status is not SET when TPM2_GetCapability() is
67 // used to read the list of audited commands.
68 //
69 // This function is only used by TPM2_SetCommandCodeAuditStatus().
70 //
71 // The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the
72 // changes to be saved to NV after it is setting and clearing bits.
73 //  Return Type: BOOL
74 //      TRUE(1)         command code audit status was changed
75 //      FALSE(0)        command code audit status was not changed
76 BOOL
77 CommandAuditSet(
78     TPM_CC           commandCode    // IN: command code
79 );
80 
81 //*** CommandAuditClear()
82 // This function will CLEAR the audit flag for a command. It will not CLEAR the
83 // audit flag for TPM_CC_SetCommandCodeAuditStatus().
84 //
85 // This function is only used by TPM2_SetCommandCodeAuditStatus().
86 //
87 // The actions in TPM2_SetCommandCodeAuditStatus() are expected to cause the
88 // changes to be saved to NV after it is setting and clearing bits.
89 //  Return Type: BOOL
90 //      TRUE(1)         command code audit status was changed
91 //      FALSE(0)        command code audit status was not changed
92 BOOL
93 CommandAuditClear(
94     TPM_CC           commandCode    // IN: command code
95 );
96 
97 //*** CommandAuditIsRequired()
98 // This function indicates if the audit flag is SET for a command.
99 //  Return Type: BOOL
100 //      TRUE(1)         command is audited
101 //      FALSE(0)        command is not audited
102 BOOL
103 CommandAuditIsRequired(
104     COMMAND_INDEX    commandIndex   // IN: command index
105 );
106 
107 //*** CommandAuditCapGetCCList()
108 // This function returns a list of commands that have their audit bit SET.
109 //
110 // The list starts at the input commandCode.
111 //  Return Type: TPMI_YES_NO
112 //      YES         if there are more command code available
113 //      NO          all the available command code has been returned
114 TPMI_YES_NO
115 CommandAuditCapGetCCList(
116     TPM_CC           commandCode,   // IN: start command code
117     UINT32           count,         // IN: count of returned TPM_CC
118     TPML_CC         *commandList    // OUT: list of TPM_CC
119 );
120 
121 //*** CommandAuditGetDigest
122 // This command is used to create a digest of the commands being audited. The
123 // commands are processed in ascending numeric order with a list of TPM_CC being
124 // added to a hash. This operates as if all the audited command codes were
125 // concatenated and then hashed.
126 void
127 CommandAuditGetDigest(
128     TPM2B_DIGEST    *digest         // OUT: command digest
129 );
130 
131 #endif  // _COMMAND_AUDIT_FP_H_
132