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