Skip to content

Commit

Permalink
Merge pull request #8 from pohlm01/main
Browse files Browse the repository at this point in the history
  • Loading branch information
bwesterb authored Oct 12, 2024
2 parents 76c8782 + db0ad04 commit 05fab8f
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions mtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,14 @@ func (batch *Batch) hashNode(out, left, right []byte, index uint64,
var b cryptobyte.Builder

b.AddUint8(1)
var issuer, err = batch.CA.Issuer.MarashalBinary()
tai, err := TrustAnchorIdentifier{
Issuer: batch.CA.Issuer,
BatchNumber: batch.Number,
}.MarshalBinary()
if err != nil {
return nil
return err
}
b.AddBytes(issuer)
b.AddUint32(batch.Number)
b.AddBytes(tai)
b.AddUint64(index)
b.AddUint8(level)
b.AddBytes(left)
Expand All @@ -1050,12 +1052,14 @@ func (batch *Batch) hashNode(out, left, right []byte, index uint64,
func (batch *Batch) hashEmpty(out []byte, index uint64, level uint8) error {
var b cryptobyte.Builder
b.AddUint8(0)
var issuer, err = batch.CA.Issuer.MarashalBinary()
tai, err := TrustAnchorIdentifier{
Issuer: batch.CA.Issuer,
BatchNumber: batch.Number,
}.MarshalBinary()
if err != nil {
return err
}
b.AddBytes(issuer)
b.AddUint32(batch.Number)
b.AddBytes(tai)
b.AddUint64(index)
b.AddUint8(level)
buf, err := b.Bytes()
Expand Down Expand Up @@ -1144,12 +1148,14 @@ func (a *AbridgedAssertion) Key(out []byte) error {
func (a *AbridgedAssertion) Hash(out []byte, batch *Batch, index uint64) error {
var b cryptobyte.Builder
b.AddUint8(2)
var issuer, err = batch.CA.Issuer.MarashalBinary()
tai, err := TrustAnchorIdentifier{
Issuer: batch.CA.Issuer,
BatchNumber: batch.Number,
}.MarshalBinary()
if err != nil {
return nil
return err
}
b.AddBytes(issuer)
b.AddUint32(batch.Number)
b.AddBytes(tai)
b.AddUint64(index)
buf, err := a.MarshalBinary()
if err != nil {
Expand Down

0 comments on commit 05fab8f

Please sign in to comment.