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 "FlushContext_fp.h" 9 10 TPM_RC FlushContext_In_Unmarshal(FlushContext_In* target, 11 TPM_HANDLE request_handles[], 12 BYTE** buffer, 13 INT32* size) { 14 TPM_RC result = TPM_RC_SUCCESS; 15 // Unmarshal request parameters. 16 result = TPMI_DH_CONTEXT_Unmarshal(&target->flushHandle, buffer, size); 17 if (result != TPM_RC_SUCCESS) { 18 return result; 19 } 20 if ((result == TPM_RC_SUCCESS) && *size) { 21 result = TPM_RC_SIZE; 22 } 23 return result; 24 } 25 26 TPM_RC Exec_FlushContext(TPMI_ST_COMMAND_TAG tag, 27 BYTE** request_parameter_buffer, 28 INT32* request_parameter_buffer_size, 29 TPM_HANDLE request_handles[], 30 UINT32* response_handle_buffer_size, 31 UINT32* response_parameter_buffer_size) { 32 TPM_RC result = TPM_RC_SUCCESS; 33 FlushContext_In in; 34 #ifdef TPM_CC_FlushContext 35 BYTE* response_buffer; 36 INT32 response_buffer_size; 37 #endif 38 *response_handle_buffer_size = 0; 39 *response_parameter_buffer_size = 0; 40 // Unmarshal request parameters to input structure. 41 result = 42 FlushContext_In_Unmarshal(&in, request_handles, request_parameter_buffer, 43 request_parameter_buffer_size); 44 if (result != TPM_RC_SUCCESS) { 45 return result; 46 } 47 // Execute command. 48 result = TPM2_FlushContext(&in); 49 if (result != TPM_RC_SUCCESS) { 50 return result; 51 } 52 #ifdef TPM_CC_FlushContext 53 response_buffer = MemoryGetResponseBuffer(TPM_CC_FlushContext) + 10; 54 response_buffer_size = MAX_RESPONSE_SIZE - 10; 55 // Add parameter_size field, always equal to 0 here. 56 if (tag == TPM_ST_SESSIONS) { 57 UINT32_Marshal(response_parameter_buffer_size, &response_buffer, 58 &response_buffer_size); 59 } 60 return TPM_RC_SUCCESS; 61 #endif 62 return TPM_RC_COMMAND_CODE; 63 } 64