Coverage Report

Created: 2023-06-07 06:46

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