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 "SetCommandCodeAuditStatus_fp.h"
9
SetCommandCodeAuditStatus_In_Unmarshal(SetCommandCodeAuditStatus_In * target,TPM_HANDLE request_handles[],BYTE ** buffer,INT32 * size)10 TPM_RC SetCommandCodeAuditStatus_In_Unmarshal(
11 SetCommandCodeAuditStatus_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->auth = request_handles[0];
18 // Unmarshal request parameters.
19 result = TPMI_ALG_HASH_Unmarshal(&target->auditAlg, buffer, size, TRUE);
20 if (result != TPM_RC_SUCCESS) {
21 return result;
22 }
23 result = TPML_CC_Unmarshal(&target->setList, buffer, size);
24 if (result != TPM_RC_SUCCESS) {
25 return result;
26 }
27 result = TPML_CC_Unmarshal(&target->clearList, 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
Exec_SetCommandCodeAuditStatus(TPMI_ST_COMMAND_TAG tag,BYTE ** request_parameter_buffer,INT32 * request_parameter_buffer_size,TPM_HANDLE request_handles[],UINT32 * response_handle_buffer_size,UINT32 * response_parameter_buffer_size)37 TPM_RC Exec_SetCommandCodeAuditStatus(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 SetCommandCodeAuditStatus_In in;
45 #ifdef TPM_CC_SetCommandCodeAuditStatus
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 = SetCommandCodeAuditStatus_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_SetCommandCodeAuditStatus(&in);
60 if (result != TPM_RC_SUCCESS) {
61 return result;
62 }
63 #ifdef TPM_CC_SetCommandCodeAuditStatus
64 response_buffer =
65 MemoryGetResponseBuffer(TPM_CC_SetCommandCodeAuditStatus) + 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