1 // Copyright 2015 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // THIS CODE IS GENERATED - DO NOT MODIFY! 6 7 #include "MemoryLib_fp.h" 8 #include "DictionaryAttackParameters_fp.h" 9 10 TPM_RC DictionaryAttackParameters_In_Unmarshal( 11 DictionaryAttackParameters_In* target, 12 TPM_HANDLE request_handles[], 13 BYTE** buffer, 14 INT32* size) { 15 TPM_RC result = TPM_RC_SUCCESS; 16 // Get request handles from request_handles array. 17 target->lockHandle = request_handles[0]; 18 // Unmarshal request parameters. 19 result = UINT32_Unmarshal(&target->newMaxTries, buffer, size); 20 if (result != TPM_RC_SUCCESS) { 21 return result; 22 } 23 result = UINT32_Unmarshal(&target->newRecoveryTime, buffer, size); 24 if (result != TPM_RC_SUCCESS) { 25 return result; 26 } 27 result = UINT32_Unmarshal(&target->lockoutRecovery, buffer, size); 28 if (result != TPM_RC_SUCCESS) { 29 return result; 30 } 31 if ((result == TPM_RC_SUCCESS) && *size) { 32 result = TPM_RC_SIZE; 33 } 34 return result; 35 } 36 37 TPM_RC Exec_DictionaryAttackParameters(TPMI_ST_COMMAND_TAG tag, 38 BYTE** request_parameter_buffer, 39 INT32* request_parameter_buffer_size, 40 TPM_HANDLE request_handles[], 41 UINT32* response_handle_buffer_size, 42 UINT32* response_parameter_buffer_size) { 43 TPM_RC result = TPM_RC_SUCCESS; 44 DictionaryAttackParameters_In in; 45 #ifdef TPM_CC_DictionaryAttackParameters 46 BYTE* response_buffer; 47 INT32 response_buffer_size; 48 #endif 49 *response_handle_buffer_size = 0; 50 *response_parameter_buffer_size = 0; 51 // Unmarshal request parameters to input structure. 52 result = DictionaryAttackParameters_In_Unmarshal( 53 &in, request_handles, request_parameter_buffer, 54 request_parameter_buffer_size); 55 if (result != TPM_RC_SUCCESS) { 56 return result; 57 } 58 // Execute command. 59 result = TPM2_DictionaryAttackParameters(&in); 60 if (result != TPM_RC_SUCCESS) { 61 return result; 62 } 63 #ifdef TPM_CC_DictionaryAttackParameters 64 response_buffer = 65 MemoryGetResponseBuffer(TPM_CC_DictionaryAttackParameters) + 10; 66 response_buffer_size = MAX_RESPONSE_SIZE - 10; 67 // Add parameter_size field, always equal to 0 here. 68 if (tag == TPM_ST_SESSIONS) { 69 UINT32_Marshal(response_parameter_buffer_size, &response_buffer, 70 &response_buffer_size); 71 } 72 return TPM_RC_SUCCESS; 73 #endif 74 return TPM_RC_COMMAND_CODE; 75 } 76