| 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 TpmDispatch; Version 4.0 July 8,2017 |
| 37 |
* Date: Oct 27, 2018 Time: 06:49:39PM |
| 38 |
*/ |
| 39 |
|
| 40 |
// This macro is added just so that the code is only excessively long. |
| 41 |
#define EXIT_IF_ERROR_PLUS(x) \ |
| 42 |
if(TPM_RC_SUCCESS != result) { result += (x); goto Exit; } |
| 43 |
#if CC_Startup |
| 44 |
case TPM_CC_Startup: { |
| 45 |
Startup_In *in = (Startup_In *) |
| 46 |
MemoryGetInBuffer(sizeof(Startup_In)); |
| 47 |
result = TPM_SU_Unmarshal(&in->startupType, paramBuffer, paramBufferSize); |
| 48 |
ERROR_IF_EXIT_PLUS(RC_Startup_startupType); |
| 49 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 50 |
result = TPM2_Startup (in); |
| 51 |
break; |
| 52 |
} |
| 53 |
#endif // CC_Startup |
| 54 |
#if CC_Shutdown |
| 55 |
case TPM_CC_Shutdown: { |
| 56 |
Shutdown_In *in = (Shutdown_In *) |
| 57 |
MemoryGetInBuffer(sizeof(Shutdown_In)); |
| 58 |
result = TPM_SU_Unmarshal(&in->shutdownType, paramBuffer, paramBufferSize); |
| 59 |
ERROR_IF_EXIT_PLUS(RC_Shutdown_shutdownType); |
| 60 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 61 |
result = TPM2_Shutdown (in); |
| 62 |
break; |
| 63 |
} |
| 64 |
#endif // CC_Shutdown |
| 65 |
#if CC_SelfTest |
| 66 |
case TPM_CC_SelfTest: { |
| 67 |
SelfTest_In *in = (SelfTest_In *) |
| 68 |
MemoryGetInBuffer(sizeof(SelfTest_In)); |
| 69 |
result = TPMI_YES_NO_Unmarshal(&in->fullTest, paramBuffer, paramBufferSize); |
| 70 |
ERROR_IF_EXIT_PLUS(RC_SelfTest_fullTest); |
| 71 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 72 |
result = TPM2_SelfTest (in); |
| 73 |
break; |
| 74 |
} |
| 75 |
#endif // CC_SelfTest |
| 76 |
#if CC_IncrementalSelfTest |
| 77 |
case TPM_CC_IncrementalSelfTest: { |
| 78 |
IncrementalSelfTest_In *in = (IncrementalSelfTest_In *) |
| 79 |
MemoryGetInBuffer(sizeof(IncrementalSelfTest_In)); |
| 80 |
IncrementalSelfTest_Out *out = (IncrementalSelfTest_Out *) |
| 81 |
MemoryGetOutBuffer(sizeof(IncrementalSelfTest_Out)); |
| 82 |
result = TPML_ALG_Unmarshal(&in->toTest, paramBuffer, paramBufferSize); |
| 83 |
ERROR_IF_EXIT_PLUS(RC_IncrementalSelfTest_toTest); |
| 84 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 85 |
result = TPM2_IncrementalSelfTest (in, out); |
| 86 |
rSize = sizeof(IncrementalSelfTest_Out); |
| 87 |
*respParmSize += TPML_ALG_Marshal(&out->toDoList, |
| 88 |
responseBuffer, &rSize); |
| 89 |
break; |
| 90 |
} |
| 91 |
#endif // CC_IncrementalSelfTest |
| 92 |
#if CC_GetTestResult |
| 93 |
case TPM_CC_GetTestResult: { |
| 94 |
GetTestResult_Out *out = (GetTestResult_Out *) |
| 95 |
MemoryGetOutBuffer(sizeof(GetTestResult_Out)); |
| 96 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 97 |
result = TPM2_GetTestResult (out); |
| 98 |
rSize = sizeof(GetTestResult_Out); |
| 99 |
*respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, |
| 100 |
responseBuffer, &rSize); |
| 101 |
*respParmSize += TPM_RC_Marshal(&out->testResult, |
| 102 |
responseBuffer, &rSize); |
| 103 |
break; |
| 104 |
} |
| 105 |
#endif // CC_GetTestResult |
| 106 |
#if CC_StartAuthSession |
| 107 |
case TPM_CC_StartAuthSession: { |
| 108 |
StartAuthSession_In *in = (StartAuthSession_In *) |
| 109 |
MemoryGetInBuffer(sizeof(StartAuthSession_In)); |
| 110 |
StartAuthSession_Out *out = (StartAuthSession_Out *) |
| 111 |
MemoryGetOutBuffer(sizeof(StartAuthSession_Out)); |
| 112 |
in->tpmKey = handles[0]; |
| 113 |
in->bind = handles[1]; |
| 114 |
result = TPM2B_NONCE_Unmarshal(&in->nonceCaller, paramBuffer, paramBufferSize); |
| 115 |
ERROR_IF_EXIT_PLUS(RC_StartAuthSession_nonceCaller); |
| 116 |
result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->encryptedSalt, paramBuffer, paramBufferSize); |
| 117 |
ERROR_IF_EXIT_PLUS(RC_StartAuthSession_encryptedSalt); |
| 118 |
result = TPM_SE_Unmarshal(&in->sessionType, paramBuffer, paramBufferSize); |
| 119 |
ERROR_IF_EXIT_PLUS(RC_StartAuthSession_sessionType); |
| 120 |
result = TPMT_SYM_DEF_Unmarshal(&in->symmetric, paramBuffer, paramBufferSize, TRUE); |
| 121 |
ERROR_IF_EXIT_PLUS(RC_StartAuthSession_symmetric); |
| 122 |
result = TPMI_ALG_HASH_Unmarshal(&in->authHash, paramBuffer, paramBufferSize, FALSE); |
| 123 |
ERROR_IF_EXIT_PLUS(RC_StartAuthSession_authHash); |
| 124 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 125 |
result = TPM2_StartAuthSession (in, out); |
| 126 |
rSize = sizeof(StartAuthSession_Out); |
| 127 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 128 |
; command->handles[command->handleNum++] = out->sessionHandle; |
| 129 |
*respParmSize += TPM2B_NONCE_Marshal(&out->nonceTPM, |
| 130 |
responseBuffer, &rSize); |
| 131 |
break; |
| 132 |
} |
| 133 |
#endif // CC_StartAuthSession |
| 134 |
#if CC_PolicyRestart |
| 135 |
case TPM_CC_PolicyRestart: { |
| 136 |
PolicyRestart_In *in = (PolicyRestart_In *) |
| 137 |
MemoryGetInBuffer(sizeof(PolicyRestart_In)); |
| 138 |
in->sessionHandle = handles[0]; |
| 139 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 140 |
result = TPM2_PolicyRestart (in); |
| 141 |
break; |
| 142 |
} |
| 143 |
#endif // CC_PolicyRestart |
| 144 |
#if CC_Create |
| 145 |
case TPM_CC_Create: { |
| 146 |
Create_In *in = (Create_In *) |
| 147 |
MemoryGetInBuffer(sizeof(Create_In)); |
| 148 |
Create_Out *out = (Create_Out *) |
| 149 |
MemoryGetOutBuffer(sizeof(Create_Out)); |
| 150 |
in->parentHandle = handles[0]; |
| 151 |
result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); |
| 152 |
ERROR_IF_EXIT_PLUS(RC_Create_inSensitive); |
| 153 |
result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); |
| 154 |
ERROR_IF_EXIT_PLUS(RC_Create_inPublic); |
| 155 |
result = TPM2B_DATA_Unmarshal(&in->outsideInfo, paramBuffer, paramBufferSize); |
| 156 |
ERROR_IF_EXIT_PLUS(RC_Create_outsideInfo); |
| 157 |
result = TPML_PCR_SELECTION_Unmarshal(&in->creationPCR, paramBuffer, paramBufferSize); |
| 158 |
ERROR_IF_EXIT_PLUS(RC_Create_creationPCR); |
| 159 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 160 |
result = TPM2_Create (in, out); |
| 161 |
rSize = sizeof(Create_Out); |
| 162 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, |
| 163 |
responseBuffer, &rSize); |
| 164 |
*respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, |
| 165 |
responseBuffer, &rSize); |
| 166 |
*respParmSize += TPM2B_CREATION_DATA_Marshal(&out->creationData, |
| 167 |
responseBuffer, &rSize); |
| 168 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->creationHash, |
| 169 |
responseBuffer, &rSize); |
| 170 |
*respParmSize += TPMT_TK_CREATION_Marshal(&out->creationTicket, |
| 171 |
responseBuffer, &rSize); |
| 172 |
break; |
| 173 |
} |
| 174 |
#endif // CC_Create |
| 175 |
#if CC_Load |
| 176 |
case TPM_CC_Load: { |
| 177 |
Load_In *in = (Load_In *) |
| 178 |
MemoryGetInBuffer(sizeof(Load_In)); |
| 179 |
Load_Out *out = (Load_Out *) |
| 180 |
MemoryGetOutBuffer(sizeof(Load_Out)); |
| 181 |
in->parentHandle = handles[0]; |
| 182 |
result = TPM2B_PRIVATE_Unmarshal(&in->inPrivate, paramBuffer, paramBufferSize); |
| 183 |
ERROR_IF_EXIT_PLUS(RC_Load_inPrivate); |
| 184 |
result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); |
| 185 |
ERROR_IF_EXIT_PLUS(RC_Load_inPublic); |
| 186 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 187 |
result = TPM2_Load (in, out); |
| 188 |
rSize = sizeof(Load_Out); |
| 189 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 190 |
; command->handles[command->handleNum++] = out->objectHandle; |
| 191 |
*respParmSize += TPM2B_NAME_Marshal(&out->name, |
| 192 |
responseBuffer, &rSize); |
| 193 |
break; |
| 194 |
} |
| 195 |
#endif // CC_Load |
| 196 |
#if CC_LoadExternal |
| 197 |
case TPM_CC_LoadExternal: { |
| 198 |
LoadExternal_In *in = (LoadExternal_In *) |
| 199 |
MemoryGetInBuffer(sizeof(LoadExternal_In)); |
| 200 |
LoadExternal_Out *out = (LoadExternal_Out *) |
| 201 |
MemoryGetOutBuffer(sizeof(LoadExternal_Out)); |
| 202 |
result = TPM2B_SENSITIVE_Unmarshal(&in->inPrivate, paramBuffer, paramBufferSize); |
| 203 |
ERROR_IF_EXIT_PLUS(RC_LoadExternal_inPrivate); |
| 204 |
result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, TRUE); |
| 205 |
ERROR_IF_EXIT_PLUS(RC_LoadExternal_inPublic); |
| 206 |
result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); |
| 207 |
ERROR_IF_EXIT_PLUS(RC_LoadExternal_hierarchy); |
| 208 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 209 |
result = TPM2_LoadExternal (in, out); |
| 210 |
rSize = sizeof(LoadExternal_Out); |
| 211 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 212 |
; command->handles[command->handleNum++] = out->objectHandle; |
| 213 |
*respParmSize += TPM2B_NAME_Marshal(&out->name, |
| 214 |
responseBuffer, &rSize); |
| 215 |
break; |
| 216 |
} |
| 217 |
#endif // CC_LoadExternal |
| 218 |
#if CC_ReadPublic |
| 219 |
case TPM_CC_ReadPublic: { |
| 220 |
ReadPublic_In *in = (ReadPublic_In *) |
| 221 |
MemoryGetInBuffer(sizeof(ReadPublic_In)); |
| 222 |
ReadPublic_Out *out = (ReadPublic_Out *) |
| 223 |
MemoryGetOutBuffer(sizeof(ReadPublic_Out)); |
| 224 |
in->objectHandle = handles[0]; |
| 225 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 226 |
result = TPM2_ReadPublic (in, out); |
| 227 |
rSize = sizeof(ReadPublic_Out); |
| 228 |
*respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, |
| 229 |
responseBuffer, &rSize); |
| 230 |
*respParmSize += TPM2B_NAME_Marshal(&out->name, |
| 231 |
responseBuffer, &rSize); |
| 232 |
*respParmSize += TPM2B_NAME_Marshal(&out->qualifiedName, |
| 233 |
responseBuffer, &rSize); |
| 234 |
break; |
| 235 |
} |
| 236 |
#endif // CC_ReadPublic |
| 237 |
#if CC_ActivateCredential |
| 238 |
case TPM_CC_ActivateCredential: { |
| 239 |
ActivateCredential_In *in = (ActivateCredential_In *) |
| 240 |
MemoryGetInBuffer(sizeof(ActivateCredential_In)); |
| 241 |
ActivateCredential_Out *out = (ActivateCredential_Out *) |
| 242 |
MemoryGetOutBuffer(sizeof(ActivateCredential_Out)); |
| 243 |
in->activateHandle = handles[0]; |
| 244 |
in->keyHandle = handles[1]; |
| 245 |
result = TPM2B_ID_OBJECT_Unmarshal(&in->credentialBlob, paramBuffer, paramBufferSize); |
| 246 |
ERROR_IF_EXIT_PLUS(RC_ActivateCredential_credentialBlob); |
| 247 |
result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->secret, paramBuffer, paramBufferSize); |
| 248 |
ERROR_IF_EXIT_PLUS(RC_ActivateCredential_secret); |
| 249 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 250 |
result = TPM2_ActivateCredential (in, out); |
| 251 |
rSize = sizeof(ActivateCredential_Out); |
| 252 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->certInfo, |
| 253 |
responseBuffer, &rSize); |
| 254 |
break; |
| 255 |
} |
| 256 |
#endif // CC_ActivateCredential |
| 257 |
#if CC_MakeCredential |
| 258 |
case TPM_CC_MakeCredential: { |
| 259 |
MakeCredential_In *in = (MakeCredential_In *) |
| 260 |
MemoryGetInBuffer(sizeof(MakeCredential_In)); |
| 261 |
MakeCredential_Out *out = (MakeCredential_Out *) |
| 262 |
MemoryGetOutBuffer(sizeof(MakeCredential_Out)); |
| 263 |
in->handle = handles[0]; |
| 264 |
result = TPM2B_DIGEST_Unmarshal(&in->credential, paramBuffer, paramBufferSize); |
| 265 |
ERROR_IF_EXIT_PLUS(RC_MakeCredential_credential); |
| 266 |
result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); |
| 267 |
ERROR_IF_EXIT_PLUS(RC_MakeCredential_objectName); |
| 268 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 269 |
result = TPM2_MakeCredential (in, out); |
| 270 |
rSize = sizeof(MakeCredential_Out); |
| 271 |
*respParmSize += TPM2B_ID_OBJECT_Marshal(&out->credentialBlob, |
| 272 |
responseBuffer, &rSize); |
| 273 |
*respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->secret, |
| 274 |
responseBuffer, &rSize); |
| 275 |
break; |
| 276 |
} |
| 277 |
#endif // CC_MakeCredential |
| 278 |
#if CC_Unseal |
| 279 |
case TPM_CC_Unseal: { |
| 280 |
Unseal_In *in = (Unseal_In *) |
| 281 |
MemoryGetInBuffer(sizeof(Unseal_In)); |
| 282 |
Unseal_Out *out = (Unseal_Out *) |
| 283 |
MemoryGetOutBuffer(sizeof(Unseal_Out)); |
| 284 |
in->itemHandle = handles[0]; |
| 285 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 286 |
result = TPM2_Unseal (in, out); |
| 287 |
rSize = sizeof(Unseal_Out); |
| 288 |
*respParmSize += TPM2B_SENSITIVE_DATA_Marshal(&out->outData, |
| 289 |
responseBuffer, &rSize); |
| 290 |
break; |
| 291 |
} |
| 292 |
#endif // CC_Unseal |
| 293 |
#if CC_ObjectChangeAuth |
| 294 |
case TPM_CC_ObjectChangeAuth: { |
| 295 |
ObjectChangeAuth_In *in = (ObjectChangeAuth_In *) |
| 296 |
MemoryGetInBuffer(sizeof(ObjectChangeAuth_In)); |
| 297 |
ObjectChangeAuth_Out *out = (ObjectChangeAuth_Out *) |
| 298 |
MemoryGetOutBuffer(sizeof(ObjectChangeAuth_Out)); |
| 299 |
in->objectHandle = handles[0]; |
| 300 |
in->parentHandle = handles[1]; |
| 301 |
result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); |
| 302 |
ERROR_IF_EXIT_PLUS(RC_ObjectChangeAuth_newAuth); |
| 303 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 304 |
result = TPM2_ObjectChangeAuth (in, out); |
| 305 |
rSize = sizeof(ObjectChangeAuth_Out); |
| 306 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, |
| 307 |
responseBuffer, &rSize); |
| 308 |
break; |
| 309 |
} |
| 310 |
#endif // CC_ObjectChangeAuth |
| 311 |
#if CC_CreateLoaded |
| 312 |
case TPM_CC_CreateLoaded: { |
| 313 |
CreateLoaded_In *in = (CreateLoaded_In *) |
| 314 |
MemoryGetInBuffer(sizeof(CreateLoaded_In)); |
| 315 |
CreateLoaded_Out *out = (CreateLoaded_Out *) |
| 316 |
MemoryGetOutBuffer(sizeof(CreateLoaded_Out)); |
| 317 |
in->parentHandle = handles[0]; |
| 318 |
result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); |
| 319 |
ERROR_IF_EXIT_PLUS(RC_CreateLoaded_inSensitive); |
| 320 |
result = TPM2B_TEMPLATE_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize); |
| 321 |
ERROR_IF_EXIT_PLUS(RC_CreateLoaded_inPublic); |
| 322 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 323 |
result = TPM2_CreateLoaded (in, out); |
| 324 |
rSize = sizeof(CreateLoaded_Out); |
| 325 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 326 |
; command->handles[command->handleNum++] = out->objectHandle; |
| 327 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, |
| 328 |
responseBuffer, &rSize); |
| 329 |
*respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, |
| 330 |
responseBuffer, &rSize); |
| 331 |
*respParmSize += TPM2B_NAME_Marshal(&out->name, |
| 332 |
responseBuffer, &rSize); |
| 333 |
break; |
| 334 |
} |
| 335 |
#endif // CC_CreateLoaded |
| 336 |
#if CC_Duplicate |
| 337 |
case TPM_CC_Duplicate: { |
| 338 |
Duplicate_In *in = (Duplicate_In *) |
| 339 |
MemoryGetInBuffer(sizeof(Duplicate_In)); |
| 340 |
Duplicate_Out *out = (Duplicate_Out *) |
| 341 |
MemoryGetOutBuffer(sizeof(Duplicate_Out)); |
| 342 |
in->objectHandle = handles[0]; |
| 343 |
in->newParentHandle = handles[1]; |
| 344 |
result = TPM2B_DATA_Unmarshal(&in->encryptionKeyIn, paramBuffer, paramBufferSize); |
| 345 |
ERROR_IF_EXIT_PLUS(RC_Duplicate_encryptionKeyIn); |
| 346 |
result = TPMT_SYM_DEF_OBJECT_Unmarshal(&in->symmetricAlg, paramBuffer, paramBufferSize, TRUE); |
| 347 |
ERROR_IF_EXIT_PLUS(RC_Duplicate_symmetricAlg); |
| 348 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 349 |
result = TPM2_Duplicate (in, out); |
| 350 |
rSize = sizeof(Duplicate_Out); |
| 351 |
*respParmSize += TPM2B_DATA_Marshal(&out->encryptionKeyOut, |
| 352 |
responseBuffer, &rSize); |
| 353 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->duplicate, |
| 354 |
responseBuffer, &rSize); |
| 355 |
*respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->outSymSeed, |
| 356 |
responseBuffer, &rSize); |
| 357 |
break; |
| 358 |
} |
| 359 |
#endif // CC_Duplicate |
| 360 |
#if CC_Rewrap |
| 361 |
case TPM_CC_Rewrap: { |
| 362 |
Rewrap_In *in = (Rewrap_In *) |
| 363 |
MemoryGetInBuffer(sizeof(Rewrap_In)); |
| 364 |
Rewrap_Out *out = (Rewrap_Out *) |
| 365 |
MemoryGetOutBuffer(sizeof(Rewrap_Out)); |
| 366 |
in->oldParent = handles[0]; |
| 367 |
in->newParent = handles[1]; |
| 368 |
result = TPM2B_PRIVATE_Unmarshal(&in->inDuplicate, paramBuffer, paramBufferSize); |
| 369 |
ERROR_IF_EXIT_PLUS(RC_Rewrap_inDuplicate); |
| 370 |
result = TPM2B_NAME_Unmarshal(&in->name, paramBuffer, paramBufferSize); |
| 371 |
ERROR_IF_EXIT_PLUS(RC_Rewrap_name); |
| 372 |
result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->inSymSeed, paramBuffer, paramBufferSize); |
| 373 |
ERROR_IF_EXIT_PLUS(RC_Rewrap_inSymSeed); |
| 374 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 375 |
result = TPM2_Rewrap (in, out); |
| 376 |
rSize = sizeof(Rewrap_Out); |
| 377 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->outDuplicate, |
| 378 |
responseBuffer, &rSize); |
| 379 |
*respParmSize += TPM2B_ENCRYPTED_SECRET_Marshal(&out->outSymSeed, |
| 380 |
responseBuffer, &rSize); |
| 381 |
break; |
| 382 |
} |
| 383 |
#endif // CC_Rewrap |
| 384 |
#if CC_Import |
| 385 |
case TPM_CC_Import: { |
| 386 |
Import_In *in = (Import_In *) |
| 387 |
MemoryGetInBuffer(sizeof(Import_In)); |
| 388 |
Import_Out *out = (Import_Out *) |
| 389 |
MemoryGetOutBuffer(sizeof(Import_Out)); |
| 390 |
in->parentHandle = handles[0]; |
| 391 |
result = TPM2B_DATA_Unmarshal(&in->encryptionKey, paramBuffer, paramBufferSize); |
| 392 |
ERROR_IF_EXIT_PLUS(RC_Import_encryptionKey); |
| 393 |
result = TPM2B_PUBLIC_Unmarshal(&in->objectPublic, paramBuffer, paramBufferSize, FALSE); |
| 394 |
ERROR_IF_EXIT_PLUS(RC_Import_objectPublic); |
| 395 |
result = TPM2B_PRIVATE_Unmarshal(&in->duplicate, paramBuffer, paramBufferSize); |
| 396 |
ERROR_IF_EXIT_PLUS(RC_Import_duplicate); |
| 397 |
result = TPM2B_ENCRYPTED_SECRET_Unmarshal(&in->inSymSeed, paramBuffer, paramBufferSize); |
| 398 |
ERROR_IF_EXIT_PLUS(RC_Import_inSymSeed); |
| 399 |
result = TPMT_SYM_DEF_OBJECT_Unmarshal(&in->symmetricAlg, paramBuffer, paramBufferSize, TRUE); |
| 400 |
ERROR_IF_EXIT_PLUS(RC_Import_symmetricAlg); |
| 401 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 402 |
result = TPM2_Import (in, out); |
| 403 |
rSize = sizeof(Import_Out); |
| 404 |
*respParmSize += TPM2B_PRIVATE_Marshal(&out->outPrivate, |
| 405 |
responseBuffer, &rSize); |
| 406 |
break; |
| 407 |
} |
| 408 |
#endif // CC_Import |
| 409 |
#if CC_RSA_Encrypt |
| 410 |
case TPM_CC_RSA_Encrypt: { |
| 411 |
RSA_Encrypt_In *in = (RSA_Encrypt_In *) |
| 412 |
MemoryGetInBuffer(sizeof(RSA_Encrypt_In)); |
| 413 |
RSA_Encrypt_Out *out = (RSA_Encrypt_Out *) |
| 414 |
MemoryGetOutBuffer(sizeof(RSA_Encrypt_Out)); |
| 415 |
in->keyHandle = handles[0]; |
| 416 |
result = TPM2B_PUBLIC_KEY_RSA_Unmarshal(&in->message, paramBuffer, paramBufferSize); |
| 417 |
ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_message); |
| 418 |
result = TPMT_RSA_DECRYPT_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 419 |
ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_inScheme); |
| 420 |
result = TPM2B_DATA_Unmarshal(&in->label, paramBuffer, paramBufferSize); |
| 421 |
ERROR_IF_EXIT_PLUS(RC_RSA_Encrypt_label); |
| 422 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 423 |
result = TPM2_RSA_Encrypt (in, out); |
| 424 |
rSize = sizeof(RSA_Encrypt_Out); |
| 425 |
*respParmSize += TPM2B_PUBLIC_KEY_RSA_Marshal(&out->outData, |
| 426 |
responseBuffer, &rSize); |
| 427 |
break; |
| 428 |
} |
| 429 |
#endif // CC_RSA_Encrypt |
| 430 |
#if CC_RSA_Decrypt |
| 431 |
case TPM_CC_RSA_Decrypt: { |
| 432 |
RSA_Decrypt_In *in = (RSA_Decrypt_In *) |
| 433 |
MemoryGetInBuffer(sizeof(RSA_Decrypt_In)); |
| 434 |
RSA_Decrypt_Out *out = (RSA_Decrypt_Out *) |
| 435 |
MemoryGetOutBuffer(sizeof(RSA_Decrypt_Out)); |
| 436 |
in->keyHandle = handles[0]; |
| 437 |
result = TPM2B_PUBLIC_KEY_RSA_Unmarshal(&in->cipherText, paramBuffer, paramBufferSize); |
| 438 |
ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_cipherText); |
| 439 |
result = TPMT_RSA_DECRYPT_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 440 |
ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_inScheme); |
| 441 |
result = TPM2B_DATA_Unmarshal(&in->label, paramBuffer, paramBufferSize); |
| 442 |
ERROR_IF_EXIT_PLUS(RC_RSA_Decrypt_label); |
| 443 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 444 |
result = TPM2_RSA_Decrypt (in, out); |
| 445 |
rSize = sizeof(RSA_Decrypt_Out); |
| 446 |
*respParmSize += TPM2B_PUBLIC_KEY_RSA_Marshal(&out->message, |
| 447 |
responseBuffer, &rSize); |
| 448 |
break; |
| 449 |
} |
| 450 |
#endif // CC_RSA_Decrypt |
| 451 |
#if CC_ECDH_KeyGen |
| 452 |
case TPM_CC_ECDH_KeyGen: { |
| 453 |
ECDH_KeyGen_In *in = (ECDH_KeyGen_In *) |
| 454 |
MemoryGetInBuffer(sizeof(ECDH_KeyGen_In)); |
| 455 |
ECDH_KeyGen_Out *out = (ECDH_KeyGen_Out *) |
| 456 |
MemoryGetOutBuffer(sizeof(ECDH_KeyGen_Out)); |
| 457 |
in->keyHandle = handles[0]; |
| 458 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 459 |
result = TPM2_ECDH_KeyGen (in, out); |
| 460 |
rSize = sizeof(ECDH_KeyGen_Out); |
| 461 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->zPoint, |
| 462 |
responseBuffer, &rSize); |
| 463 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->pubPoint, |
| 464 |
responseBuffer, &rSize); |
| 465 |
break; |
| 466 |
} |
| 467 |
#endif // CC_ECDH_KeyGen |
| 468 |
#if CC_ECDH_ZGen |
| 469 |
case TPM_CC_ECDH_ZGen: { |
| 470 |
ECDH_ZGen_In *in = (ECDH_ZGen_In *) |
| 471 |
MemoryGetInBuffer(sizeof(ECDH_ZGen_In)); |
| 472 |
ECDH_ZGen_Out *out = (ECDH_ZGen_Out *) |
| 473 |
MemoryGetOutBuffer(sizeof(ECDH_ZGen_Out)); |
| 474 |
in->keyHandle = handles[0]; |
| 475 |
result = TPM2B_ECC_POINT_Unmarshal(&in->inPoint, paramBuffer, paramBufferSize); |
| 476 |
ERROR_IF_EXIT_PLUS(RC_ECDH_ZGen_inPoint); |
| 477 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 478 |
result = TPM2_ECDH_ZGen (in, out); |
| 479 |
rSize = sizeof(ECDH_ZGen_Out); |
| 480 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->outPoint, |
| 481 |
responseBuffer, &rSize); |
| 482 |
break; |
| 483 |
} |
| 484 |
#endif // CC_ECDH_ZGen |
| 485 |
#if CC_ECC_Parameters |
| 486 |
case TPM_CC_ECC_Parameters: { |
| 487 |
ECC_Parameters_In *in = (ECC_Parameters_In *) |
| 488 |
MemoryGetInBuffer(sizeof(ECC_Parameters_In)); |
| 489 |
ECC_Parameters_Out *out = (ECC_Parameters_Out *) |
| 490 |
MemoryGetOutBuffer(sizeof(ECC_Parameters_Out)); |
| 491 |
result = TPMI_ECC_CURVE_Unmarshal(&in->curveID, paramBuffer, paramBufferSize); |
| 492 |
ERROR_IF_EXIT_PLUS(RC_ECC_Parameters_curveID); |
| 493 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 494 |
result = TPM2_ECC_Parameters (in, out); |
| 495 |
rSize = sizeof(ECC_Parameters_Out); |
| 496 |
*respParmSize += TPMS_ALGORITHM_DETAIL_ECC_Marshal(&out->parameters, |
| 497 |
responseBuffer, &rSize); |
| 498 |
break; |
| 499 |
} |
| 500 |
#endif // CC_ECC_Parameters |
| 501 |
#if CC_ZGen_2Phase |
| 502 |
case TPM_CC_ZGen_2Phase: { |
| 503 |
ZGen_2Phase_In *in = (ZGen_2Phase_In *) |
| 504 |
MemoryGetInBuffer(sizeof(ZGen_2Phase_In)); |
| 505 |
ZGen_2Phase_Out *out = (ZGen_2Phase_Out *) |
| 506 |
MemoryGetOutBuffer(sizeof(ZGen_2Phase_Out)); |
| 507 |
in->keyA = handles[0]; |
| 508 |
result = TPM2B_ECC_POINT_Unmarshal(&in->inQsB, paramBuffer, paramBufferSize); |
| 509 |
ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inQsB); |
| 510 |
result = TPM2B_ECC_POINT_Unmarshal(&in->inQeB, paramBuffer, paramBufferSize); |
| 511 |
ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inQeB); |
| 512 |
result = TPMI_ECC_KEY_EXCHANGE_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, FALSE); |
| 513 |
ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_inScheme); |
| 514 |
result = UINT16_Unmarshal(&in->counter, paramBuffer, paramBufferSize); |
| 515 |
ERROR_IF_EXIT_PLUS(RC_ZGen_2Phase_counter); |
| 516 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 517 |
result = TPM2_ZGen_2Phase (in, out); |
| 518 |
rSize = sizeof(ZGen_2Phase_Out); |
| 519 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->outZ1, |
| 520 |
responseBuffer, &rSize); |
| 521 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->outZ2, |
| 522 |
responseBuffer, &rSize); |
| 523 |
break; |
| 524 |
} |
| 525 |
#endif // CC_ZGen_2Phase |
| 526 |
#if CC_EncryptDecrypt |
| 527 |
case TPM_CC_EncryptDecrypt: { |
| 528 |
EncryptDecrypt_In *in = (EncryptDecrypt_In *) |
| 529 |
MemoryGetInBuffer(sizeof(EncryptDecrypt_In)); |
| 530 |
EncryptDecrypt_Out *out = (EncryptDecrypt_Out *) |
| 531 |
MemoryGetOutBuffer(sizeof(EncryptDecrypt_Out)); |
| 532 |
in->keyHandle = handles[0]; |
| 533 |
result = TPMI_YES_NO_Unmarshal(&in->decrypt, paramBuffer, paramBufferSize); |
| 534 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_decrypt); |
| 535 |
result = TPMI_ALG_CIPHER_MODE_Unmarshal(&in->mode, paramBuffer, paramBufferSize, TRUE); |
| 536 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_mode); |
| 537 |
result = TPM2B_IV_Unmarshal(&in->ivIn, paramBuffer, paramBufferSize); |
| 538 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_ivIn); |
| 539 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->inData, paramBuffer, paramBufferSize); |
| 540 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt_inData); |
| 541 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 542 |
result = TPM2_EncryptDecrypt (in, out); |
| 543 |
rSize = sizeof(EncryptDecrypt_Out); |
| 544 |
*respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, |
| 545 |
responseBuffer, &rSize); |
| 546 |
*respParmSize += TPM2B_IV_Marshal(&out->ivOut, |
| 547 |
responseBuffer, &rSize); |
| 548 |
break; |
| 549 |
} |
| 550 |
#endif // CC_EncryptDecrypt |
| 551 |
#if CC_EncryptDecrypt2 |
| 552 |
case TPM_CC_EncryptDecrypt2: { |
| 553 |
EncryptDecrypt2_In *in = (EncryptDecrypt2_In *) |
| 554 |
MemoryGetInBuffer(sizeof(EncryptDecrypt2_In)); |
| 555 |
EncryptDecrypt2_Out *out = (EncryptDecrypt2_Out *) |
| 556 |
MemoryGetOutBuffer(sizeof(EncryptDecrypt2_Out)); |
| 557 |
in->keyHandle = handles[0]; |
| 558 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->inData, paramBuffer, paramBufferSize); |
| 559 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_inData); |
| 560 |
result = TPMI_YES_NO_Unmarshal(&in->decrypt, paramBuffer, paramBufferSize); |
| 561 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_decrypt); |
| 562 |
result = TPMI_ALG_CIPHER_MODE_Unmarshal(&in->mode, paramBuffer, paramBufferSize, TRUE); |
| 563 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_mode); |
| 564 |
result = TPM2B_IV_Unmarshal(&in->ivIn, paramBuffer, paramBufferSize); |
| 565 |
ERROR_IF_EXIT_PLUS(RC_EncryptDecrypt2_ivIn); |
| 566 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 567 |
result = TPM2_EncryptDecrypt2 (in, out); |
| 568 |
rSize = sizeof(EncryptDecrypt2_Out); |
| 569 |
*respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->outData, |
| 570 |
responseBuffer, &rSize); |
| 571 |
*respParmSize += TPM2B_IV_Marshal(&out->ivOut, |
| 572 |
responseBuffer, &rSize); |
| 573 |
break; |
| 574 |
} |
| 575 |
#endif // CC_EncryptDecrypt2 |
| 576 |
#if CC_Hash |
| 577 |
case TPM_CC_Hash: { |
| 578 |
Hash_In *in = (Hash_In *) |
| 579 |
MemoryGetInBuffer(sizeof(Hash_In)); |
| 580 |
Hash_Out *out = (Hash_Out *) |
| 581 |
MemoryGetOutBuffer(sizeof(Hash_Out)); |
| 582 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); |
| 583 |
ERROR_IF_EXIT_PLUS(RC_Hash_data); |
| 584 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, FALSE); |
| 585 |
ERROR_IF_EXIT_PLUS(RC_Hash_hashAlg); |
| 586 |
result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); |
| 587 |
ERROR_IF_EXIT_PLUS(RC_Hash_hierarchy); |
| 588 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 589 |
result = TPM2_Hash (in, out); |
| 590 |
rSize = sizeof(Hash_Out); |
| 591 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->outHash, |
| 592 |
responseBuffer, &rSize); |
| 593 |
*respParmSize += TPMT_TK_HASHCHECK_Marshal(&out->validation, |
| 594 |
responseBuffer, &rSize); |
| 595 |
break; |
| 596 |
} |
| 597 |
#endif // CC_Hash |
| 598 |
#if CC_HMAC |
| 599 |
case TPM_CC_HMAC: { |
| 600 |
HMAC_In *in = (HMAC_In *) |
| 601 |
MemoryGetInBuffer(sizeof(HMAC_In)); |
| 602 |
HMAC_Out *out = (HMAC_Out *) |
| 603 |
MemoryGetOutBuffer(sizeof(HMAC_Out)); |
| 604 |
in->handle = handles[0]; |
| 605 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); |
| 606 |
ERROR_IF_EXIT_PLUS(RC_HMAC_buffer); |
| 607 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); |
| 608 |
ERROR_IF_EXIT_PLUS(RC_HMAC_hashAlg); |
| 609 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 610 |
result = TPM2_HMAC (in, out); |
| 611 |
rSize = sizeof(HMAC_Out); |
| 612 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->outHMAC, |
| 613 |
responseBuffer, &rSize); |
| 614 |
break; |
| 615 |
} |
| 616 |
#endif // CC_HMAC |
| 617 |
#if CC_MAC |
| 618 |
case TPM_CC_MAC: { |
| 619 |
MAC_In *in = (MAC_In *) |
| 620 |
MemoryGetInBuffer(sizeof(MAC_In)); |
| 621 |
MAC_Out *out = (MAC_Out *) |
| 622 |
MemoryGetOutBuffer(sizeof(MAC_Out)); |
| 623 |
in->handle = handles[0]; |
| 624 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); |
| 625 |
ERROR_IF_EXIT_PLUS(RC_MAC_buffer); |
| 626 |
result = TPMI_ALG_MAC_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 627 |
ERROR_IF_EXIT_PLUS(RC_MAC_inScheme); |
| 628 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 629 |
result = TPM2_MAC (in, out); |
| 630 |
rSize = sizeof(MAC_Out); |
| 631 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->outMAC, |
| 632 |
responseBuffer, &rSize); |
| 633 |
break; |
| 634 |
} |
| 635 |
#endif // CC_MAC |
| 636 |
#if CC_GetRandom |
| 637 |
case TPM_CC_GetRandom: { |
| 638 |
GetRandom_In *in = (GetRandom_In *) |
| 639 |
MemoryGetInBuffer(sizeof(GetRandom_In)); |
| 640 |
GetRandom_Out *out = (GetRandom_Out *) |
| 641 |
MemoryGetOutBuffer(sizeof(GetRandom_Out)); |
| 642 |
result = UINT16_Unmarshal(&in->bytesRequested, paramBuffer, paramBufferSize); |
| 643 |
ERROR_IF_EXIT_PLUS(RC_GetRandom_bytesRequested); |
| 644 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 645 |
result = TPM2_GetRandom (in, out); |
| 646 |
rSize = sizeof(GetRandom_Out); |
| 647 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->randomBytes, |
| 648 |
responseBuffer, &rSize); |
| 649 |
break; |
| 650 |
} |
| 651 |
#endif // CC_GetRandom |
| 652 |
#if CC_StirRandom |
| 653 |
case TPM_CC_StirRandom: { |
| 654 |
StirRandom_In *in = (StirRandom_In *) |
| 655 |
MemoryGetInBuffer(sizeof(StirRandom_In)); |
| 656 |
result = TPM2B_SENSITIVE_DATA_Unmarshal(&in->inData, paramBuffer, paramBufferSize); |
| 657 |
ERROR_IF_EXIT_PLUS(RC_StirRandom_inData); |
| 658 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 659 |
result = TPM2_StirRandom (in); |
| 660 |
break; |
| 661 |
} |
| 662 |
#endif // CC_StirRandom |
| 663 |
#if CC_HMAC_Start |
| 664 |
case TPM_CC_HMAC_Start: { |
| 665 |
HMAC_Start_In *in = (HMAC_Start_In *) |
| 666 |
MemoryGetInBuffer(sizeof(HMAC_Start_In)); |
| 667 |
HMAC_Start_Out *out = (HMAC_Start_Out *) |
| 668 |
MemoryGetOutBuffer(sizeof(HMAC_Start_Out)); |
| 669 |
in->handle = handles[0]; |
| 670 |
result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); |
| 671 |
ERROR_IF_EXIT_PLUS(RC_HMAC_Start_auth); |
| 672 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); |
| 673 |
ERROR_IF_EXIT_PLUS(RC_HMAC_Start_hashAlg); |
| 674 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 675 |
result = TPM2_HMAC_Start (in, out); |
| 676 |
rSize = sizeof(HMAC_Start_Out); |
| 677 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 678 |
; command->handles[command->handleNum++] = out->sequenceHandle; |
| 679 |
break; |
| 680 |
} |
| 681 |
#endif // CC_HMAC_Start |
| 682 |
#if CC_MAC_Start |
| 683 |
case TPM_CC_MAC_Start: { |
| 684 |
MAC_Start_In *in = (MAC_Start_In *) |
| 685 |
MemoryGetInBuffer(sizeof(MAC_Start_In)); |
| 686 |
MAC_Start_Out *out = (MAC_Start_Out *) |
| 687 |
MemoryGetOutBuffer(sizeof(MAC_Start_Out)); |
| 688 |
in->handle = handles[0]; |
| 689 |
result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); |
| 690 |
ERROR_IF_EXIT_PLUS(RC_MAC_Start_auth); |
| 691 |
result = TPMI_ALG_MAC_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 692 |
ERROR_IF_EXIT_PLUS(RC_MAC_Start_inScheme); |
| 693 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 694 |
result = TPM2_MAC_Start (in, out); |
| 695 |
rSize = sizeof(MAC_Start_Out); |
| 696 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 697 |
; command->handles[command->handleNum++] = out->sequenceHandle; |
| 698 |
break; |
| 699 |
} |
| 700 |
#endif // CC_MAC_Start |
| 701 |
#if CC_HashSequenceStart |
| 702 |
case TPM_CC_HashSequenceStart: { |
| 703 |
HashSequenceStart_In *in = (HashSequenceStart_In *) |
| 704 |
MemoryGetInBuffer(sizeof(HashSequenceStart_In)); |
| 705 |
HashSequenceStart_Out *out = (HashSequenceStart_Out *) |
| 706 |
MemoryGetOutBuffer(sizeof(HashSequenceStart_Out)); |
| 707 |
result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); |
| 708 |
ERROR_IF_EXIT_PLUS(RC_HashSequenceStart_auth); |
| 709 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); |
| 710 |
ERROR_IF_EXIT_PLUS(RC_HashSequenceStart_hashAlg); |
| 711 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 712 |
result = TPM2_HashSequenceStart (in, out); |
| 713 |
rSize = sizeof(HashSequenceStart_Out); |
| 714 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 715 |
; command->handles[command->handleNum++] = out->sequenceHandle; |
| 716 |
break; |
| 717 |
} |
| 718 |
#endif // CC_HashSequenceStart |
| 719 |
#if CC_SequenceUpdate |
| 720 |
case TPM_CC_SequenceUpdate: { |
| 721 |
SequenceUpdate_In *in = (SequenceUpdate_In *) |
| 722 |
MemoryGetInBuffer(sizeof(SequenceUpdate_In)); |
| 723 |
in->sequenceHandle = handles[0]; |
| 724 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); |
| 725 |
ERROR_IF_EXIT_PLUS(RC_SequenceUpdate_buffer); |
| 726 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 727 |
result = TPM2_SequenceUpdate (in); |
| 728 |
break; |
| 729 |
} |
| 730 |
#endif // CC_SequenceUpdate |
| 731 |
#if CC_SequenceComplete |
| 732 |
case TPM_CC_SequenceComplete: { |
| 733 |
SequenceComplete_In *in = (SequenceComplete_In *) |
| 734 |
MemoryGetInBuffer(sizeof(SequenceComplete_In)); |
| 735 |
SequenceComplete_Out *out = (SequenceComplete_Out *) |
| 736 |
MemoryGetOutBuffer(sizeof(SequenceComplete_Out)); |
| 737 |
in->sequenceHandle = handles[0]; |
| 738 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); |
| 739 |
ERROR_IF_EXIT_PLUS(RC_SequenceComplete_buffer); |
| 740 |
result = TPMI_RH_HIERARCHY_Unmarshal(&in->hierarchy, paramBuffer, paramBufferSize, TRUE); |
| 741 |
ERROR_IF_EXIT_PLUS(RC_SequenceComplete_hierarchy); |
| 742 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 743 |
result = TPM2_SequenceComplete (in, out); |
| 744 |
rSize = sizeof(SequenceComplete_Out); |
| 745 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->result, |
| 746 |
responseBuffer, &rSize); |
| 747 |
*respParmSize += TPMT_TK_HASHCHECK_Marshal(&out->validation, |
| 748 |
responseBuffer, &rSize); |
| 749 |
break; |
| 750 |
} |
| 751 |
#endif // CC_SequenceComplete |
| 752 |
#if CC_EventSequenceComplete |
| 753 |
case TPM_CC_EventSequenceComplete: { |
| 754 |
EventSequenceComplete_In *in = (EventSequenceComplete_In *) |
| 755 |
MemoryGetInBuffer(sizeof(EventSequenceComplete_In)); |
| 756 |
EventSequenceComplete_Out *out = (EventSequenceComplete_Out *) |
| 757 |
MemoryGetOutBuffer(sizeof(EventSequenceComplete_Out)); |
| 758 |
in->pcrHandle = handles[0]; |
| 759 |
in->sequenceHandle = handles[1]; |
| 760 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->buffer, paramBuffer, paramBufferSize); |
| 761 |
ERROR_IF_EXIT_PLUS(RC_EventSequenceComplete_buffer); |
| 762 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 763 |
result = TPM2_EventSequenceComplete (in, out); |
| 764 |
rSize = sizeof(EventSequenceComplete_Out); |
| 765 |
*respParmSize += TPML_DIGEST_VALUES_Marshal(&out->results, |
| 766 |
responseBuffer, &rSize); |
| 767 |
break; |
| 768 |
} |
| 769 |
#endif // CC_EventSequenceComplete |
| 770 |
#if CC_Certify |
| 771 |
case TPM_CC_Certify: { |
| 772 |
Certify_In *in = (Certify_In *) |
| 773 |
MemoryGetInBuffer(sizeof(Certify_In)); |
| 774 |
Certify_Out *out = (Certify_Out *) |
| 775 |
MemoryGetOutBuffer(sizeof(Certify_Out)); |
| 776 |
in->objectHandle = handles[0]; |
| 777 |
in->signHandle = handles[1]; |
| 778 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 779 |
ERROR_IF_EXIT_PLUS(RC_Certify_qualifyingData); |
| 780 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 781 |
ERROR_IF_EXIT_PLUS(RC_Certify_inScheme); |
| 782 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 783 |
result = TPM2_Certify (in, out); |
| 784 |
rSize = sizeof(Certify_Out); |
| 785 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, |
| 786 |
responseBuffer, &rSize); |
| 787 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 788 |
responseBuffer, &rSize); |
| 789 |
break; |
| 790 |
} |
| 791 |
#endif // CC_Certify |
| 792 |
#if CC_CertifyCreation |
| 793 |
case TPM_CC_CertifyCreation: { |
| 794 |
CertifyCreation_In *in = (CertifyCreation_In *) |
| 795 |
MemoryGetInBuffer(sizeof(CertifyCreation_In)); |
| 796 |
CertifyCreation_Out *out = (CertifyCreation_Out *) |
| 797 |
MemoryGetOutBuffer(sizeof(CertifyCreation_Out)); |
| 798 |
in->signHandle = handles[0]; |
| 799 |
in->objectHandle = handles[1]; |
| 800 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 801 |
ERROR_IF_EXIT_PLUS(RC_CertifyCreation_qualifyingData); |
| 802 |
result = TPM2B_DIGEST_Unmarshal(&in->creationHash, paramBuffer, paramBufferSize); |
| 803 |
ERROR_IF_EXIT_PLUS(RC_CertifyCreation_creationHash); |
| 804 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 805 |
ERROR_IF_EXIT_PLUS(RC_CertifyCreation_inScheme); |
| 806 |
result = TPMT_TK_CREATION_Unmarshal(&in->creationTicket, paramBuffer, paramBufferSize); |
| 807 |
ERROR_IF_EXIT_PLUS(RC_CertifyCreation_creationTicket); |
| 808 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 809 |
result = TPM2_CertifyCreation (in, out); |
| 810 |
rSize = sizeof(CertifyCreation_Out); |
| 811 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, |
| 812 |
responseBuffer, &rSize); |
| 813 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 814 |
responseBuffer, &rSize); |
| 815 |
break; |
| 816 |
} |
| 817 |
#endif // CC_CertifyCreation |
| 818 |
#if CC_Quote |
| 819 |
case TPM_CC_Quote: { |
| 820 |
Quote_In *in = (Quote_In *) |
| 821 |
MemoryGetInBuffer(sizeof(Quote_In)); |
| 822 |
Quote_Out *out = (Quote_Out *) |
| 823 |
MemoryGetOutBuffer(sizeof(Quote_Out)); |
| 824 |
in->signHandle = handles[0]; |
| 825 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 826 |
ERROR_IF_EXIT_PLUS(RC_Quote_qualifyingData); |
| 827 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 828 |
ERROR_IF_EXIT_PLUS(RC_Quote_inScheme); |
| 829 |
result = TPML_PCR_SELECTION_Unmarshal(&in->PCRselect, paramBuffer, paramBufferSize); |
| 830 |
ERROR_IF_EXIT_PLUS(RC_Quote_PCRselect); |
| 831 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 832 |
result = TPM2_Quote (in, out); |
| 833 |
rSize = sizeof(Quote_Out); |
| 834 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->quoted, |
| 835 |
responseBuffer, &rSize); |
| 836 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 837 |
responseBuffer, &rSize); |
| 838 |
break; |
| 839 |
} |
| 840 |
#endif // CC_Quote |
| 841 |
#if CC_GetSessionAuditDigest |
| 842 |
case TPM_CC_GetSessionAuditDigest: { |
| 843 |
GetSessionAuditDigest_In *in = (GetSessionAuditDigest_In *) |
| 844 |
MemoryGetInBuffer(sizeof(GetSessionAuditDigest_In)); |
| 845 |
GetSessionAuditDigest_Out *out = (GetSessionAuditDigest_Out *) |
| 846 |
MemoryGetOutBuffer(sizeof(GetSessionAuditDigest_Out)); |
| 847 |
in->privacyAdminHandle = handles[0]; |
| 848 |
in->signHandle = handles[1]; |
| 849 |
in->sessionHandle = handles[2]; |
| 850 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 851 |
ERROR_IF_EXIT_PLUS(RC_GetSessionAuditDigest_qualifyingData); |
| 852 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 853 |
ERROR_IF_EXIT_PLUS(RC_GetSessionAuditDigest_inScheme); |
| 854 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 855 |
result = TPM2_GetSessionAuditDigest (in, out); |
| 856 |
rSize = sizeof(GetSessionAuditDigest_Out); |
| 857 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->auditInfo, |
| 858 |
responseBuffer, &rSize); |
| 859 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 860 |
responseBuffer, &rSize); |
| 861 |
break; |
| 862 |
} |
| 863 |
#endif // CC_GetSessionAuditDigest |
| 864 |
#if CC_GetCommandAuditDigest |
| 865 |
case TPM_CC_GetCommandAuditDigest: { |
| 866 |
GetCommandAuditDigest_In *in = (GetCommandAuditDigest_In *) |
| 867 |
MemoryGetInBuffer(sizeof(GetCommandAuditDigest_In)); |
| 868 |
GetCommandAuditDigest_Out *out = (GetCommandAuditDigest_Out *) |
| 869 |
MemoryGetOutBuffer(sizeof(GetCommandAuditDigest_Out)); |
| 870 |
in->privacyHandle = handles[0]; |
| 871 |
in->signHandle = handles[1]; |
| 872 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 873 |
ERROR_IF_EXIT_PLUS(RC_GetCommandAuditDigest_qualifyingData); |
| 874 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 875 |
ERROR_IF_EXIT_PLUS(RC_GetCommandAuditDigest_inScheme); |
| 876 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 877 |
result = TPM2_GetCommandAuditDigest (in, out); |
| 878 |
rSize = sizeof(GetCommandAuditDigest_Out); |
| 879 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->auditInfo, |
| 880 |
responseBuffer, &rSize); |
| 881 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 882 |
responseBuffer, &rSize); |
| 883 |
break; |
| 884 |
} |
| 885 |
#endif // CC_GetCommandAuditDigest |
| 886 |
#if CC_GetTime |
| 887 |
case TPM_CC_GetTime: { |
| 888 |
GetTime_In *in = (GetTime_In *) |
| 889 |
MemoryGetInBuffer(sizeof(GetTime_In)); |
| 890 |
GetTime_Out *out = (GetTime_Out *) |
| 891 |
MemoryGetOutBuffer(sizeof(GetTime_Out)); |
| 892 |
in->privacyAdminHandle = handles[0]; |
| 893 |
in->signHandle = handles[1]; |
| 894 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 895 |
ERROR_IF_EXIT_PLUS(RC_GetTime_qualifyingData); |
| 896 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 897 |
ERROR_IF_EXIT_PLUS(RC_GetTime_inScheme); |
| 898 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 899 |
result = TPM2_GetTime (in, out); |
| 900 |
rSize = sizeof(GetTime_Out); |
| 901 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->timeInfo, |
| 902 |
responseBuffer, &rSize); |
| 903 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 904 |
responseBuffer, &rSize); |
| 905 |
break; |
| 906 |
} |
| 907 |
#endif // CC_GetTime |
| 908 |
#if CC_CertifyX509 |
| 909 |
case TPM_CC_CertifyX509: { |
| 910 |
CertifyX509_In *in = (CertifyX509_In *) |
| 911 |
MemoryGetInBuffer(sizeof(CertifyX509_In)); |
| 912 |
CertifyX509_Out *out = (CertifyX509_Out *) |
| 913 |
MemoryGetOutBuffer(sizeof(CertifyX509_Out)); |
| 914 |
in->objectHandle = handles[0]; |
| 915 |
in->signHandle = handles[1]; |
| 916 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 917 |
ERROR_IF_EXIT_PLUS(RC_CertifyX509_qualifyingData); |
| 918 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 919 |
ERROR_IF_EXIT_PLUS(RC_CertifyX509_inScheme); |
| 920 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->partialCertificate, paramBuffer, paramBufferSize); |
| 921 |
ERROR_IF_EXIT_PLUS(RC_CertifyX509_partialCertificate); |
| 922 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 923 |
result = TPM2_CertifyX509 (in, out); |
| 924 |
rSize = sizeof(CertifyX509_Out); |
| 925 |
*respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->addedToCertificate, |
| 926 |
responseBuffer, &rSize); |
| 927 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->tbsDigest, |
| 928 |
responseBuffer, &rSize); |
| 929 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 930 |
responseBuffer, &rSize); |
| 931 |
break; |
| 932 |
} |
| 933 |
#endif // CC_CertifyX509 |
| 934 |
#if CC_Commit |
| 935 |
case TPM_CC_Commit: { |
| 936 |
Commit_In *in = (Commit_In *) |
| 937 |
MemoryGetInBuffer(sizeof(Commit_In)); |
| 938 |
Commit_Out *out = (Commit_Out *) |
| 939 |
MemoryGetOutBuffer(sizeof(Commit_Out)); |
| 940 |
in->signHandle = handles[0]; |
| 941 |
result = TPM2B_ECC_POINT_Unmarshal(&in->P1, paramBuffer, paramBufferSize); |
| 942 |
ERROR_IF_EXIT_PLUS(RC_Commit_P1); |
| 943 |
result = TPM2B_SENSITIVE_DATA_Unmarshal(&in->s2, paramBuffer, paramBufferSize); |
| 944 |
ERROR_IF_EXIT_PLUS(RC_Commit_s2); |
| 945 |
result = TPM2B_ECC_PARAMETER_Unmarshal(&in->y2, paramBuffer, paramBufferSize); |
| 946 |
ERROR_IF_EXIT_PLUS(RC_Commit_y2); |
| 947 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 948 |
result = TPM2_Commit (in, out); |
| 949 |
rSize = sizeof(Commit_Out); |
| 950 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->K, |
| 951 |
responseBuffer, &rSize); |
| 952 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->L, |
| 953 |
responseBuffer, &rSize); |
| 954 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->E, |
| 955 |
responseBuffer, &rSize); |
| 956 |
*respParmSize += UINT16_Marshal(&out->counter, |
| 957 |
responseBuffer, &rSize); |
| 958 |
break; |
| 959 |
} |
| 960 |
#endif // CC_Commit |
| 961 |
#if CC_EC_Ephemeral |
| 962 |
case TPM_CC_EC_Ephemeral: { |
| 963 |
EC_Ephemeral_In *in = (EC_Ephemeral_In *) |
| 964 |
MemoryGetInBuffer(sizeof(EC_Ephemeral_In)); |
| 965 |
EC_Ephemeral_Out *out = (EC_Ephemeral_Out *) |
| 966 |
MemoryGetOutBuffer(sizeof(EC_Ephemeral_Out)); |
| 967 |
result = TPMI_ECC_CURVE_Unmarshal(&in->curveID, paramBuffer, paramBufferSize); |
| 968 |
ERROR_IF_EXIT_PLUS(RC_EC_Ephemeral_curveID); |
| 969 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 970 |
result = TPM2_EC_Ephemeral (in, out); |
| 971 |
rSize = sizeof(EC_Ephemeral_Out); |
| 972 |
*respParmSize += TPM2B_ECC_POINT_Marshal(&out->Q, |
| 973 |
responseBuffer, &rSize); |
| 974 |
*respParmSize += UINT16_Marshal(&out->counter, |
| 975 |
responseBuffer, &rSize); |
| 976 |
break; |
| 977 |
} |
| 978 |
#endif // CC_EC_Ephemeral |
| 979 |
#if CC_VerifySignature |
| 980 |
case TPM_CC_VerifySignature: { |
| 981 |
VerifySignature_In *in = (VerifySignature_In *) |
| 982 |
MemoryGetInBuffer(sizeof(VerifySignature_In)); |
| 983 |
VerifySignature_Out *out = (VerifySignature_Out *) |
| 984 |
MemoryGetOutBuffer(sizeof(VerifySignature_Out)); |
| 985 |
in->keyHandle = handles[0]; |
| 986 |
result = TPM2B_DIGEST_Unmarshal(&in->digest, paramBuffer, paramBufferSize); |
| 987 |
ERROR_IF_EXIT_PLUS(RC_VerifySignature_digest); |
| 988 |
result = TPMT_SIGNATURE_Unmarshal(&in->signature, paramBuffer, paramBufferSize, FALSE); |
| 989 |
ERROR_IF_EXIT_PLUS(RC_VerifySignature_signature); |
| 990 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 991 |
result = TPM2_VerifySignature (in, out); |
| 992 |
rSize = sizeof(VerifySignature_Out); |
| 993 |
*respParmSize += TPMT_TK_VERIFIED_Marshal(&out->validation, |
| 994 |
responseBuffer, &rSize); |
| 995 |
break; |
| 996 |
} |
| 997 |
#endif // CC_VerifySignature |
| 998 |
#if CC_Sign |
| 999 |
case TPM_CC_Sign: { |
| 1000 |
Sign_In *in = (Sign_In *) |
| 1001 |
MemoryGetInBuffer(sizeof(Sign_In)); |
| 1002 |
Sign_Out *out = (Sign_Out *) |
| 1003 |
MemoryGetOutBuffer(sizeof(Sign_Out)); |
| 1004 |
in->keyHandle = handles[0]; |
| 1005 |
result = TPM2B_DIGEST_Unmarshal(&in->digest, paramBuffer, paramBufferSize); |
| 1006 |
ERROR_IF_EXIT_PLUS(RC_Sign_digest); |
| 1007 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 1008 |
ERROR_IF_EXIT_PLUS(RC_Sign_inScheme); |
| 1009 |
result = TPMT_TK_HASHCHECK_Unmarshal(&in->validation, paramBuffer, paramBufferSize); |
| 1010 |
ERROR_IF_EXIT_PLUS(RC_Sign_validation); |
| 1011 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1012 |
result = TPM2_Sign (in, out); |
| 1013 |
rSize = sizeof(Sign_Out); |
| 1014 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 1015 |
responseBuffer, &rSize); |
| 1016 |
break; |
| 1017 |
} |
| 1018 |
#endif // CC_Sign |
| 1019 |
#if CC_SetCommandCodeAuditStatus |
| 1020 |
case TPM_CC_SetCommandCodeAuditStatus: { |
| 1021 |
SetCommandCodeAuditStatus_In *in = (SetCommandCodeAuditStatus_In *) |
| 1022 |
MemoryGetInBuffer(sizeof(SetCommandCodeAuditStatus_In)); |
| 1023 |
in->auth = handles[0]; |
| 1024 |
result = TPMI_ALG_HASH_Unmarshal(&in->auditAlg, paramBuffer, paramBufferSize, TRUE); |
| 1025 |
ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_auditAlg); |
| 1026 |
result = TPML_CC_Unmarshal(&in->setList, paramBuffer, paramBufferSize); |
| 1027 |
ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_setList); |
| 1028 |
result = TPML_CC_Unmarshal(&in->clearList, paramBuffer, paramBufferSize); |
| 1029 |
ERROR_IF_EXIT_PLUS(RC_SetCommandCodeAuditStatus_clearList); |
| 1030 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1031 |
result = TPM2_SetCommandCodeAuditStatus (in); |
| 1032 |
break; |
| 1033 |
} |
| 1034 |
#endif // CC_SetCommandCodeAuditStatus |
| 1035 |
#if CC_PCR_Extend |
| 1036 |
case TPM_CC_PCR_Extend: { |
| 1037 |
PCR_Extend_In *in = (PCR_Extend_In *) |
| 1038 |
MemoryGetInBuffer(sizeof(PCR_Extend_In)); |
| 1039 |
in->pcrHandle = handles[0]; |
| 1040 |
result = TPML_DIGEST_VALUES_Unmarshal(&in->digests, paramBuffer, paramBufferSize); |
| 1041 |
ERROR_IF_EXIT_PLUS(RC_PCR_Extend_digests); |
| 1042 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1043 |
result = TPM2_PCR_Extend (in); |
| 1044 |
break; |
| 1045 |
} |
| 1046 |
#endif // CC_PCR_Extend |
| 1047 |
#if CC_PCR_Event |
| 1048 |
case TPM_CC_PCR_Event: { |
| 1049 |
PCR_Event_In *in = (PCR_Event_In *) |
| 1050 |
MemoryGetInBuffer(sizeof(PCR_Event_In)); |
| 1051 |
PCR_Event_Out *out = (PCR_Event_Out *) |
| 1052 |
MemoryGetOutBuffer(sizeof(PCR_Event_Out)); |
| 1053 |
in->pcrHandle = handles[0]; |
| 1054 |
result = TPM2B_EVENT_Unmarshal(&in->eventData, paramBuffer, paramBufferSize); |
| 1055 |
ERROR_IF_EXIT_PLUS(RC_PCR_Event_eventData); |
| 1056 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1057 |
result = TPM2_PCR_Event (in, out); |
| 1058 |
rSize = sizeof(PCR_Event_Out); |
| 1059 |
*respParmSize += TPML_DIGEST_VALUES_Marshal(&out->digests, |
| 1060 |
responseBuffer, &rSize); |
| 1061 |
break; |
| 1062 |
} |
| 1063 |
#endif // CC_PCR_Event |
| 1064 |
#if CC_PCR_Read |
| 1065 |
case TPM_CC_PCR_Read: { |
| 1066 |
PCR_Read_In *in = (PCR_Read_In *) |
| 1067 |
MemoryGetInBuffer(sizeof(PCR_Read_In)); |
| 1068 |
PCR_Read_Out *out = (PCR_Read_Out *) |
| 1069 |
MemoryGetOutBuffer(sizeof(PCR_Read_Out)); |
| 1070 |
result = TPML_PCR_SELECTION_Unmarshal(&in->pcrSelectionIn, paramBuffer, paramBufferSize); |
| 1071 |
ERROR_IF_EXIT_PLUS(RC_PCR_Read_pcrSelectionIn); |
| 1072 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1073 |
result = TPM2_PCR_Read (in, out); |
| 1074 |
rSize = sizeof(PCR_Read_Out); |
| 1075 |
*respParmSize += UINT32_Marshal(&out->pcrUpdateCounter, |
| 1076 |
responseBuffer, &rSize); |
| 1077 |
*respParmSize += TPML_PCR_SELECTION_Marshal(&out->pcrSelectionOut, |
| 1078 |
responseBuffer, &rSize); |
| 1079 |
*respParmSize += TPML_DIGEST_Marshal(&out->pcrValues, |
| 1080 |
responseBuffer, &rSize); |
| 1081 |
break; |
| 1082 |
} |
| 1083 |
#endif // CC_PCR_Read |
| 1084 |
#if CC_PCR_Allocate |
| 1085 |
case TPM_CC_PCR_Allocate: { |
| 1086 |
PCR_Allocate_In *in = (PCR_Allocate_In *) |
| 1087 |
MemoryGetInBuffer(sizeof(PCR_Allocate_In)); |
| 1088 |
PCR_Allocate_Out *out = (PCR_Allocate_Out *) |
| 1089 |
MemoryGetOutBuffer(sizeof(PCR_Allocate_Out)); |
| 1090 |
in->authHandle = handles[0]; |
| 1091 |
result = TPML_PCR_SELECTION_Unmarshal(&in->pcrAllocation, paramBuffer, paramBufferSize); |
| 1092 |
ERROR_IF_EXIT_PLUS(RC_PCR_Allocate_pcrAllocation); |
| 1093 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1094 |
result = TPM2_PCR_Allocate (in, out); |
| 1095 |
rSize = sizeof(PCR_Allocate_Out); |
| 1096 |
*respParmSize += TPMI_YES_NO_Marshal(&out->allocationSuccess, |
| 1097 |
responseBuffer, &rSize); |
| 1098 |
*respParmSize += UINT32_Marshal(&out->maxPCR, |
| 1099 |
responseBuffer, &rSize); |
| 1100 |
*respParmSize += UINT32_Marshal(&out->sizeNeeded, |
| 1101 |
responseBuffer, &rSize); |
| 1102 |
*respParmSize += UINT32_Marshal(&out->sizeAvailable, |
| 1103 |
responseBuffer, &rSize); |
| 1104 |
break; |
| 1105 |
} |
| 1106 |
#endif // CC_PCR_Allocate |
| 1107 |
#if CC_PCR_SetAuthPolicy |
| 1108 |
case TPM_CC_PCR_SetAuthPolicy: { |
| 1109 |
PCR_SetAuthPolicy_In *in = (PCR_SetAuthPolicy_In *) |
| 1110 |
MemoryGetInBuffer(sizeof(PCR_SetAuthPolicy_In)); |
| 1111 |
in->authHandle = handles[0]; |
| 1112 |
result = TPM2B_DIGEST_Unmarshal(&in->authPolicy, paramBuffer, paramBufferSize); |
| 1113 |
ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_authPolicy); |
| 1114 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); |
| 1115 |
ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_hashAlg); |
| 1116 |
result = TPMI_DH_PCR_Unmarshal(&in->pcrNum, paramBuffer, paramBufferSize, FALSE); |
| 1117 |
ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthPolicy_pcrNum); |
| 1118 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1119 |
result = TPM2_PCR_SetAuthPolicy (in); |
| 1120 |
break; |
| 1121 |
} |
| 1122 |
#endif // CC_PCR_SetAuthPolicy |
| 1123 |
#if CC_PCR_SetAuthValue |
| 1124 |
case TPM_CC_PCR_SetAuthValue: { |
| 1125 |
PCR_SetAuthValue_In *in = (PCR_SetAuthValue_In *) |
| 1126 |
MemoryGetInBuffer(sizeof(PCR_SetAuthValue_In)); |
| 1127 |
in->pcrHandle = handles[0]; |
| 1128 |
result = TPM2B_DIGEST_Unmarshal(&in->auth, paramBuffer, paramBufferSize); |
| 1129 |
ERROR_IF_EXIT_PLUS(RC_PCR_SetAuthValue_auth); |
| 1130 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1131 |
result = TPM2_PCR_SetAuthValue (in); |
| 1132 |
break; |
| 1133 |
} |
| 1134 |
#endif // CC_PCR_SetAuthValue |
| 1135 |
#if CC_PCR_Reset |
| 1136 |
case TPM_CC_PCR_Reset: { |
| 1137 |
PCR_Reset_In *in = (PCR_Reset_In *) |
| 1138 |
MemoryGetInBuffer(sizeof(PCR_Reset_In)); |
| 1139 |
in->pcrHandle = handles[0]; |
| 1140 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1141 |
result = TPM2_PCR_Reset (in); |
| 1142 |
break; |
| 1143 |
} |
| 1144 |
#endif // CC_PCR_Reset |
| 1145 |
#if CC_PolicySigned |
| 1146 |
case TPM_CC_PolicySigned: { |
| 1147 |
PolicySigned_In *in = (PolicySigned_In *) |
| 1148 |
MemoryGetInBuffer(sizeof(PolicySigned_In)); |
| 1149 |
PolicySigned_Out *out = (PolicySigned_Out *) |
| 1150 |
MemoryGetOutBuffer(sizeof(PolicySigned_Out)); |
| 1151 |
in->authObject = handles[0]; |
| 1152 |
in->policySession = handles[1]; |
| 1153 |
result = TPM2B_NONCE_Unmarshal(&in->nonceTPM, paramBuffer, paramBufferSize); |
| 1154 |
ERROR_IF_EXIT_PLUS(RC_PolicySigned_nonceTPM); |
| 1155 |
result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); |
| 1156 |
ERROR_IF_EXIT_PLUS(RC_PolicySigned_cpHashA); |
| 1157 |
result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); |
| 1158 |
ERROR_IF_EXIT_PLUS(RC_PolicySigned_policyRef); |
| 1159 |
result = INT32_Unmarshal(&in->expiration, paramBuffer, paramBufferSize); |
| 1160 |
ERROR_IF_EXIT_PLUS(RC_PolicySigned_expiration); |
| 1161 |
result = TPMT_SIGNATURE_Unmarshal(&in->auth, paramBuffer, paramBufferSize, FALSE); |
| 1162 |
ERROR_IF_EXIT_PLUS(RC_PolicySigned_auth); |
| 1163 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1164 |
result = TPM2_PolicySigned (in, out); |
| 1165 |
rSize = sizeof(PolicySigned_Out); |
| 1166 |
*respParmSize += TPM2B_TIMEOUT_Marshal(&out->timeout, |
| 1167 |
responseBuffer, &rSize); |
| 1168 |
*respParmSize += TPMT_TK_AUTH_Marshal(&out->policyTicket, |
| 1169 |
responseBuffer, &rSize); |
| 1170 |
break; |
| 1171 |
} |
| 1172 |
#endif // CC_PolicySigned |
| 1173 |
#if CC_PolicySecret |
| 1174 |
case TPM_CC_PolicySecret: { |
| 1175 |
PolicySecret_In *in = (PolicySecret_In *) |
| 1176 |
MemoryGetInBuffer(sizeof(PolicySecret_In)); |
| 1177 |
PolicySecret_Out *out = (PolicySecret_Out *) |
| 1178 |
MemoryGetOutBuffer(sizeof(PolicySecret_Out)); |
| 1179 |
in->authHandle = handles[0]; |
| 1180 |
in->policySession = handles[1]; |
| 1181 |
result = TPM2B_NONCE_Unmarshal(&in->nonceTPM, paramBuffer, paramBufferSize); |
| 1182 |
ERROR_IF_EXIT_PLUS(RC_PolicySecret_nonceTPM); |
| 1183 |
result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); |
| 1184 |
ERROR_IF_EXIT_PLUS(RC_PolicySecret_cpHashA); |
| 1185 |
result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); |
| 1186 |
ERROR_IF_EXIT_PLUS(RC_PolicySecret_policyRef); |
| 1187 |
result = INT32_Unmarshal(&in->expiration, paramBuffer, paramBufferSize); |
| 1188 |
ERROR_IF_EXIT_PLUS(RC_PolicySecret_expiration); |
| 1189 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1190 |
result = TPM2_PolicySecret (in, out); |
| 1191 |
rSize = sizeof(PolicySecret_Out); |
| 1192 |
*respParmSize += TPM2B_TIMEOUT_Marshal(&out->timeout, |
| 1193 |
responseBuffer, &rSize); |
| 1194 |
*respParmSize += TPMT_TK_AUTH_Marshal(&out->policyTicket, |
| 1195 |
responseBuffer, &rSize); |
| 1196 |
break; |
| 1197 |
} |
| 1198 |
#endif // CC_PolicySecret |
| 1199 |
#if CC_PolicyTicket |
| 1200 |
case TPM_CC_PolicyTicket: { |
| 1201 |
PolicyTicket_In *in = (PolicyTicket_In *) |
| 1202 |
MemoryGetInBuffer(sizeof(PolicyTicket_In)); |
| 1203 |
in->policySession = handles[0]; |
| 1204 |
result = TPM2B_TIMEOUT_Unmarshal(&in->timeout, paramBuffer, paramBufferSize); |
| 1205 |
ERROR_IF_EXIT_PLUS(RC_PolicyTicket_timeout); |
| 1206 |
result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); |
| 1207 |
ERROR_IF_EXIT_PLUS(RC_PolicyTicket_cpHashA); |
| 1208 |
result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); |
| 1209 |
ERROR_IF_EXIT_PLUS(RC_PolicyTicket_policyRef); |
| 1210 |
result = TPM2B_NAME_Unmarshal(&in->authName, paramBuffer, paramBufferSize); |
| 1211 |
ERROR_IF_EXIT_PLUS(RC_PolicyTicket_authName); |
| 1212 |
result = TPMT_TK_AUTH_Unmarshal(&in->ticket, paramBuffer, paramBufferSize); |
| 1213 |
ERROR_IF_EXIT_PLUS(RC_PolicyTicket_ticket); |
| 1214 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1215 |
result = TPM2_PolicyTicket (in); |
| 1216 |
break; |
| 1217 |
} |
| 1218 |
#endif // CC_PolicyTicket |
| 1219 |
#if CC_PolicyOR |
| 1220 |
case TPM_CC_PolicyOR: { |
| 1221 |
PolicyOR_In *in = (PolicyOR_In *) |
| 1222 |
MemoryGetInBuffer(sizeof(PolicyOR_In)); |
| 1223 |
in->policySession = handles[0]; |
| 1224 |
result = TPML_DIGEST_Unmarshal(&in->pHashList, paramBuffer, paramBufferSize); |
| 1225 |
ERROR_IF_EXIT_PLUS(RC_PolicyOR_pHashList); |
| 1226 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1227 |
result = TPM2_PolicyOR (in); |
| 1228 |
break; |
| 1229 |
} |
| 1230 |
#endif // CC_PolicyOR |
| 1231 |
#if CC_PolicyPCR |
| 1232 |
case TPM_CC_PolicyPCR: { |
| 1233 |
PolicyPCR_In *in = (PolicyPCR_In *) |
| 1234 |
MemoryGetInBuffer(sizeof(PolicyPCR_In)); |
| 1235 |
in->policySession = handles[0]; |
| 1236 |
result = TPM2B_DIGEST_Unmarshal(&in->pcrDigest, paramBuffer, paramBufferSize); |
| 1237 |
ERROR_IF_EXIT_PLUS(RC_PolicyPCR_pcrDigest); |
| 1238 |
result = TPML_PCR_SELECTION_Unmarshal(&in->pcrs, paramBuffer, paramBufferSize); |
| 1239 |
ERROR_IF_EXIT_PLUS(RC_PolicyPCR_pcrs); |
| 1240 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1241 |
result = TPM2_PolicyPCR (in); |
| 1242 |
break; |
| 1243 |
} |
| 1244 |
#endif // CC_PolicyPCR |
| 1245 |
#if CC_PolicyLocality |
| 1246 |
case TPM_CC_PolicyLocality: { |
| 1247 |
PolicyLocality_In *in = (PolicyLocality_In *) |
| 1248 |
MemoryGetInBuffer(sizeof(PolicyLocality_In)); |
| 1249 |
in->policySession = handles[0]; |
| 1250 |
result = TPMA_LOCALITY_Unmarshal(&in->locality, paramBuffer, paramBufferSize); |
| 1251 |
ERROR_IF_EXIT_PLUS(RC_PolicyLocality_locality); |
| 1252 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1253 |
result = TPM2_PolicyLocality (in); |
| 1254 |
break; |
| 1255 |
} |
| 1256 |
#endif // CC_PolicyLocality |
| 1257 |
#if CC_PolicyNV |
| 1258 |
case TPM_CC_PolicyNV: { |
| 1259 |
PolicyNV_In *in = (PolicyNV_In *) |
| 1260 |
MemoryGetInBuffer(sizeof(PolicyNV_In)); |
| 1261 |
in->authHandle = handles[0]; |
| 1262 |
in->nvIndex = handles[1]; |
| 1263 |
in->policySession = handles[2]; |
| 1264 |
result = TPM2B_OPERAND_Unmarshal(&in->operandB, paramBuffer, paramBufferSize); |
| 1265 |
ERROR_IF_EXIT_PLUS(RC_PolicyNV_operandB); |
| 1266 |
result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); |
| 1267 |
ERROR_IF_EXIT_PLUS(RC_PolicyNV_offset); |
| 1268 |
result = TPM_EO_Unmarshal(&in->operation, paramBuffer, paramBufferSize); |
| 1269 |
ERROR_IF_EXIT_PLUS(RC_PolicyNV_operation); |
| 1270 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1271 |
result = TPM2_PolicyNV (in); |
| 1272 |
break; |
| 1273 |
} |
| 1274 |
#endif // CC_PolicyNV |
| 1275 |
#if CC_PolicyCounterTimer |
| 1276 |
case TPM_CC_PolicyCounterTimer: { |
| 1277 |
PolicyCounterTimer_In *in = (PolicyCounterTimer_In *) |
| 1278 |
MemoryGetInBuffer(sizeof(PolicyCounterTimer_In)); |
| 1279 |
in->policySession = handles[0]; |
| 1280 |
result = TPM2B_OPERAND_Unmarshal(&in->operandB, paramBuffer, paramBufferSize); |
| 1281 |
ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_operandB); |
| 1282 |
result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); |
| 1283 |
ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_offset); |
| 1284 |
result = TPM_EO_Unmarshal(&in->operation, paramBuffer, paramBufferSize); |
| 1285 |
ERROR_IF_EXIT_PLUS(RC_PolicyCounterTimer_operation); |
| 1286 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1287 |
result = TPM2_PolicyCounterTimer (in); |
| 1288 |
break; |
| 1289 |
} |
| 1290 |
#endif // CC_PolicyCounterTimer |
| 1291 |
#if CC_PolicyCommandCode |
| 1292 |
case TPM_CC_PolicyCommandCode: { |
| 1293 |
PolicyCommandCode_In *in = (PolicyCommandCode_In *) |
| 1294 |
MemoryGetInBuffer(sizeof(PolicyCommandCode_In)); |
| 1295 |
in->policySession = handles[0]; |
| 1296 |
result = TPM_CC_Unmarshal(&in->code, paramBuffer, paramBufferSize); |
| 1297 |
ERROR_IF_EXIT_PLUS(RC_PolicyCommandCode_code); |
| 1298 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1299 |
result = TPM2_PolicyCommandCode (in); |
| 1300 |
break; |
| 1301 |
} |
| 1302 |
#endif // CC_PolicyCommandCode |
| 1303 |
#if CC_PolicyPhysicalPresence |
| 1304 |
case TPM_CC_PolicyPhysicalPresence: { |
| 1305 |
PolicyPhysicalPresence_In *in = (PolicyPhysicalPresence_In *) |
| 1306 |
MemoryGetInBuffer(sizeof(PolicyPhysicalPresence_In)); |
| 1307 |
in->policySession = handles[0]; |
| 1308 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1309 |
result = TPM2_PolicyPhysicalPresence (in); |
| 1310 |
break; |
| 1311 |
} |
| 1312 |
#endif // CC_PolicyPhysicalPresence |
| 1313 |
#if CC_PolicyCpHash |
| 1314 |
case TPM_CC_PolicyCpHash: { |
| 1315 |
PolicyCpHash_In *in = (PolicyCpHash_In *) |
| 1316 |
MemoryGetInBuffer(sizeof(PolicyCpHash_In)); |
| 1317 |
in->policySession = handles[0]; |
| 1318 |
result = TPM2B_DIGEST_Unmarshal(&in->cpHashA, paramBuffer, paramBufferSize); |
| 1319 |
ERROR_IF_EXIT_PLUS(RC_PolicyCpHash_cpHashA); |
| 1320 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1321 |
result = TPM2_PolicyCpHash (in); |
| 1322 |
break; |
| 1323 |
} |
| 1324 |
#endif // CC_PolicyCpHash |
| 1325 |
#if CC_PolicyNameHash |
| 1326 |
case TPM_CC_PolicyNameHash: { |
| 1327 |
PolicyNameHash_In *in = (PolicyNameHash_In *) |
| 1328 |
MemoryGetInBuffer(sizeof(PolicyNameHash_In)); |
| 1329 |
in->policySession = handles[0]; |
| 1330 |
result = TPM2B_DIGEST_Unmarshal(&in->nameHash, paramBuffer, paramBufferSize); |
| 1331 |
ERROR_IF_EXIT_PLUS(RC_PolicyNameHash_nameHash); |
| 1332 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1333 |
result = TPM2_PolicyNameHash (in); |
| 1334 |
break; |
| 1335 |
} |
| 1336 |
#endif // CC_PolicyNameHash |
| 1337 |
#if CC_PolicyDuplicationSelect |
| 1338 |
case TPM_CC_PolicyDuplicationSelect: { |
| 1339 |
PolicyDuplicationSelect_In *in = (PolicyDuplicationSelect_In *) |
| 1340 |
MemoryGetInBuffer(sizeof(PolicyDuplicationSelect_In)); |
| 1341 |
in->policySession = handles[0]; |
| 1342 |
result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); |
| 1343 |
ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_objectName); |
| 1344 |
result = TPM2B_NAME_Unmarshal(&in->newParentName, paramBuffer, paramBufferSize); |
| 1345 |
ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_newParentName); |
| 1346 |
result = TPMI_YES_NO_Unmarshal(&in->includeObject, paramBuffer, paramBufferSize); |
| 1347 |
ERROR_IF_EXIT_PLUS(RC_PolicyDuplicationSelect_includeObject); |
| 1348 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1349 |
result = TPM2_PolicyDuplicationSelect (in); |
| 1350 |
break; |
| 1351 |
} |
| 1352 |
#endif // CC_PolicyDuplicationSelect |
| 1353 |
#if CC_PolicyAuthorize |
| 1354 |
case TPM_CC_PolicyAuthorize: { |
| 1355 |
PolicyAuthorize_In *in = (PolicyAuthorize_In *) |
| 1356 |
MemoryGetInBuffer(sizeof(PolicyAuthorize_In)); |
| 1357 |
in->policySession = handles[0]; |
| 1358 |
result = TPM2B_DIGEST_Unmarshal(&in->approvedPolicy, paramBuffer, paramBufferSize); |
| 1359 |
ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_approvedPolicy); |
| 1360 |
result = TPM2B_NONCE_Unmarshal(&in->policyRef, paramBuffer, paramBufferSize); |
| 1361 |
ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_policyRef); |
| 1362 |
result = TPM2B_NAME_Unmarshal(&in->keySign, paramBuffer, paramBufferSize); |
| 1363 |
ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_keySign); |
| 1364 |
result = TPMT_TK_VERIFIED_Unmarshal(&in->checkTicket, paramBuffer, paramBufferSize); |
| 1365 |
ERROR_IF_EXIT_PLUS(RC_PolicyAuthorize_checkTicket); |
| 1366 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1367 |
result = TPM2_PolicyAuthorize (in); |
| 1368 |
break; |
| 1369 |
} |
| 1370 |
#endif // CC_PolicyAuthorize |
| 1371 |
#if CC_PolicyAuthValue |
| 1372 |
case TPM_CC_PolicyAuthValue: { |
| 1373 |
PolicyAuthValue_In *in = (PolicyAuthValue_In *) |
| 1374 |
MemoryGetInBuffer(sizeof(PolicyAuthValue_In)); |
| 1375 |
in->policySession = handles[0]; |
| 1376 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1377 |
result = TPM2_PolicyAuthValue (in); |
| 1378 |
break; |
| 1379 |
} |
| 1380 |
#endif // CC_PolicyAuthValue |
| 1381 |
#if CC_PolicyPassword |
| 1382 |
case TPM_CC_PolicyPassword: { |
| 1383 |
PolicyPassword_In *in = (PolicyPassword_In *) |
| 1384 |
MemoryGetInBuffer(sizeof(PolicyPassword_In)); |
| 1385 |
in->policySession = handles[0]; |
| 1386 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1387 |
result = TPM2_PolicyPassword (in); |
| 1388 |
break; |
| 1389 |
} |
| 1390 |
#endif // CC_PolicyPassword |
| 1391 |
#if CC_PolicyGetDigest |
| 1392 |
case TPM_CC_PolicyGetDigest: { |
| 1393 |
PolicyGetDigest_In *in = (PolicyGetDigest_In *) |
| 1394 |
MemoryGetInBuffer(sizeof(PolicyGetDigest_In)); |
| 1395 |
PolicyGetDigest_Out *out = (PolicyGetDigest_Out *) |
| 1396 |
MemoryGetOutBuffer(sizeof(PolicyGetDigest_Out)); |
| 1397 |
in->policySession = handles[0]; |
| 1398 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1399 |
result = TPM2_PolicyGetDigest (in, out); |
| 1400 |
rSize = sizeof(PolicyGetDigest_Out); |
| 1401 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->policyDigest, |
| 1402 |
responseBuffer, &rSize); |
| 1403 |
break; |
| 1404 |
} |
| 1405 |
#endif // CC_PolicyGetDigest |
| 1406 |
#if CC_PolicyNvWritten |
| 1407 |
case TPM_CC_PolicyNvWritten: { |
| 1408 |
PolicyNvWritten_In *in = (PolicyNvWritten_In *) |
| 1409 |
MemoryGetInBuffer(sizeof(PolicyNvWritten_In)); |
| 1410 |
in->policySession = handles[0]; |
| 1411 |
result = TPMI_YES_NO_Unmarshal(&in->writtenSet, paramBuffer, paramBufferSize); |
| 1412 |
ERROR_IF_EXIT_PLUS(RC_PolicyNvWritten_writtenSet); |
| 1413 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1414 |
result = TPM2_PolicyNvWritten (in); |
| 1415 |
break; |
| 1416 |
} |
| 1417 |
#endif // CC_PolicyNvWritten |
| 1418 |
#if CC_PolicyTemplate |
| 1419 |
case TPM_CC_PolicyTemplate: { |
| 1420 |
PolicyTemplate_In *in = (PolicyTemplate_In *) |
| 1421 |
MemoryGetInBuffer(sizeof(PolicyTemplate_In)); |
| 1422 |
in->policySession = handles[0]; |
| 1423 |
result = TPM2B_DIGEST_Unmarshal(&in->templateHash, paramBuffer, paramBufferSize); |
| 1424 |
ERROR_IF_EXIT_PLUS(RC_PolicyTemplate_templateHash); |
| 1425 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1426 |
result = TPM2_PolicyTemplate (in); |
| 1427 |
break; |
| 1428 |
} |
| 1429 |
#endif // CC_PolicyTemplate |
| 1430 |
#if CC_PolicyAuthorizeNV |
| 1431 |
case TPM_CC_PolicyAuthorizeNV: { |
| 1432 |
PolicyAuthorizeNV_In *in = (PolicyAuthorizeNV_In *) |
| 1433 |
MemoryGetInBuffer(sizeof(PolicyAuthorizeNV_In)); |
| 1434 |
in->authHandle = handles[0]; |
| 1435 |
in->nvIndex = handles[1]; |
| 1436 |
in->policySession = handles[2]; |
| 1437 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1438 |
result = TPM2_PolicyAuthorizeNV (in); |
| 1439 |
break; |
| 1440 |
} |
| 1441 |
#endif // CC_PolicyAuthorizeNV |
| 1442 |
#if CC_CreatePrimary |
| 1443 |
case TPM_CC_CreatePrimary: { |
| 1444 |
CreatePrimary_In *in = (CreatePrimary_In *) |
| 1445 |
MemoryGetInBuffer(sizeof(CreatePrimary_In)); |
| 1446 |
CreatePrimary_Out *out = (CreatePrimary_Out *) |
| 1447 |
MemoryGetOutBuffer(sizeof(CreatePrimary_Out)); |
| 1448 |
in->primaryHandle = handles[0]; |
| 1449 |
result = TPM2B_SENSITIVE_CREATE_Unmarshal(&in->inSensitive, paramBuffer, paramBufferSize); |
| 1450 |
ERROR_IF_EXIT_PLUS(RC_CreatePrimary_inSensitive); |
| 1451 |
result = TPM2B_PUBLIC_Unmarshal(&in->inPublic, paramBuffer, paramBufferSize, FALSE); |
| 1452 |
ERROR_IF_EXIT_PLUS(RC_CreatePrimary_inPublic); |
| 1453 |
result = TPM2B_DATA_Unmarshal(&in->outsideInfo, paramBuffer, paramBufferSize); |
| 1454 |
ERROR_IF_EXIT_PLUS(RC_CreatePrimary_outsideInfo); |
| 1455 |
result = TPML_PCR_SELECTION_Unmarshal(&in->creationPCR, paramBuffer, paramBufferSize); |
| 1456 |
ERROR_IF_EXIT_PLUS(RC_CreatePrimary_creationPCR); |
| 1457 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1458 |
result = TPM2_CreatePrimary (in, out); |
| 1459 |
rSize = sizeof(CreatePrimary_Out); |
| 1460 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 1461 |
; command->handles[command->handleNum++] = out->objectHandle; |
| 1462 |
*respParmSize += TPM2B_PUBLIC_Marshal(&out->outPublic, |
| 1463 |
responseBuffer, &rSize); |
| 1464 |
*respParmSize += TPM2B_CREATION_DATA_Marshal(&out->creationData, |
| 1465 |
responseBuffer, &rSize); |
| 1466 |
*respParmSize += TPM2B_DIGEST_Marshal(&out->creationHash, |
| 1467 |
responseBuffer, &rSize); |
| 1468 |
*respParmSize += TPMT_TK_CREATION_Marshal(&out->creationTicket, |
| 1469 |
responseBuffer, &rSize); |
| 1470 |
*respParmSize += TPM2B_NAME_Marshal(&out->name, |
| 1471 |
responseBuffer, &rSize); |
| 1472 |
break; |
| 1473 |
} |
| 1474 |
#endif // CC_CreatePrimary |
| 1475 |
#if CC_HierarchyControl |
| 1476 |
case TPM_CC_HierarchyControl: { |
| 1477 |
HierarchyControl_In *in = (HierarchyControl_In *) |
| 1478 |
MemoryGetInBuffer(sizeof(HierarchyControl_In)); |
| 1479 |
in->authHandle = handles[0]; |
| 1480 |
result = TPMI_RH_ENABLES_Unmarshal(&in->enable, paramBuffer, paramBufferSize, FALSE); |
| 1481 |
ERROR_IF_EXIT_PLUS(RC_HierarchyControl_enable); |
| 1482 |
result = TPMI_YES_NO_Unmarshal(&in->state, paramBuffer, paramBufferSize); |
| 1483 |
ERROR_IF_EXIT_PLUS(RC_HierarchyControl_state); |
| 1484 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1485 |
result = TPM2_HierarchyControl (in); |
| 1486 |
break; |
| 1487 |
} |
| 1488 |
#endif // CC_HierarchyControl |
| 1489 |
#if CC_SetPrimaryPolicy |
| 1490 |
case TPM_CC_SetPrimaryPolicy: { |
| 1491 |
SetPrimaryPolicy_In *in = (SetPrimaryPolicy_In *) |
| 1492 |
MemoryGetInBuffer(sizeof(SetPrimaryPolicy_In)); |
| 1493 |
in->authHandle = handles[0]; |
| 1494 |
result = TPM2B_DIGEST_Unmarshal(&in->authPolicy, paramBuffer, paramBufferSize); |
| 1495 |
ERROR_IF_EXIT_PLUS(RC_SetPrimaryPolicy_authPolicy); |
| 1496 |
result = TPMI_ALG_HASH_Unmarshal(&in->hashAlg, paramBuffer, paramBufferSize, TRUE); |
| 1497 |
ERROR_IF_EXIT_PLUS(RC_SetPrimaryPolicy_hashAlg); |
| 1498 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1499 |
result = TPM2_SetPrimaryPolicy (in); |
| 1500 |
break; |
| 1501 |
} |
| 1502 |
#endif // CC_SetPrimaryPolicy |
| 1503 |
#if CC_ChangePPS |
| 1504 |
case TPM_CC_ChangePPS: { |
| 1505 |
ChangePPS_In *in = (ChangePPS_In *) |
| 1506 |
MemoryGetInBuffer(sizeof(ChangePPS_In)); |
| 1507 |
in->authHandle = handles[0]; |
| 1508 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1509 |
result = TPM2_ChangePPS (in); |
| 1510 |
break; |
| 1511 |
} |
| 1512 |
#endif // CC_ChangePPS |
| 1513 |
#if CC_ChangeEPS |
| 1514 |
case TPM_CC_ChangeEPS: { |
| 1515 |
ChangeEPS_In *in = (ChangeEPS_In *) |
| 1516 |
MemoryGetInBuffer(sizeof(ChangeEPS_In)); |
| 1517 |
in->authHandle = handles[0]; |
| 1518 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1519 |
result = TPM2_ChangeEPS (in); |
| 1520 |
break; |
| 1521 |
} |
| 1522 |
#endif // CC_ChangeEPS |
| 1523 |
#if CC_Clear |
| 1524 |
case TPM_CC_Clear: { |
| 1525 |
Clear_In *in = (Clear_In *) |
| 1526 |
MemoryGetInBuffer(sizeof(Clear_In)); |
| 1527 |
in->authHandle = handles[0]; |
| 1528 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1529 |
result = TPM2_Clear (in); |
| 1530 |
break; |
| 1531 |
} |
| 1532 |
#endif // CC_Clear |
| 1533 |
#if CC_ClearControl |
| 1534 |
case TPM_CC_ClearControl: { |
| 1535 |
ClearControl_In *in = (ClearControl_In *) |
| 1536 |
MemoryGetInBuffer(sizeof(ClearControl_In)); |
| 1537 |
in->auth = handles[0]; |
| 1538 |
result = TPMI_YES_NO_Unmarshal(&in->disable, paramBuffer, paramBufferSize); |
| 1539 |
ERROR_IF_EXIT_PLUS(RC_ClearControl_disable); |
| 1540 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1541 |
result = TPM2_ClearControl (in); |
| 1542 |
break; |
| 1543 |
} |
| 1544 |
#endif // CC_ClearControl |
| 1545 |
#if CC_HierarchyChangeAuth |
| 1546 |
case TPM_CC_HierarchyChangeAuth: { |
| 1547 |
HierarchyChangeAuth_In *in = (HierarchyChangeAuth_In *) |
| 1548 |
MemoryGetInBuffer(sizeof(HierarchyChangeAuth_In)); |
| 1549 |
in->authHandle = handles[0]; |
| 1550 |
result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); |
| 1551 |
ERROR_IF_EXIT_PLUS(RC_HierarchyChangeAuth_newAuth); |
| 1552 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1553 |
result = TPM2_HierarchyChangeAuth (in); |
| 1554 |
break; |
| 1555 |
} |
| 1556 |
#endif // CC_HierarchyChangeAuth |
| 1557 |
#if CC_DictionaryAttackLockReset |
| 1558 |
case TPM_CC_DictionaryAttackLockReset: { |
| 1559 |
DictionaryAttackLockReset_In *in = (DictionaryAttackLockReset_In *) |
| 1560 |
MemoryGetInBuffer(sizeof(DictionaryAttackLockReset_In)); |
| 1561 |
in->lockHandle = handles[0]; |
| 1562 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1563 |
result = TPM2_DictionaryAttackLockReset (in); |
| 1564 |
break; |
| 1565 |
} |
| 1566 |
#endif // CC_DictionaryAttackLockReset |
| 1567 |
#if CC_DictionaryAttackParameters |
| 1568 |
case TPM_CC_DictionaryAttackParameters: { |
| 1569 |
DictionaryAttackParameters_In *in = (DictionaryAttackParameters_In *) |
| 1570 |
MemoryGetInBuffer(sizeof(DictionaryAttackParameters_In)); |
| 1571 |
in->lockHandle = handles[0]; |
| 1572 |
result = UINT32_Unmarshal(&in->newMaxTries, paramBuffer, paramBufferSize); |
| 1573 |
ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_newMaxTries); |
| 1574 |
result = UINT32_Unmarshal(&in->newRecoveryTime, paramBuffer, paramBufferSize); |
| 1575 |
ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_newRecoveryTime); |
| 1576 |
result = UINT32_Unmarshal(&in->lockoutRecovery, paramBuffer, paramBufferSize); |
| 1577 |
ERROR_IF_EXIT_PLUS(RC_DictionaryAttackParameters_lockoutRecovery); |
| 1578 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1579 |
result = TPM2_DictionaryAttackParameters (in); |
| 1580 |
break; |
| 1581 |
} |
| 1582 |
#endif // CC_DictionaryAttackParameters |
| 1583 |
#if CC_PP_Commands |
| 1584 |
case TPM_CC_PP_Commands: { |
| 1585 |
PP_Commands_In *in = (PP_Commands_In *) |
| 1586 |
MemoryGetInBuffer(sizeof(PP_Commands_In)); |
| 1587 |
in->auth = handles[0]; |
| 1588 |
result = TPML_CC_Unmarshal(&in->setList, paramBuffer, paramBufferSize); |
| 1589 |
ERROR_IF_EXIT_PLUS(RC_PP_Commands_setList); |
| 1590 |
result = TPML_CC_Unmarshal(&in->clearList, paramBuffer, paramBufferSize); |
| 1591 |
ERROR_IF_EXIT_PLUS(RC_PP_Commands_clearList); |
| 1592 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1593 |
result = TPM2_PP_Commands (in); |
| 1594 |
break; |
| 1595 |
} |
| 1596 |
#endif // CC_PP_Commands |
| 1597 |
#if CC_SetAlgorithmSet |
| 1598 |
case TPM_CC_SetAlgorithmSet: { |
| 1599 |
SetAlgorithmSet_In *in = (SetAlgorithmSet_In *) |
| 1600 |
MemoryGetInBuffer(sizeof(SetAlgorithmSet_In)); |
| 1601 |
in->authHandle = handles[0]; |
| 1602 |
result = UINT32_Unmarshal(&in->algorithmSet, paramBuffer, paramBufferSize); |
| 1603 |
ERROR_IF_EXIT_PLUS(RC_SetAlgorithmSet_algorithmSet); |
| 1604 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1605 |
result = TPM2_SetAlgorithmSet (in); |
| 1606 |
break; |
| 1607 |
} |
| 1608 |
#endif // CC_SetAlgorithmSet |
| 1609 |
#if CC_FieldUpgradeStart |
| 1610 |
case TPM_CC_FieldUpgradeStart: { |
| 1611 |
FieldUpgradeStart_In *in = (FieldUpgradeStart_In *) |
| 1612 |
MemoryGetInBuffer(sizeof(FieldUpgradeStart_In)); |
| 1613 |
in->authorization = handles[0]; |
| 1614 |
in->keyHandle = handles[1]; |
| 1615 |
result = TPM2B_DIGEST_Unmarshal(&in->fuDigest, paramBuffer, paramBufferSize); |
| 1616 |
ERROR_IF_EXIT_PLUS(RC_FieldUpgradeStart_fuDigest); |
| 1617 |
result = TPMT_SIGNATURE_Unmarshal(&in->manifestSignature, paramBuffer, paramBufferSize, FALSE); |
| 1618 |
ERROR_IF_EXIT_PLUS(RC_FieldUpgradeStart_manifestSignature); |
| 1619 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1620 |
result = TPM2_FieldUpgradeStart (in); |
| 1621 |
break; |
| 1622 |
} |
| 1623 |
#endif // CC_FieldUpgradeStart |
| 1624 |
#if CC_FieldUpgradeData |
| 1625 |
case TPM_CC_FieldUpgradeData: { |
| 1626 |
FieldUpgradeData_In *in = (FieldUpgradeData_In *) |
| 1627 |
MemoryGetInBuffer(sizeof(FieldUpgradeData_In)); |
| 1628 |
FieldUpgradeData_Out *out = (FieldUpgradeData_Out *) |
| 1629 |
MemoryGetOutBuffer(sizeof(FieldUpgradeData_Out)); |
| 1630 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->fuData, paramBuffer, paramBufferSize); |
| 1631 |
ERROR_IF_EXIT_PLUS(RC_FieldUpgradeData_fuData); |
| 1632 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1633 |
result = TPM2_FieldUpgradeData (in, out); |
| 1634 |
rSize = sizeof(FieldUpgradeData_Out); |
| 1635 |
*respParmSize += TPMT_HA_Marshal(&out->nextDigest, |
| 1636 |
responseBuffer, &rSize); |
| 1637 |
*respParmSize += TPMT_HA_Marshal(&out->firstDigest, |
| 1638 |
responseBuffer, &rSize); |
| 1639 |
break; |
| 1640 |
} |
| 1641 |
#endif // CC_FieldUpgradeData |
| 1642 |
#if CC_FirmwareRead |
| 1643 |
case TPM_CC_FirmwareRead: { |
| 1644 |
FirmwareRead_In *in = (FirmwareRead_In *) |
| 1645 |
MemoryGetInBuffer(sizeof(FirmwareRead_In)); |
| 1646 |
FirmwareRead_Out *out = (FirmwareRead_Out *) |
| 1647 |
MemoryGetOutBuffer(sizeof(FirmwareRead_Out)); |
| 1648 |
result = UINT32_Unmarshal(&in->sequenceNumber, paramBuffer, paramBufferSize); |
| 1649 |
ERROR_IF_EXIT_PLUS(RC_FirmwareRead_sequenceNumber); |
| 1650 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1651 |
result = TPM2_FirmwareRead (in, out); |
| 1652 |
rSize = sizeof(FirmwareRead_Out); |
| 1653 |
*respParmSize += TPM2B_MAX_BUFFER_Marshal(&out->fuData, |
| 1654 |
responseBuffer, &rSize); |
| 1655 |
break; |
| 1656 |
} |
| 1657 |
#endif // CC_FirmwareRead |
| 1658 |
#if CC_ContextSave |
| 1659 |
case TPM_CC_ContextSave: { |
| 1660 |
ContextSave_In *in = (ContextSave_In *) |
| 1661 |
MemoryGetInBuffer(sizeof(ContextSave_In)); |
| 1662 |
ContextSave_Out *out = (ContextSave_Out *) |
| 1663 |
MemoryGetOutBuffer(sizeof(ContextSave_Out)); |
| 1664 |
in->saveHandle = handles[0]; |
| 1665 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1666 |
result = TPM2_ContextSave (in, out); |
| 1667 |
rSize = sizeof(ContextSave_Out); |
| 1668 |
*respParmSize += TPMS_CONTEXT_Marshal(&out->context, |
| 1669 |
responseBuffer, &rSize); |
| 1670 |
break; |
| 1671 |
} |
| 1672 |
#endif // CC_ContextSave |
| 1673 |
#if CC_ContextLoad |
| 1674 |
case TPM_CC_ContextLoad: { |
| 1675 |
ContextLoad_In *in = (ContextLoad_In *) |
| 1676 |
MemoryGetInBuffer(sizeof(ContextLoad_In)); |
| 1677 |
ContextLoad_Out *out = (ContextLoad_Out *) |
| 1678 |
MemoryGetOutBuffer(sizeof(ContextLoad_Out)); |
| 1679 |
result = TPMS_CONTEXT_Unmarshal(&in->context, paramBuffer, paramBufferSize); |
| 1680 |
ERROR_IF_EXIT_PLUS(RC_ContextLoad_context); |
| 1681 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1682 |
result = TPM2_ContextLoad (in, out); |
| 1683 |
rSize = sizeof(ContextLoad_Out); |
| 1684 |
if(TPM_RC_SUCCESS != result) goto Exit; |
| 1685 |
; command->handles[command->handleNum++] = out->loadedHandle; |
| 1686 |
break; |
| 1687 |
} |
| 1688 |
#endif // CC_ContextLoad |
| 1689 |
#if CC_FlushContext |
| 1690 |
case TPM_CC_FlushContext: { |
| 1691 |
FlushContext_In *in = (FlushContext_In *) |
| 1692 |
MemoryGetInBuffer(sizeof(FlushContext_In)); |
| 1693 |
result = TPMI_DH_CONTEXT_Unmarshal(&in->flushHandle, paramBuffer, paramBufferSize); |
| 1694 |
ERROR_IF_EXIT_PLUS(RC_FlushContext_flushHandle); |
| 1695 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1696 |
result = TPM2_FlushContext (in); |
| 1697 |
break; |
| 1698 |
} |
| 1699 |
#endif // CC_FlushContext |
| 1700 |
#if CC_EvictControl |
| 1701 |
case TPM_CC_EvictControl: { |
| 1702 |
EvictControl_In *in = (EvictControl_In *) |
| 1703 |
MemoryGetInBuffer(sizeof(EvictControl_In)); |
| 1704 |
in->auth = handles[0]; |
| 1705 |
in->objectHandle = handles[1]; |
| 1706 |
result = TPMI_DH_PERSISTENT_Unmarshal(&in->persistentHandle, paramBuffer, paramBufferSize); |
| 1707 |
ERROR_IF_EXIT_PLUS(RC_EvictControl_persistentHandle); |
| 1708 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1709 |
result = TPM2_EvictControl (in); |
| 1710 |
break; |
| 1711 |
} |
| 1712 |
#endif // CC_EvictControl |
| 1713 |
#if CC_ReadClock |
| 1714 |
case TPM_CC_ReadClock: { |
| 1715 |
ReadClock_Out *out = (ReadClock_Out *) |
| 1716 |
MemoryGetOutBuffer(sizeof(ReadClock_Out)); |
| 1717 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1718 |
result = TPM2_ReadClock (out); |
| 1719 |
rSize = sizeof(ReadClock_Out); |
| 1720 |
*respParmSize += TPMS_TIME_INFO_Marshal(&out->currentTime, |
| 1721 |
responseBuffer, &rSize); |
| 1722 |
break; |
| 1723 |
} |
| 1724 |
#endif // CC_ReadClock |
| 1725 |
#if CC_ClockSet |
| 1726 |
case TPM_CC_ClockSet: { |
| 1727 |
ClockSet_In *in = (ClockSet_In *) |
| 1728 |
MemoryGetInBuffer(sizeof(ClockSet_In)); |
| 1729 |
in->auth = handles[0]; |
| 1730 |
result = UINT64_Unmarshal(&in->newTime, paramBuffer, paramBufferSize); |
| 1731 |
ERROR_IF_EXIT_PLUS(RC_ClockSet_newTime); |
| 1732 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1733 |
result = TPM2_ClockSet (in); |
| 1734 |
break; |
| 1735 |
} |
| 1736 |
#endif // CC_ClockSet |
| 1737 |
#if CC_ClockRateAdjust |
| 1738 |
case TPM_CC_ClockRateAdjust: { |
| 1739 |
ClockRateAdjust_In *in = (ClockRateAdjust_In *) |
| 1740 |
MemoryGetInBuffer(sizeof(ClockRateAdjust_In)); |
| 1741 |
in->auth = handles[0]; |
| 1742 |
result = TPM_CLOCK_ADJUST_Unmarshal(&in->rateAdjust, paramBuffer, paramBufferSize); |
| 1743 |
ERROR_IF_EXIT_PLUS(RC_ClockRateAdjust_rateAdjust); |
| 1744 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1745 |
result = TPM2_ClockRateAdjust (in); |
| 1746 |
break; |
| 1747 |
} |
| 1748 |
#endif // CC_ClockRateAdjust |
| 1749 |
#if CC_GetCapability |
| 1750 |
case TPM_CC_GetCapability: { |
| 1751 |
GetCapability_In *in = (GetCapability_In *) |
| 1752 |
MemoryGetInBuffer(sizeof(GetCapability_In)); |
| 1753 |
GetCapability_Out *out = (GetCapability_Out *) |
| 1754 |
MemoryGetOutBuffer(sizeof(GetCapability_Out)); |
| 1755 |
result = TPM_CAP_Unmarshal(&in->capability, paramBuffer, paramBufferSize); |
| 1756 |
ERROR_IF_EXIT_PLUS(RC_GetCapability_capability); |
| 1757 |
result = UINT32_Unmarshal(&in->property, paramBuffer, paramBufferSize); |
| 1758 |
ERROR_IF_EXIT_PLUS(RC_GetCapability_property); |
| 1759 |
result = UINT32_Unmarshal(&in->propertyCount, paramBuffer, paramBufferSize); |
| 1760 |
ERROR_IF_EXIT_PLUS(RC_GetCapability_propertyCount); |
| 1761 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1762 |
result = TPM2_GetCapability (in, out); |
| 1763 |
rSize = sizeof(GetCapability_Out); |
| 1764 |
*respParmSize += TPMI_YES_NO_Marshal(&out->moreData, |
| 1765 |
responseBuffer, &rSize); |
| 1766 |
*respParmSize += TPMS_CAPABILITY_DATA_Marshal(&out->capabilityData, |
| 1767 |
responseBuffer, &rSize); |
| 1768 |
break; |
| 1769 |
} |
| 1770 |
#endif // CC_GetCapability |
| 1771 |
#if CC_TestParms |
| 1772 |
case TPM_CC_TestParms: { |
| 1773 |
TestParms_In *in = (TestParms_In *) |
| 1774 |
MemoryGetInBuffer(sizeof(TestParms_In)); |
| 1775 |
result = TPMT_PUBLIC_PARMS_Unmarshal(&in->parameters, paramBuffer, paramBufferSize); |
| 1776 |
ERROR_IF_EXIT_PLUS(RC_TestParms_parameters); |
| 1777 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1778 |
result = TPM2_TestParms (in); |
| 1779 |
break; |
| 1780 |
} |
| 1781 |
#endif // CC_TestParms |
| 1782 |
#if CC_NV_DefineSpace |
| 1783 |
case TPM_CC_NV_DefineSpace: { |
| 1784 |
NV_DefineSpace_In *in = (NV_DefineSpace_In *) |
| 1785 |
MemoryGetInBuffer(sizeof(NV_DefineSpace_In)); |
| 1786 |
in->authHandle = handles[0]; |
| 1787 |
result = TPM2B_AUTH_Unmarshal(&in->auth, paramBuffer, paramBufferSize); |
| 1788 |
ERROR_IF_EXIT_PLUS(RC_NV_DefineSpace_auth); |
| 1789 |
result = TPM2B_NV_PUBLIC_Unmarshal(&in->publicInfo, paramBuffer, paramBufferSize); |
| 1790 |
ERROR_IF_EXIT_PLUS(RC_NV_DefineSpace_publicInfo); |
| 1791 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1792 |
result = TPM2_NV_DefineSpace (in); |
| 1793 |
break; |
| 1794 |
} |
| 1795 |
#endif // CC_NV_DefineSpace |
| 1796 |
#if CC_NV_UndefineSpace |
| 1797 |
case TPM_CC_NV_UndefineSpace: { |
| 1798 |
NV_UndefineSpace_In *in = (NV_UndefineSpace_In *) |
| 1799 |
MemoryGetInBuffer(sizeof(NV_UndefineSpace_In)); |
| 1800 |
in->authHandle = handles[0]; |
| 1801 |
in->nvIndex = handles[1]; |
| 1802 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1803 |
result = TPM2_NV_UndefineSpace (in); |
| 1804 |
break; |
| 1805 |
} |
| 1806 |
#endif // CC_NV_UndefineSpace |
| 1807 |
#if CC_NV_UndefineSpaceSpecial |
| 1808 |
case TPM_CC_NV_UndefineSpaceSpecial: { |
| 1809 |
NV_UndefineSpaceSpecial_In *in = (NV_UndefineSpaceSpecial_In *) |
| 1810 |
MemoryGetInBuffer(sizeof(NV_UndefineSpaceSpecial_In)); |
| 1811 |
in->nvIndex = handles[0]; |
| 1812 |
in->platform = handles[1]; |
| 1813 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1814 |
result = TPM2_NV_UndefineSpaceSpecial (in); |
| 1815 |
break; |
| 1816 |
} |
| 1817 |
#endif // CC_NV_UndefineSpaceSpecial |
| 1818 |
#if CC_NV_ReadPublic |
| 1819 |
case TPM_CC_NV_ReadPublic: { |
| 1820 |
NV_ReadPublic_In *in = (NV_ReadPublic_In *) |
| 1821 |
MemoryGetInBuffer(sizeof(NV_ReadPublic_In)); |
| 1822 |
NV_ReadPublic_Out *out = (NV_ReadPublic_Out *) |
| 1823 |
MemoryGetOutBuffer(sizeof(NV_ReadPublic_Out)); |
| 1824 |
in->nvIndex = handles[0]; |
| 1825 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1826 |
result = TPM2_NV_ReadPublic (in, out); |
| 1827 |
rSize = sizeof(NV_ReadPublic_Out); |
| 1828 |
*respParmSize += TPM2B_NV_PUBLIC_Marshal(&out->nvPublic, |
| 1829 |
responseBuffer, &rSize); |
| 1830 |
*respParmSize += TPM2B_NAME_Marshal(&out->nvName, |
| 1831 |
responseBuffer, &rSize); |
| 1832 |
break; |
| 1833 |
} |
| 1834 |
#endif // CC_NV_ReadPublic |
| 1835 |
#if CC_NV_Write |
| 1836 |
case TPM_CC_NV_Write: { |
| 1837 |
NV_Write_In *in = (NV_Write_In *) |
| 1838 |
MemoryGetInBuffer(sizeof(NV_Write_In)); |
| 1839 |
in->authHandle = handles[0]; |
| 1840 |
in->nvIndex = handles[1]; |
| 1841 |
result = TPM2B_MAX_NV_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); |
| 1842 |
ERROR_IF_EXIT_PLUS(RC_NV_Write_data); |
| 1843 |
result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); |
| 1844 |
ERROR_IF_EXIT_PLUS(RC_NV_Write_offset); |
| 1845 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1846 |
result = TPM2_NV_Write (in); |
| 1847 |
break; |
| 1848 |
} |
| 1849 |
#endif // CC_NV_Write |
| 1850 |
#if CC_NV_Increment |
| 1851 |
case TPM_CC_NV_Increment: { |
| 1852 |
NV_Increment_In *in = (NV_Increment_In *) |
| 1853 |
MemoryGetInBuffer(sizeof(NV_Increment_In)); |
| 1854 |
in->authHandle = handles[0]; |
| 1855 |
in->nvIndex = handles[1]; |
| 1856 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1857 |
result = TPM2_NV_Increment (in); |
| 1858 |
break; |
| 1859 |
} |
| 1860 |
#endif // CC_NV_Increment |
| 1861 |
#if CC_NV_Extend |
| 1862 |
case TPM_CC_NV_Extend: { |
| 1863 |
NV_Extend_In *in = (NV_Extend_In *) |
| 1864 |
MemoryGetInBuffer(sizeof(NV_Extend_In)); |
| 1865 |
in->authHandle = handles[0]; |
| 1866 |
in->nvIndex = handles[1]; |
| 1867 |
result = TPM2B_MAX_NV_BUFFER_Unmarshal(&in->data, paramBuffer, paramBufferSize); |
| 1868 |
ERROR_IF_EXIT_PLUS(RC_NV_Extend_data); |
| 1869 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1870 |
result = TPM2_NV_Extend (in); |
| 1871 |
break; |
| 1872 |
} |
| 1873 |
#endif // CC_NV_Extend |
| 1874 |
#if CC_NV_SetBits |
| 1875 |
case TPM_CC_NV_SetBits: { |
| 1876 |
NV_SetBits_In *in = (NV_SetBits_In *) |
| 1877 |
MemoryGetInBuffer(sizeof(NV_SetBits_In)); |
| 1878 |
in->authHandle = handles[0]; |
| 1879 |
in->nvIndex = handles[1]; |
| 1880 |
result = UINT64_Unmarshal(&in->bits, paramBuffer, paramBufferSize); |
| 1881 |
ERROR_IF_EXIT_PLUS(RC_NV_SetBits_bits); |
| 1882 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1883 |
result = TPM2_NV_SetBits (in); |
| 1884 |
break; |
| 1885 |
} |
| 1886 |
#endif // CC_NV_SetBits |
| 1887 |
#if CC_NV_WriteLock |
| 1888 |
case TPM_CC_NV_WriteLock: { |
| 1889 |
NV_WriteLock_In *in = (NV_WriteLock_In *) |
| 1890 |
MemoryGetInBuffer(sizeof(NV_WriteLock_In)); |
| 1891 |
in->authHandle = handles[0]; |
| 1892 |
in->nvIndex = handles[1]; |
| 1893 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1894 |
result = TPM2_NV_WriteLock (in); |
| 1895 |
break; |
| 1896 |
} |
| 1897 |
#endif // CC_NV_WriteLock |
| 1898 |
#if CC_NV_GlobalWriteLock |
| 1899 |
case TPM_CC_NV_GlobalWriteLock: { |
| 1900 |
NV_GlobalWriteLock_In *in = (NV_GlobalWriteLock_In *) |
| 1901 |
MemoryGetInBuffer(sizeof(NV_GlobalWriteLock_In)); |
| 1902 |
in->authHandle = handles[0]; |
| 1903 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1904 |
result = TPM2_NV_GlobalWriteLock (in); |
| 1905 |
break; |
| 1906 |
} |
| 1907 |
#endif // CC_NV_GlobalWriteLock |
| 1908 |
#if CC_NV_Read |
| 1909 |
case TPM_CC_NV_Read: { |
| 1910 |
NV_Read_In *in = (NV_Read_In *) |
| 1911 |
MemoryGetInBuffer(sizeof(NV_Read_In)); |
| 1912 |
NV_Read_Out *out = (NV_Read_Out *) |
| 1913 |
MemoryGetOutBuffer(sizeof(NV_Read_Out)); |
| 1914 |
in->authHandle = handles[0]; |
| 1915 |
in->nvIndex = handles[1]; |
| 1916 |
result = UINT16_Unmarshal(&in->size, paramBuffer, paramBufferSize); |
| 1917 |
ERROR_IF_EXIT_PLUS(RC_NV_Read_size); |
| 1918 |
result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); |
| 1919 |
ERROR_IF_EXIT_PLUS(RC_NV_Read_offset); |
| 1920 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1921 |
result = TPM2_NV_Read (in, out); |
| 1922 |
rSize = sizeof(NV_Read_Out); |
| 1923 |
*respParmSize += TPM2B_MAX_NV_BUFFER_Marshal(&out->data, |
| 1924 |
responseBuffer, &rSize); |
| 1925 |
break; |
| 1926 |
} |
| 1927 |
#endif // CC_NV_Read |
| 1928 |
#if CC_NV_ReadLock |
| 1929 |
case TPM_CC_NV_ReadLock: { |
| 1930 |
NV_ReadLock_In *in = (NV_ReadLock_In *) |
| 1931 |
MemoryGetInBuffer(sizeof(NV_ReadLock_In)); |
| 1932 |
in->authHandle = handles[0]; |
| 1933 |
in->nvIndex = handles[1]; |
| 1934 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1935 |
result = TPM2_NV_ReadLock (in); |
| 1936 |
break; |
| 1937 |
} |
| 1938 |
#endif // CC_NV_ReadLock |
| 1939 |
#if CC_NV_ChangeAuth |
| 1940 |
case TPM_CC_NV_ChangeAuth: { |
| 1941 |
NV_ChangeAuth_In *in = (NV_ChangeAuth_In *) |
| 1942 |
MemoryGetInBuffer(sizeof(NV_ChangeAuth_In)); |
| 1943 |
in->nvIndex = handles[0]; |
| 1944 |
result = TPM2B_AUTH_Unmarshal(&in->newAuth, paramBuffer, paramBufferSize); |
| 1945 |
ERROR_IF_EXIT_PLUS(RC_NV_ChangeAuth_newAuth); |
| 1946 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1947 |
result = TPM2_NV_ChangeAuth (in); |
| 1948 |
break; |
| 1949 |
} |
| 1950 |
#endif // CC_NV_ChangeAuth |
| 1951 |
#if CC_NV_Certify |
| 1952 |
case TPM_CC_NV_Certify: { |
| 1953 |
NV_Certify_In *in = (NV_Certify_In *) |
| 1954 |
MemoryGetInBuffer(sizeof(NV_Certify_In)); |
| 1955 |
NV_Certify_Out *out = (NV_Certify_Out *) |
| 1956 |
MemoryGetOutBuffer(sizeof(NV_Certify_Out)); |
| 1957 |
in->signHandle = handles[0]; |
| 1958 |
in->authHandle = handles[1]; |
| 1959 |
in->nvIndex = handles[2]; |
| 1960 |
result = TPM2B_DATA_Unmarshal(&in->qualifyingData, paramBuffer, paramBufferSize); |
| 1961 |
ERROR_IF_EXIT_PLUS(RC_NV_Certify_qualifyingData); |
| 1962 |
result = TPMT_SIG_SCHEME_Unmarshal(&in->inScheme, paramBuffer, paramBufferSize, TRUE); |
| 1963 |
ERROR_IF_EXIT_PLUS(RC_NV_Certify_inScheme); |
| 1964 |
result = UINT16_Unmarshal(&in->size, paramBuffer, paramBufferSize); |
| 1965 |
ERROR_IF_EXIT_PLUS(RC_NV_Certify_size); |
| 1966 |
result = UINT16_Unmarshal(&in->offset, paramBuffer, paramBufferSize); |
| 1967 |
ERROR_IF_EXIT_PLUS(RC_NV_Certify_offset); |
| 1968 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1969 |
result = TPM2_NV_Certify (in, out); |
| 1970 |
rSize = sizeof(NV_Certify_Out); |
| 1971 |
*respParmSize += TPM2B_ATTEST_Marshal(&out->certifyInfo, |
| 1972 |
responseBuffer, &rSize); |
| 1973 |
*respParmSize += TPMT_SIGNATURE_Marshal(&out->signature, |
| 1974 |
responseBuffer, &rSize); |
| 1975 |
break; |
| 1976 |
} |
| 1977 |
#endif // CC_NV_Certify |
| 1978 |
#if CC_AC_GetCapability |
| 1979 |
case TPM_CC_AC_GetCapability: { |
| 1980 |
AC_GetCapability_In *in = (AC_GetCapability_In *) |
| 1981 |
MemoryGetInBuffer(sizeof(AC_GetCapability_In)); |
| 1982 |
AC_GetCapability_Out *out = (AC_GetCapability_Out *) |
| 1983 |
MemoryGetOutBuffer(sizeof(AC_GetCapability_Out)); |
| 1984 |
in->ac = handles[0]; |
| 1985 |
result = TPM_AT_Unmarshal(&in->capability, paramBuffer, paramBufferSize); |
| 1986 |
ERROR_IF_EXIT_PLUS(RC_AC_GetCapability_capability); |
| 1987 |
result = UINT32_Unmarshal(&in->count, paramBuffer, paramBufferSize); |
| 1988 |
ERROR_IF_EXIT_PLUS(RC_AC_GetCapability_count); |
| 1989 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 1990 |
result = TPM2_AC_GetCapability (in, out); |
| 1991 |
rSize = sizeof(AC_GetCapability_Out); |
| 1992 |
*respParmSize += TPMI_YES_NO_Marshal(&out->moreData, |
| 1993 |
responseBuffer, &rSize); |
| 1994 |
*respParmSize += TPML_AC_CAPABILITIES_Marshal(&out->capabilitiesData, |
| 1995 |
responseBuffer, &rSize); |
| 1996 |
break; |
| 1997 |
} |
| 1998 |
#endif // CC_AC_GetCapability |
| 1999 |
#if CC_AC_Send |
| 2000 |
case TPM_CC_AC_Send: { |
| 2001 |
AC_Send_In *in = (AC_Send_In *) |
| 2002 |
MemoryGetInBuffer(sizeof(AC_Send_In)); |
| 2003 |
AC_Send_Out *out = (AC_Send_Out *) |
| 2004 |
MemoryGetOutBuffer(sizeof(AC_Send_Out)); |
| 2005 |
in->sendObject = handles[0]; |
| 2006 |
in->authHandle = handles[1]; |
| 2007 |
in->ac = handles[2]; |
| 2008 |
result = TPM2B_MAX_BUFFER_Unmarshal(&in->acDataIn, paramBuffer, paramBufferSize); |
| 2009 |
ERROR_IF_EXIT_PLUS(RC_AC_Send_acDataIn); |
| 2010 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 2011 |
result = TPM2_AC_Send (in, out); |
| 2012 |
rSize = sizeof(AC_Send_Out); |
| 2013 |
*respParmSize += TPMS_AC_OUTPUT_Marshal(&out->acDataOut, |
| 2014 |
responseBuffer, &rSize); |
| 2015 |
break; |
| 2016 |
} |
| 2017 |
#endif // CC_AC_Send |
| 2018 |
#if CC_Policy_AC_SendSelect |
| 2019 |
case TPM_CC_Policy_AC_SendSelect: { |
| 2020 |
Policy_AC_SendSelect_In *in = (Policy_AC_SendSelect_In *) |
| 2021 |
MemoryGetInBuffer(sizeof(Policy_AC_SendSelect_In)); |
| 2022 |
in->policySession = handles[0]; |
| 2023 |
result = TPM2B_NAME_Unmarshal(&in->objectName, paramBuffer, paramBufferSize); |
| 2024 |
ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_objectName); |
| 2025 |
result = TPM2B_NAME_Unmarshal(&in->authHandleName, paramBuffer, paramBufferSize); |
| 2026 |
ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_authHandleName); |
| 2027 |
result = TPM2B_NAME_Unmarshal(&in->acName, paramBuffer, paramBufferSize); |
| 2028 |
ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_acName); |
| 2029 |
result = TPMI_YES_NO_Unmarshal(&in->includeObject, paramBuffer, paramBufferSize); |
| 2030 |
ERROR_IF_EXIT_PLUS(RC_Policy_AC_SendSelect_includeObject); |
| 2031 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 2032 |
result = TPM2_Policy_AC_SendSelect (in); |
| 2033 |
break; |
| 2034 |
} |
| 2035 |
#endif // CC_Policy_AC_SendSelect |
| 2036 |
#if CC_Vendor_TCG_Test |
| 2037 |
case TPM_CC_Vendor_TCG_Test: { |
| 2038 |
Vendor_TCG_Test_In *in = (Vendor_TCG_Test_In *) |
| 2039 |
MemoryGetInBuffer(sizeof(Vendor_TCG_Test_In)); |
| 2040 |
Vendor_TCG_Test_Out *out = (Vendor_TCG_Test_Out *) |
| 2041 |
MemoryGetOutBuffer(sizeof(Vendor_TCG_Test_Out)); |
| 2042 |
result = TPM2B_DATA_Unmarshal(&in->inputData, paramBuffer, paramBufferSize); |
| 2043 |
ERROR_IF_EXIT_PLUS(RC_Vendor_TCG_Test_inputData); |
| 2044 |
if(*paramBufferSize != 0) (result = TPM_RC_SIZE; goto Exit; } |
| 2045 |
result = TPM2_Vendor_TCG_Test (in, out); |
| 2046 |
rSize = sizeof(Vendor_TCG_Test_Out); |
| 2047 |
*respParmSize += TPM2B_DATA_Marshal(&out->outputData, |
| 2048 |
responseBuffer, &rSize); |
| 2049 |
break; |
| 2050 |
} |
| 2051 |
#endif // CC_Vendor_TCG_Test |