Coverage Report

Created: 2025-07-12 06:49

/src/tpm2/Marshal_DictionaryAttackParameters.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 "DictionaryAttackParameters_fp.h"
9
10
static TPM_RC DictionaryAttackParameters_In_Unmarshal(
11
    DictionaryAttackParameters_In* target,
12
    TPM_HANDLE request_handles[],
13
    BYTE** buffer,
14
0
    INT32* size) {
15
0
  TPM_RC result = TPM_RC_SUCCESS;
16
  // Get request handles from request_handles array.
17
0
  target->lockHandle = request_handles[0];
18
  // Unmarshal request parameters.
19
0
  result = UINT32_Unmarshal(&target->newMaxTries, buffer, size);
20
0
  if (result != TPM_RC_SUCCESS) {
21
0
    return result;
22
0
  }
23
0
  result = UINT32_Unmarshal(&target->newRecoveryTime, buffer, size);
24
0
  if (result != TPM_RC_SUCCESS) {
25
0
    return result;
26
0
  }
27
0
  result = UINT32_Unmarshal(&target->lockoutRecovery, buffer, size);
28
0
  if (result != TPM_RC_SUCCESS) {
29
0
    return result;
30
0
  }
31
0
  if ((result == TPM_RC_SUCCESS) && *size) {
32
0
    result = TPM_RC_SIZE;
33
0
  }
34
0
  return result;
35
0
}
36
37
TPM_RC Exec_DictionaryAttackParameters(TPMI_ST_COMMAND_TAG tag,
38
                                       BYTE** request_parameter_buffer,
39
                                       INT32* request_parameter_buffer_size,
40
                                       TPM_HANDLE request_handles[],
41
                                       UINT32* response_handle_buffer_size,
42
0
                                       UINT32* response_parameter_buffer_size) {
43
0
  TPM_RC result = TPM_RC_SUCCESS;
44
0
  DictionaryAttackParameters_In in;
45
0
#if IS_CC_ENABLED(DictionaryAttackParameters)
46
0
  BYTE* response_buffer;
47
0
  INT32 response_buffer_size;
48
0
#endif
49
0
  *response_handle_buffer_size = 0;
50
0
  *response_parameter_buffer_size = 0;
51
  // Unmarshal request parameters to input structure.
52
0
  result = DictionaryAttackParameters_In_Unmarshal(
53
0
      &in, request_handles, request_parameter_buffer,
54
0
      request_parameter_buffer_size);
55
0
  if (result != TPM_RC_SUCCESS) {
56
0
    return result;
57
0
  }
58
  // Execute command.
59
0
  result = TPM2_DictionaryAttackParameters(&in);
60
0
  if (result != TPM_RC_SUCCESS) {
61
0
    return result;
62
0
  }
63
0
#if IS_CC_ENABLED(DictionaryAttackParameters)
64
0
  response_buffer =
65
0
      MemoryGetResponseBuffer(TPM_CC_DictionaryAttackParameters) + 10;
66
0
  response_buffer_size = MAX_RESPONSE_SIZE - 10;
67
  // Add parameter_size field, always equal to 0 here.
68
0
  if (tag == TPM_ST_SESSIONS) {
69
0
    UINT32_Marshal(response_parameter_buffer_size, &response_buffer,
70
0
                   &response_buffer_size);
71
0
  }
72
0
  return TPM_RC_SUCCESS;
73
0
#endif
74
0
  return TPM_RC_COMMAND_CODE;
75
0
}