-
Notifications
You must be signed in to change notification settings - Fork 10
/
cmds_testing.go
34 lines (29 loc) · 1003 Bytes
/
cmds_testing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright 2019 Canonical Ltd.
// Licensed under the LGPLv3 with static-linking exception.
// See LICENCE file for details.
package tpm2
// Section 9 - Start-up
func (t *TPMContext) SelfTest(fullTest bool, sessions ...SessionContext) error {
return t.StartCommand(CommandSelfTest).
AddParams(fullTest).
AddExtraSessions(sessions...).
Run(nil)
}
func (t *TPMContext) IncrementalSelfTest(toTest AlgorithmList, sessions ...SessionContext) (AlgorithmList, error) {
var toDoList AlgorithmList
if err := t.StartCommand(CommandIncrementalSelfTest).
AddParams(toTest).
AddExtraSessions(sessions...).
Run(nil, &toDoList); err != nil {
return nil, err
}
return toDoList, nil
}
func (t *TPMContext) GetTestResult(sessions ...SessionContext) (outData MaxBuffer, testResult ResponseCode, err error) {
if err := t.StartCommand(CommandGetTestResult).
AddExtraSessions(sessions...).
Run(nil, &outData, &testResult); err != nil {
return nil, 0, err
}
return outData, testResult, nil
}