Jocelyn Bohr | a4ed3aa | 2015-07-30 10:44:16 -0700 | [diff] [blame] | 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 "NV_GlobalWriteLock_fp.h" |
| 9 | |
| 10 | TPM_RC NV_GlobalWriteLock_In_Unmarshal(NV_GlobalWriteLock_In* target, |
| 11 | TPM_HANDLE request_handles[], |
| 12 | BYTE** buffer, |
| 13 | INT32* size) { |
| 14 | TPM_RC result = TPM_RC_SUCCESS; |
| 15 | // Get request handles from request_handles array. |
| 16 | target->authHandle = request_handles[0]; |
Vadim Bendebury | 3dfffca | 2015-10-20 17:17:54 -0700 | [diff] [blame] | 17 | if ((result == TPM_RC_SUCCESS) && *size) { |
| 18 | result = TPM_RC_SIZE; |
| 19 | } |
Jocelyn Bohr | a4ed3aa | 2015-07-30 10:44:16 -0700 | [diff] [blame] | 20 | return result; |
| 21 | } |
| 22 | |
| 23 | TPM_RC Exec_NV_GlobalWriteLock(TPMI_ST_COMMAND_TAG tag, |
| 24 | BYTE** request_parameter_buffer, |
| 25 | INT32* request_parameter_buffer_size, |
| 26 | TPM_HANDLE request_handles[], |
| 27 | UINT32* response_handle_buffer_size, |
| 28 | UINT32* response_parameter_buffer_size) { |
| 29 | TPM_RC result = TPM_RC_SUCCESS; |
| 30 | NV_GlobalWriteLock_In in; |
| 31 | #ifdef TPM_CC_NV_GlobalWriteLock |
| 32 | BYTE* response_buffer; |
| 33 | INT32 response_buffer_size; |
| 34 | #endif |
| 35 | *response_handle_buffer_size = 0; |
| 36 | *response_parameter_buffer_size = 0; |
| 37 | // Unmarshal request parameters to input structure. |
| 38 | result = NV_GlobalWriteLock_In_Unmarshal(&in, request_handles, |
| 39 | request_parameter_buffer, |
| 40 | request_parameter_buffer_size); |
| 41 | if (result != TPM_RC_SUCCESS) { |
| 42 | return result; |
| 43 | } |
| 44 | // Execute command. |
| 45 | result = TPM2_NV_GlobalWriteLock(&in); |
| 46 | if (result != TPM_RC_SUCCESS) { |
| 47 | return result; |
| 48 | } |
| 49 | #ifdef TPM_CC_NV_GlobalWriteLock |
| 50 | response_buffer = MemoryGetResponseBuffer(TPM_CC_NV_GlobalWriteLock) + 10; |
| 51 | response_buffer_size = MAX_RESPONSE_SIZE - 10; |
| 52 | // Add parameter_size field, always equal to 0 here. |
| 53 | if (tag == TPM_ST_SESSIONS) { |
| 54 | UINT32_Marshal(response_parameter_buffer_size, &response_buffer, |
| 55 | &response_buffer_size); |
| 56 | } |
| 57 | return TPM_RC_SUCCESS; |
| 58 | #endif |
| 59 | return TPM_RC_COMMAND_CODE; |
| 60 | } |