mirror of
https://github.com/google/go-attestation.git
synced 2025-02-21 01:11:21 +00:00
Fix linter errors, go fmt (#130)
This commit is contained in:
parent
9631d92677
commit
25ce56400c
@ -114,7 +114,7 @@ func TestSimTPM20ActivateCredential(t *testing.T) {
|
||||
|
||||
ap := ActivationParameters{
|
||||
TPMVersion: TPMVersion20,
|
||||
AK: ak.AttestationParameters(),
|
||||
AK: ak.AttestationParameters(),
|
||||
EK: ek,
|
||||
}
|
||||
secret, challenge, err := ap.Generate()
|
||||
|
@ -150,7 +150,7 @@ func TestTPMActivateCredential(t *testing.T) {
|
||||
|
||||
ap := ActivationParameters{
|
||||
TPMVersion: TPMVersion12,
|
||||
AK: ak.AttestationParameters(),
|
||||
AK: ak.AttestationParameters(),
|
||||
EK: ek,
|
||||
}
|
||||
secret, challenge, err := ap.Generate()
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package attest
|
||||
|
||||
// FuzzParseEventLog is an exported entrypoint for fuzzers to test the eventlog
|
||||
// parser. This method should not be used for any other purpose.
|
||||
func FuzzParseEventLog(data []byte) int {
|
||||
_, err := ParseEventLog(data)
|
||||
if err != nil {
|
||||
|
@ -161,7 +161,7 @@ func TestParseSpecIDEvent(t *testing.T) {
|
||||
data: append(
|
||||
[]byte("Spec ID Event03"), 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, // platform class
|
||||
0x0, // verison minor
|
||||
0x0, // version minor
|
||||
0x2, // version major
|
||||
0x0, // errata
|
||||
0x8, // uintn size
|
||||
@ -178,7 +178,7 @@ func TestParseSpecIDEvent(t *testing.T) {
|
||||
data: append(
|
||||
[]byte("Spec ID Event03"), 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, // platform class
|
||||
0x0, // verison minor
|
||||
0x0, // version minor
|
||||
0x2, // version major
|
||||
0x0, // errata
|
||||
0x8, // uintn size
|
||||
@ -197,7 +197,7 @@ func TestParseSpecIDEvent(t *testing.T) {
|
||||
data: append(
|
||||
[]byte("Spec ID Event03"), 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, // platform class
|
||||
0x2, // verison minor
|
||||
0x2, // version minor
|
||||
0x1, // version major
|
||||
0x0, // errata
|
||||
0x8, // uintn size
|
||||
@ -216,7 +216,7 @@ func TestParseSpecIDEvent(t *testing.T) {
|
||||
data: append(
|
||||
[]byte("Spec ID Event03"), 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, // platform class
|
||||
0x0, // verison minor
|
||||
0x0, // version minor
|
||||
0x2, // version major
|
||||
0x0, // errata
|
||||
0x8, // uintn size
|
||||
|
@ -72,7 +72,7 @@ func ExampleAK_credentialActivation() {
|
||||
activation := attest.ActivationParameters{
|
||||
TPMVersion: tpm.Version(),
|
||||
EK: ek[0].Public,
|
||||
AK: ap,
|
||||
AK: ap,
|
||||
}
|
||||
secret, challenge, err := activation.Generate()
|
||||
if err != nil {
|
||||
|
@ -100,18 +100,18 @@ var (
|
||||
)
|
||||
|
||||
func cryptoHash(h tpm2.Algorithm) (crypto.Hash, error) {
|
||||
switch h {
|
||||
case tpm2.AlgSHA1:
|
||||
return crypto.SHA1, nil
|
||||
case tpm2.AlgSHA256:
|
||||
return crypto.SHA256, nil
|
||||
case tpm2.AlgSHA384:
|
||||
return crypto.SHA384, nil
|
||||
case tpm2.AlgSHA512:
|
||||
return crypto.SHA512, nil
|
||||
default:
|
||||
return crypto.Hash(0), fmt.Errorf("unsupported signature digest: %v", h)
|
||||
}
|
||||
switch h {
|
||||
case tpm2.AlgSHA1:
|
||||
return crypto.SHA1, nil
|
||||
case tpm2.AlgSHA256:
|
||||
return crypto.SHA256, nil
|
||||
case tpm2.AlgSHA384:
|
||||
return crypto.SHA384, nil
|
||||
case tpm2.AlgSHA512:
|
||||
return crypto.SHA512, nil
|
||||
default:
|
||||
return crypto.Hash(0), fmt.Errorf("unsupported signature digest: %v", h)
|
||||
}
|
||||
}
|
||||
|
||||
type tpm20Info struct {
|
||||
|
@ -20,17 +20,17 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
var unsupportedError = errors.New("tpm operations not supported from given build parameters")
|
||||
var errUnsupported = errors.New("tpm operations not supported from given build parameters")
|
||||
|
||||
type platformTPM struct {
|
||||
}
|
||||
|
||||
func probeSystemTPMs() ([]probedTPM, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func openTPM(tpm probedTPM) (*TPM, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) tpmVersion() TPMVersion {
|
||||
@ -39,29 +39,29 @@ func (t *platformTPM) tpmVersion() TPMVersion {
|
||||
|
||||
func (t *platformTPM) close() error {
|
||||
|
||||
return unsupportedError
|
||||
return errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) info() (*TPMInfo, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) loadAK(opaqueBlob []byte) (*AK, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) eks() ([]EK, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) newAK(opts *AKConfig) (*AK, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) pcrs(alg HashAlg) ([]PCR, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
||||
func (t *platformTPM) measurementLog() ([]byte, error) {
|
||||
return nil, unsupportedError
|
||||
return nil, errUnsupported
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user