Coverage Report

Created: 2023-06-07 06:46

/src/tpm2/Marshal_PolicyRestart.c
Line
Count
Source (jump to first uncovered line)
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 "PolicyRestart_fp.h"
9
10
static TPM_RC PolicyRestart_In_Unmarshal(PolicyRestart_In* target,
11
                                         TPM_HANDLE request_handles[],
12
                                         BYTE** buffer,
13
0
                                         INT32* size) {
14
0
  TPM_RC result = TPM_RC_SUCCESS;
15
  // Get request handles from request_handles array.
16
0
  target->sessionHandle = request_handles[0];
17
0
  if ((result == TPM_RC_SUCCESS) && *size) {
18
0
    result = TPM_RC_SIZE;
19
0
  }
20
0
  return result;
21
0
}
22
23
TPM_RC Exec_PolicyRestart(TPMI_ST_COMMAND_TAG tag,
24
                          BYTE** request_parameter_buffer,
25
                          INT32* request_parameter_buffer_size,
26
                          TPM_HANDLE request_handles[],
27
                          UINT32* response_handle_buffer_size,
28
0
                          UINT32* response_parameter_buffer_size) {
29
0
  TPM_RC result = TPM_RC_SUCCESS;
30
0
  PolicyRestart_In in;
31
0
#if IS_CC_ENABLED(PolicyRestart)
32
0
  BYTE* response_buffer;
33
0
  INT32 response_buffer_size;
34
0
#endif
35
0
  *response_handle_buffer_size = 0;
36
0
  *response_parameter_buffer_size = 0;
37
  // Unmarshal request parameters to input structure.
38
0
  result =
39
0
      PolicyRestart_In_Unmarshal(&in, request_handles, request_parameter_buffer,
40
0
                                 request_parameter_buffer_size);
41
0
  if (result != TPM_RC_SUCCESS) {
42
0
    return result;
43
0
  }
44
  // Execute command.
45
0
  result = TPM2_PolicyRestart(&in);
46
0
  if (result != TPM_RC_SUCCESS) {
47
0
    return result;
48
0
  }
49
0
#if IS_CC_ENABLED(PolicyRestart)
50
0
  response_buffer = MemoryGetResponseBuffer(TPM_CC_PolicyRestart) + 10;
51
0
  response_buffer_size = MAX_RESPONSE_SIZE - 10;
52
  // Add parameter_size field, always equal to 0 here.
53
0
  if (tag == TPM_ST_SESSIONS) {
54
0
    UINT32_Marshal(response_parameter_buffer_size, &response_buffer,
55
0
                   &response_buffer_size);
56
0
  }
57
0
  return TPM_RC_SUCCESS;
58
0
#endif
59
0
  return TPM_RC_COMMAND_CODE;
60
0
}