Skip to content

Commit

Permalink
bootenv: add scope tests
Browse files Browse the repository at this point in the history
the mockPlatformhandler was copied over to the bootenv package and
all the test logic related to the new scope functionality was decoupled
from keydata_test.go.
  • Loading branch information
sespiros committed Jan 31, 2024
1 parent 34babed commit 622643d
Show file tree
Hide file tree
Showing 2 changed files with 329 additions and 31 deletions.
11 changes: 11 additions & 0 deletions bootenv/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"errors"

Expand Down Expand Up @@ -146,3 +147,13 @@ func NewEcdsaPublicKey(rand []byte) (ecdsaPublicKey, error) {

return pk, nil
}

func NewPrimaryKey(sz1 int) (secboot.PrimaryKey, error) {
primaryKey := make(secboot.PrimaryKey, sz1)
_, err := rand.Read(primaryKey)
if err != nil {
return nil, err
}

return primaryKey, nil
}
Loading

0 comments on commit 622643d

Please sign in to comment.