Skip to content

Add DictionaryAttackLockReset support #422

@salrashid123

Description

@salrashid123

Suggest adding DictionaryAttackLockReset command from 25.2 TPM2_DictionaryAttackLockReset (and probably also TPM2_DictionaryAttackParameters)

for the former, maybe

// DictionaryAttackLockReset is the input to TPM2_DictionaryAttackLockReset.
// See definition in Part 3, Commands, section 25.2.
type DictionaryAttackLockReset struct {
	LockHandle TPMIRHLockout `gotpm:"handle,auth"`
}

// Command implements the Command interface.
func (DictionaryAttackLockReset) Command() TPMCC { return TPMCCDictionaryAttackLockReset }

// Execute executes the command and returns the response.
func (cmd DictionaryAttackLockReset) Execute(t transport.TPM, s ...Session) (*DictionaryAttackLockResetResponse, error) {
	var rsp DictionaryAttackLockResetResponse
	if err := execute[DictionaryAttackLockResetResponse](t, cmd, &rsp, s...); err != nil {
		return nil, err
	}
	return &rsp, nil
}

// DictionaryAttackLockResetResponse is the response from TPM2_DictionaryAttackLockReset.
type DictionaryAttackLockResetResponse struct{}

and a simple test could be

func TestDictionaryAttackLockReset(t *testing.T) {
	thetpm, err := simulator.OpenSimulator()
	if err != nil {
		t.Fatalf("could not connect to TPM simulator: %v", err)
	}
	defer thetpm.Close()

	dl := DictionaryAttackLockReset{
	 	LockHandle: TPMRHLockout,
	}

	if _, err := dl.Execute(thetpm); err != nil {
		t.Fatalf("DictionaryAttackLockReset failed: %v", err)
	}
}

thought a full end-to-end maybe more complex where you force a lockout, verify by reading tpm2_getcap properties-variable inLockout, reset and reread the property

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions