-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f17b035
commit 6716d88
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package tpm2test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/google/go-tpm/tpm2" | ||
"github.com/google/go-tpm/tpm2/transport/simulator" | ||
) | ||
|
||
func TestEvictControl(t *testing.T) { | ||
thetpm, err := simulator.OpenSimulator() | ||
if err != nil { | ||
t.Fatalf("could not connect to TPM simulator: %v", err) | ||
} | ||
defer thetpm.Close() | ||
|
||
srkCreate := CreatePrimary{ | ||
PrimaryHandle: TPMRHOwner, | ||
InPublic: New2B(ECCSRKTemplate), | ||
} | ||
|
||
srkCreateRsp, err := srkCreate.Execute(thetpm) | ||
if err != nil { | ||
t.Fatalf("could not generate SRK: %v", err) | ||
} | ||
|
||
_, err = EvictControl{ | ||
Auth: TPMRHOwner, | ||
ObjectHandle: &NamedHandle{ | ||
Handle: srkCreateRsp.ObjectHandle, | ||
Name: srkCreateRsp.Name, | ||
}, | ||
PersistentHandle: 0x81000000, | ||
}.Execute(thetpm) | ||
if err != nil { | ||
t.Fatalf("could not persist: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters