Skip to content

Commit

Permalink
go: drop long constant
Browse files Browse the repository at this point in the history
Just use 32 throughout.
  • Loading branch information
daviddrysdale committed Dec 6, 2016
1 parent ee81b72 commit 22bdf9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func serializeV1JSONSCTSignatureInput(timestamp uint64, j []byte) ([]byte, error
return buf.Bytes(), nil
}

func serializeV1PrecertSCTSignatureInput(timestamp uint64, issuerKeyHash [issuerKeyHashLength]byte, tbs []byte, ext CTExtensions) ([]byte, error) {
func serializeV1PrecertSCTSignatureInput(timestamp uint64, issuerKeyHash [32]byte, tbs []byte, ext CTExtensions) ([]byte, error) {
if err := checkCertificateFormat(tbs); err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions serialization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ func defaultPrecertTBS() []byte {
return []byte(defaultPrecertTBSString)
}

func defaultPrecertIssuerHash() [issuerKeyHashLength]byte {
var b [issuerKeyHashLength]byte
func defaultPrecertIssuerHash() [32]byte {
var b [32]byte
copy(b[:], []byte(defaultPrecertIssuerHashString))
return b
}
Expand Down
9 changes: 3 additions & 6 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
"github.com/google/certificate-transparency/go/x509"
)

const (
issuerKeyHashLength = 32
)

///////////////////////////////////////////////////////////////////////////////
// The following structures represent those outlined in RFC6962; any section
// numbers mentioned refer to that RFC.
Expand Down Expand Up @@ -110,7 +106,8 @@ type LogID struct {

// PreCert represents a Precertificate (section 3.2).
type PreCert struct {
IssuerKeyHash [issuerKeyHashLength]byte
IssuerKeyHash [32]byte
// DER-encoded TBSCertificate
TBSCertificate []byte
}

Expand Down Expand Up @@ -279,7 +276,7 @@ type Precertificate struct {
// Raw DER bytes of the precert
Raw []byte
// SHA256 hash of the issuing key
IssuerKeyHash [issuerKeyHashLength]byte
IssuerKeyHash [32]byte
// Parsed TBSCertificate structure, held in an x509.Certificate for convenience.
TBSCertificate x509.Certificate
}
Expand Down

0 comments on commit 22bdf9b

Please sign in to comment.