Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions mtca/mtca.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/jmhodges/clock"
"github.com/letsencrypt/borp"

"golang.org/x/mod/sumdb/tlog"

"github.com/letsencrypt/boulder/db"
"github.com/letsencrypt/boulder/identifier"
"github.com/letsencrypt/boulder/issuance"
Expand All @@ -31,7 +33,6 @@ import (
"github.com/letsencrypt/boulder/trees/entry"
"github.com/letsencrypt/boulder/trees/issuancelog"
"github.com/letsencrypt/boulder/trees/tiles"
"golang.org/x/mod/sumdb/tlog"
)

var ErrIssuanceLogAlreadyInitialized = errors.New("issuance log already initialized")
Expand Down Expand Up @@ -486,7 +487,7 @@ func (m *mtca) sequence(ctx context.Context) error {
ID: 0,
MTCLogID: m.logID.String(),
MTCASignature: nil,
MirrorID: "",
MirrorID: nil,
MirrorSignature: nil,
TreeSize: candidate.TreeSize(),
RootHash: newRootHash[:],
Expand Down Expand Up @@ -594,13 +595,13 @@ func (m *mtca) sequence(ctx context.Context) error {
//
// For signing, the TreeSize and RootHash fields are incorporated into a `cosigned.Message`.
type checkpoint struct {
ID int64 `db:"id"`
MTCLogID string `db:"mtcLogID"`
MTCASignature []byte `db:"mtcaSignature"`
MirrorID string `db:"mirrorID"`
MirrorSignature []byte `db:"mirrorSignature"`
TreeSize int64 `db:"treeSize"`
RootHash []byte `db:"rootHash"`
ID int64 `db:"id"`
MTCLogID string `db:"mtcLogID"`
MTCASignature []byte `db:"mtcaSignature"`
MirrorID *string `db:"mirrorID"`
MirrorSignature []byte `db:"mirrorSignature"`
TreeSize int64 `db:"treeSize"`
RootHash []byte `db:"rootHash"`
}

func (c *checkpoint) valid() error {
Expand Down Expand Up @@ -634,8 +635,12 @@ func (c *checkpoint) String() string {
if len(c.MirrorSignature) > 0 {
mirrorSig = "non-empty"
}
var mirrorID string
if c.MirrorID != nil {
mirrorID = *c.MirrorID
}
return fmt.Sprintf("ID:%d MTCLogID:%s MTCASignature:%s MirrorID:%s MirrorSignature:%s TreeSize:%d RootHash:%x",
c.ID, c.MTCLogID, caSig, c.MirrorID, mirrorSig, c.TreeSize, c.RootHash)
c.ID, c.MTCLogID, caSig, mirrorID, mirrorSig, c.TreeSize, c.RootHash)
}

func (m *mtca) latestCheckpoint(ctx context.Context) (*checkpoint, error) {
Expand Down
14 changes: 7 additions & 7 deletions mtpublisher/mtpublisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ func New(dbMap *db.WrappedMap, interval time.Duration, logID issuancelog.ID, mir
}

type checkpointEntry struct {
ID int64 `db:"id"`
MTCLogID string `db:"mtcLogID"`
MTCASignature []byte `db:"mtcaSignature"`
MirrorID string `db:"mirrorID"`
MirrorSignature []byte `db:"mirrorSignature"`
TreeSize int64 `db:"treeSize"`
RootHash []byte `db:"rootHash"`
ID int64 `db:"id"`
MTCLogID string `db:"mtcLogID"`
MTCASignature []byte `db:"mtcaSignature"`
MirrorID *string `db:"mirrorID"`
MirrorSignature []byte `db:"mirrorSignature"`
TreeSize int64 `db:"treeSize"`
RootHash []byte `db:"rootHash"`
}

// cosign cosigns the checkpoint described by tree as the mirror and returns the
Expand Down