attest: address lint feedback

* Make comment directly above _ import
* Fix godoc for AttestationParameters
* Don't declare variable and assign the zero value (var x int = 0)
This commit is contained in:
Eric Chiang 2019-09-20 10:34:07 -07:00
parent 0f650714d9
commit 51b8d116ec
2 changed files with 16 additions and 15 deletions

View File

@ -123,8 +123,8 @@ func (k *AIK) Quote(tpm *TPM, nonce []byte, alg HashAlg) (*Quote, error) {
return k.aik.quote(tpm.tpm, nonce, alg) return k.aik.quote(tpm.tpm, nonce, alg)
} }
// Parameters returns information about the AIK, typically used to generate // AttestationParameters returns information about the AIK, typically used to
// a credential activation challenge. // generate a credential activation challenge.
func (k *AIK) AttestationParameters() AttestationParameters { func (k *AIK) AttestationParameters() AttestationParameters {
return k.aik.attestationParameters() return k.aik.attestationParameters()
} }

View File

@ -17,14 +17,14 @@ package attest
import ( import (
"bytes" "bytes"
"crypto" "crypto"
"crypto/rsa"
"crypto/sha1"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"io" "io"
"sort" "sort"
// Ensure hashes are available. // Ensure hashes are available.
"crypto/rsa"
"crypto/sha1"
_ "crypto/sha256" _ "crypto/sha256"
"github.com/google/go-tpm/tpm2" "github.com/google/go-tpm/tpm2"
@ -326,17 +326,18 @@ type specAlgSize struct {
Size uint16 Size uint16
} }
var ( // Expected values for various Spec ID Event fields.
// Expected values for various Spec ID Event fields. // https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf#page=19
// https://trustedcomputinggroup.org/wp-content/uploads/EFI-Protocol-Specification-rev13-160330final.pdf#page=19 var wantSignature = [16]byte{0x53, 0x70,
wantSignature = [16]byte{0x53, 0x70, 0x65, 0x63, 0x20, 0x49,
0x65, 0x63, 0x20, 0x49, 0x44, 0x20, 0x45, 0x76,
0x44, 0x20, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x30,
0x65, 0x6e, 0x74, 0x30, 0x33, 0x00} // "Spec ID Event03\0"
0x33, 0x00} // "Spec ID Event03\0"
wantMajor uint8 = 2 const (
wantMinor uint8 = 0 wantMajor = 2
wantErrata = 0 wantMinor = 0
wantErrata = 0
) )
// parseSpecIDEvent parses a TCG_EfiSpecIDEventStruct structure from the reader. // parseSpecIDEvent parses a TCG_EfiSpecIDEventStruct structure from the reader.