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