Home | History | Annotate | Download | only in tpm2
      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 {
     15    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    result = NvIsAvailable();
     21    if(result != TPM_RC_SUCCESS) return result;
     22 
     23 // Internal Data Update
     24 
     25    // Set dictionary attack parameters
     26    gp.maxTries = in->newMaxTries;
     27    gp.recoveryTime = in->newRecoveryTime;
     28    gp.lockoutRecovery = in->lockoutRecovery;
     29 
     30    // Set failed tries to 0
     31    gp.failedTries = 0;
     32 
     33    // Record the changes to NV
     34    NvWriteReserved(NV_FAILED_TRIES, &gp.failedTries);
     35    NvWriteReserved(NV_MAX_TRIES, &gp.maxTries);
     36    NvWriteReserved(NV_RECOVERY_TIME, &gp.recoveryTime);
     37    NvWriteReserved(NV_LOCKOUT_RECOVERY, &gp.lockoutRecovery);
     38 
     39    return TPM_RC_SUCCESS;
     40 }
     41