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