Skip to content

Commit

Permalink
Run gofmt (1.11.4) (#68)
Browse files Browse the repository at this point in the history
This mainly fixes alignment issues in structs. I will also allow for
gofmt to be used for Travis presubmits.
  • Loading branch information
josephlr authored and Andrew Lytvynov committed Jan 25, 2019
1 parent 88b6b79 commit b81c574
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions tpm/errors.go
Expand Up @@ -184,7 +184,7 @@ var tpmErrMsgs = map[tpmError]string{
errNoWrapTransport: "the TPM does not allow for wrapped transport sessions",
errAuditFailUnsuccessful: "TPM audit construction failed and the underlying command was returning a failure code also",
errAuditFailSuccessful: "TPM audit construction failed and the underlying command was returning success",
errNotResettable: "attempt to reset a PCR register that does not have the resettable attribute",
errNotResettable: "attempt to reset a PCR register that does not have the resettable attribute",
errNotLocal: "attempt to reset a PCR register that requires locality and locality modifier not part of command transport",
errBadType: "make identity blob not properly typed",
errInvalidResource: "when saving context identified resource type does not match actual resource",
Expand Down Expand Up @@ -220,7 +220,7 @@ var tpmErrMsgs = map[tpmError]string{
errDAAIssuerSettings: "the consistency check on DAA_issuerSettings has failed",
errDAASettings: "the consistency check on DAA_tpmSpecific has failed",
errDAAState: "the atomic process indicated by the submitted DAA command is not the expected process",
errDAAIssuerValidity: "the issuer's validity check has detected an inconsistency",
errDAAIssuerValidity: "the issuer's validity check has detected an inconsistency",
errDAAWrongW: "the consistency check on w has failed",
errBadHandle: "the handle is incorrect",
errBadDelegate: "delegation is not correct",
Expand Down
38 changes: 19 additions & 19 deletions tpm/structures.go
Expand Up @@ -192,7 +192,7 @@ type keyParams struct {
AlgID uint32
EncScheme uint16
SigScheme uint16
Params []byte // Serialized rsaKeyParams or symmetricKeyParams.
Params []byte // Serialized rsaKeyParams or symmetricKeyParams.
}

// An rsaKeyParams encodes the length of the RSA prime in bits, the number of
Expand All @@ -212,33 +212,33 @@ type symmetricKeyParams struct {

// A key is a TPM representation of a key.
type key struct {
Version uint32
KeyUsage uint16
KeyFlags uint32
AuthDataUsage byte
Version uint32
KeyUsage uint16
KeyFlags uint32
AuthDataUsage byte
AlgorithmParams keyParams
PCRInfo []byte
PubKey []byte
EncData []byte
PCRInfo []byte
PubKey []byte
EncData []byte
}

// A key12 is a newer TPM representation of a key.
type key12 struct {
Tag uint16
Zero uint16 // Always all 0.
KeyUsage uint16
KeyFlags uint32
AuthDataUsage byte
Tag uint16
Zero uint16 // Always all 0.
KeyUsage uint16
KeyFlags uint32
AuthDataUsage byte
AlgorithmParams keyParams
PCRInfo []byte // This must be a serialization of a pcrInfoLong.
PubKey []byte
EncData []byte
PCRInfo []byte // This must be a serialization of a pcrInfoLong.
PubKey []byte
EncData []byte
}

// A pubKey represents a public key known to the TPM.
type pubKey struct {
AlgorithmParams keyParams
Key []byte
Key []byte
}

// A tpmStoredData holds sealed data from the TPM.
Expand Down Expand Up @@ -298,11 +298,11 @@ func convertPubKey(pk crypto.PublicKey) (*pubKey, error) {
AlgID: algRSA,
EncScheme: esNone,
SigScheme: ssRSASaPKCS1v15SHA1,
Params: rsakpb,
Params: rsakpb,
}
pubKey := pubKey{
AlgorithmParams: kp,
Key: pkRSA.N.Bytes(),
Key: pkRSA.N.Bytes(),
}

return &pubKey, nil
Expand Down
22 changes: 11 additions & 11 deletions tpm/tpm.go
Expand Up @@ -578,14 +578,14 @@ func MakeIdentity(rw io.ReadWriter, srkAuth []byte, ownerAuth []byte, aikAuth []
AlgID: algRSA,
EncScheme: esNone,
SigScheme: ssRSASaPKCS1v15SHA1,
Params: packedParams,
Params: packedParams,
}

aik := &key{
Version: 0x01010000,
KeyUsage: keyIdentity,
KeyFlags: 0,
AuthDataUsage: authAlways,
Version: 0x01010000,
KeyUsage: keyIdentity,
KeyFlags: 0,
AuthDataUsage: authAlways,
AlgorithmParams: aikParams,
}

Expand Down Expand Up @@ -830,13 +830,13 @@ func TakeOwnership(rw io.ReadWriter, newOwnerAuth digest, newSRKAuth digest, pub
AlgID: algRSA,
EncScheme: esRSAEsOAEPSHA1MGF1,
SigScheme: ssNone,
Params: srkpb,
Params: srkpb,
}
srk := &key{
Version: 0x01010000,
KeyUsage: keyStorage,
KeyFlags: 0,
AuthDataUsage: authAlways,
Version: 0x01010000,
KeyUsage: keyStorage,
KeyFlags: 0,
AuthDataUsage: authAlways,
AlgorithmParams: srkParams,
}

Expand Down Expand Up @@ -929,7 +929,7 @@ func CreateWrapKey(rw io.ReadWriter, srkAuth []byte, usageAuth digest, migration
AlgID: algRSA,
EncScheme: esNone,
SigScheme: ssRSASaPKCS1v15DER,
Params: rParamsPacked,
Params: rParamsPacked,
},
PCRInfo: pcrInfoBytes,
}
Expand Down

0 comments on commit b81c574

Please sign in to comment.