Coverage Report

Created: 2025-07-11 06:15

/src/tpm2/DictionaryAttackParameters.c
Line
Count
Source (jump to first uncovered line)
1
// This file was extracted from the TCG Published
2
// Trusted Platform Module Library
3
// Part 3: Commands
4
// Family "2.0"
5
// Level 00 Revision 01.16
6
// October 30, 2014
7
8
#include "InternalRoutines.h"
9
#include "DictionaryAttackParameters_fp.h"
10
TPM_RC
11
TPM2_DictionaryAttackParameters(
12
   DictionaryAttackParameters_In    *in             // IN: input parameter list
13
   )
14
0
{
15
0
   TPM_RC           result;
16
17
   // The command needs NV update. Check if NV is available.
18
   // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at
19
   // this point
20
0
   result = NvIsAvailable();
21
0
   if(result != TPM_RC_SUCCESS) return result;
22
23
// Internal Data Update
24
25
   // Set dictionary attack parameters
26
0
   gp.maxTries = in->newMaxTries;
27
0
   gp.recoveryTime = in->newRecoveryTime;
28
0
   gp.lockoutRecovery = in->lockoutRecovery;
29
30
   // Set failed tries to 0
31
0
   gp.failedTries = 0;
32
33
   // Record the changes to NV
34
0
   NvWriteReserved(NV_FAILED_TRIES, &gp.failedTries);
35
0
   NvWriteReserved(NV_MAX_TRIES, &gp.maxTries);
36
0
   NvWriteReserved(NV_RECOVERY_TIME, &gp.recoveryTime);
37
0
   NvWriteReserved(NV_LOCKOUT_RECOVERY, &gp.lockoutRecovery);
38
39
0
   return TPM_RC_SUCCESS;
40
0
}