diff --git a/protocol/auditlog.go b/protocol/auditlog.go index 34aaef5..249bc76 100644 --- a/protocol/auditlog.go +++ b/protocol/auditlog.go @@ -16,6 +16,16 @@ type directoryHistory struct { snapshots map[uint64]*DirSTR } +// A ConiksAuditLog maintains the histories +// of all CONIKS directories known to a CONIKS auditor, +// indexing the histories by the hash of a directory's initial +// STR (specifically, the hash of the STR's signature). +// Each history includes the directory's domain addr as a string, its +// public signing key enabling the auditor to verify the corresponding +// signed tree roots, and a list with all observed snapshots in +// chronological order. +type ConiksAuditLog map[[crypto.HashSizeByte]byte]*directoryHistory + // caller validates that initSTR is for epoch 0. func newDirectoryHistory(addr string, signKey sign.PublicKey, initSTR *DirSTR) *directoryHistory { a := NewAuditor(signKey, initSTR) @@ -28,16 +38,6 @@ func newDirectoryHistory(addr string, signKey sign.PublicKey, initSTR *DirSTR) * return h } -// A ConiksAuditLog maintains the histories -// of all CONIKS directories known to a CONIKS auditor, -// indexing the histories by the hash of a directory's initial -// STR (specifically, the hash of the STR's signature). -// Each history includes the directory's domain addr as a string, its -// public signing key enabling the auditor to verify the corresponding -// signed tree roots, and a list with all observed snapshots in -// chronological order. -type ConiksAuditLog map[[crypto.HashSizeByte]byte]*directoryHistory - // updateVerifiedSTR inserts the latest verified STR into a directory history; // assumes the STRs have been validated by the caller. func (h *directoryHistory) updateVerifiedSTR(newVerified *DirSTR) { @@ -65,7 +65,7 @@ func (h *directoryHistory) insertRange(snaps []*DirSTR) { // from a specific directory. func (h *directoryHistory) Audit(msg *Response) error { if err := msg.validate(); err != nil { - return err.(ErrorCode) + return err } strs := msg.DirectoryResponse.(*STRHistoryRange) @@ -121,7 +121,6 @@ func (l ConiksAuditLog) get(dirInitHash [crypto.HashSizeByte]byte) (*directoryHi // from disk (either first-time startup, or after reboot). func (l ConiksAuditLog) InitHistory(addr string, signKey sign.PublicKey, snaps []*DirSTR) error { - // make sure we're getting an initial STR at the very least if len(snaps) < 1 || snaps[0].Epoch != 0 { // FIXME: This should be a more generic "malformed error" diff --git a/protocol/directory.go b/protocol/directory.go index 1dc6723..6bb27e0 100644 --- a/protocol/directory.go +++ b/protocol/directory.go @@ -341,7 +341,6 @@ func (d *ConiksDirectory) Monitor(req *MonitoringRequest) ( // omitted in req, the end of the range will be set to d.LatestSTR().Epoch. func (d *ConiksDirectory) GetSTRHistory(req *STRHistoryRequest) (*Response, ErrorCode) { - // make sure the request is well-formed if req.StartEpoch > d.LatestSTR().Epoch || (req.EndEpoch != 0 && req.EndEpoch < req.StartEpoch) { diff --git a/protocol/message.go b/protocol/message.go index c929c55..e034fb1 100644 --- a/protocol/message.go +++ b/protocol/message.go @@ -149,7 +149,7 @@ type DirectoryProof struct { // STR representing a range of the STR hash chain. If the range only // covers the latest epoch, the list only contains a single STR. // A CONIKS auditor returns this DirectoryResponse type upon an -// AudutingRequest from a client, and a CONIKS directory returns +// AuditingRequest from a client, and a CONIKS directory returns // this message upon an STRHistoryRequest from an auditor. type STRHistoryRange struct { STR []*DirSTR