• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "TestParms_fp.h"
9 
TestParms_In_Unmarshal(TestParms_In * target,TPM_HANDLE request_handles[],BYTE ** buffer,INT32 * size)10 TPM_RC TestParms_In_Unmarshal(TestParms_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 = TPMT_PUBLIC_PARMS_Unmarshal(&target->parameters, 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 
Exec_TestParms(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)26 TPM_RC Exec_TestParms(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   TestParms_In in;
34 #ifdef TPM_CC_TestParms
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       TestParms_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_TestParms(&in);
49   if (result != TPM_RC_SUCCESS) {
50     return result;
51   }
52 #ifdef TPM_CC_TestParms
53   response_buffer = MemoryGetResponseBuffer(TPM_CC_TestParms) + 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