• 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: Mar 28, 2019  Time: 08:25:19PM
38  */
39 
40 #ifndef    _COMMAND_CODE_ATTRIBUTES_FP_H_
41 #define    _COMMAND_CODE_ATTRIBUTES_FP_H_
42 
43 //*** GetClosestCommandIndex()
44 // This function returns the command index for the command with a value that is
45 // equal to or greater than the input value
46 //  Return Type: COMMAND_INDEX
47 //  UNIMPLEMENTED_COMMAND_INDEX     command is not implemented
48 //  other                           index of a command
49 COMMAND_INDEX
50 GetClosestCommandIndex(
51     TPM_CC           commandCode    // IN: the command code to start at
52 );
53 
54 //*** CommandCodeToComandIndex()
55 // This function returns the index in the various attributes arrays of the
56 // command.
57 //  Return Type: COMMAND_INDEX
58 //  UNIMPLEMENTED_COMMAND_INDEX     command is not implemented
59 //  other                           index of the command
60 COMMAND_INDEX
61 CommandCodeToCommandIndex(
62     TPM_CC           commandCode    // IN: the command code to look up
63 );
64 
65 //*** GetNextCommandIndex()
66 // This function returns the index of the next implemented command.
67 //  Return Type: COMMAND_INDEX
68 //  UNIMPLEMENTED_COMMAND_INDEX     no more implemented commands
69 //  other                           the index of the next implemented command
70 COMMAND_INDEX
71 GetNextCommandIndex(
72     COMMAND_INDEX    commandIndex   // IN: the starting index
73 );
74 
75 //*** GetCommandCode()
76 // This function returns the commandCode associated with the command index
77 TPM_CC
78 GetCommandCode(
79     COMMAND_INDEX    commandIndex   // IN: the command index
80 );
81 
82 //*** CommandAuthRole()
83 //
84 //  This function returns the authorization role required of a handle.
85 //
86 //  Return Type: AUTH_ROLE
87 //  AUTH_NONE       no authorization is required
88 //  AUTH_USER       user role authorization is required
89 //  AUTH_ADMIN      admin role authorization is required
90 //  AUTH_DUP        duplication role authorization is required
91 AUTH_ROLE
92 CommandAuthRole(
93     COMMAND_INDEX    commandIndex,  // IN: command index
94     UINT32           handleIndex    // IN: handle index (zero based)
95 );
96 
97 //*** EncryptSize()
98 // This function returns the size of the decrypt size field. This function returns
99 // 0 if encryption is not allowed
100 //  Return Type: int
101 //  0       encryption not allowed
102 //  2       size field is two bytes
103 //  4       size field is four bytes
104 int
105 EncryptSize(
106     COMMAND_INDEX    commandIndex   // IN: command index
107 );
108 
109 //*** DecryptSize()
110 // This function returns the size of the decrypt size field. This function returns
111 // 0 if decryption is not allowed
112 //  Return Type: int
113 //  0       encryption not allowed
114 //  2       size field is two bytes
115 //  4       size field is four bytes
116 int
117 DecryptSize(
118     COMMAND_INDEX    commandIndex   // IN: command index
119 );
120 
121 //*** IsSessionAllowed()
122 //
123 // This function indicates if the command is allowed to have sessions.
124 //
125 // This function must not be called if the command is not known to be implemented.
126 //
127 //  Return Type: BOOL
128 //      TRUE(1)         session is allowed with this command
129 //      FALSE(0)        session is not allowed with this command
130 BOOL
131 IsSessionAllowed(
132     COMMAND_INDEX    commandIndex   // IN: the command to be checked
133 );
134 
135 //*** IsHandleInResponse()
136 // This function determines if a command has a handle in the response
137 BOOL
138 IsHandleInResponse(
139     COMMAND_INDEX    commandIndex
140 );
141 
142 //*** IsWriteOperation()
143 // Checks to see if an operation will write to an NV Index and is subject to being
144 // blocked by read-lock
145 BOOL
146 IsWriteOperation(
147     COMMAND_INDEX    commandIndex   // IN: Command to check
148 );
149 
150 //*** IsReadOperation()
151 // Checks to see if an operation will write to an NV Index and is
152 // subject to being blocked by write-lock.
153 BOOL
154 IsReadOperation(
155     COMMAND_INDEX    commandIndex   // IN: Command to check
156 );
157 
158 //*** CommandCapGetCCList()
159 // This function returns a list of implemented commands and command attributes
160 // starting from the command in 'commandCode'.
161 //  Return Type: TPMI_YES_NO
162 //      YES         more command attributes are available
163 //      NO          no more command attributes are available
164 TPMI_YES_NO
165 CommandCapGetCCList(
166     TPM_CC           commandCode,   // IN: start command code
167     UINT32           count,         // IN: maximum count for number of entries in
168                                     //     'commandList'
169     TPML_CCA        *commandList    // OUT: list of TPMA_CC
170 );
171 
172 //*** IsVendorCommand()
173 // Function indicates if a command index references a vendor command.
174 //  Return Type: BOOL
175 //      TRUE(1)         command is a vendor command
176 //      FALSE(0)        command is not a vendor command
177 BOOL
178 IsVendorCommand(
179     COMMAND_INDEX    commandIndex   // IN: command index to check
180 );
181 
182 #endif  // _COMMAND_CODE_ATTRIBUTES_FP_H_
183