blob: c866829ecffbf46e90e9494e81dd5dd732688f44 [file] [log] [blame]
Jocelyn Bohra4ed3aa2015-07-30 10:44:16 -07001// 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 "StirRandom_fp.h"
9
10TPM_RC StirRandom_In_Unmarshal(StirRandom_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 = TPM2B_SENSITIVE_DATA_Unmarshal(&target->inData, buffer, size);
17 if (result != TPM_RC_SUCCESS) {
18 return result;
19 }
Vadim Bendebury3dfffca2015-10-20 17:17:54 -070020 if ((result == TPM_RC_SUCCESS) && *size) {
21 result = TPM_RC_SIZE;
22 }
Jocelyn Bohra4ed3aa2015-07-30 10:44:16 -070023 return result;
24}
25
26TPM_RC Exec_StirRandom(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 StirRandom_In in;
34#ifdef TPM_CC_StirRandom
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 StirRandom_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_StirRandom(&in);
49 if (result != TPM_RC_SUCCESS) {
50 return result;
51 }
52#ifdef TPM_CC_StirRandom
53 response_buffer = MemoryGetResponseBuffer(TPM_CC_StirRandom) + 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}