diff options
Diffstat (limited to 'collect.go')
-rw-r--r-- | collect.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -15,7 +15,7 @@ import ( "git.cs.kau.se/rasmoste/ct-sans/internal/chunk" "git.cs.kau.se/rasmoste/ct-sans/internal/merkle" - "git.cs.kau.se/rasmoste/ct-sans/internal/utils" + "git.cs.kau.se/rasmoste/ct-sans/internal/x509" ct "github.com/google/certificate-transparency-go" "github.com/google/certificate-transparency-go/client" "github.com/google/certificate-transparency-go/jsonclient" @@ -59,13 +59,13 @@ func collect(opts options) error { go func() { await.Add(1) defer await.Done() - handleMetrics(ctx, metricsCh, utils.Logs(md)) + handleMetrics(ctx, metricsCh, logs(md)) }() defer cancel() var wg sync.WaitGroup defer wg.Wait() - for _, log := range utils.Logs(md) { + for _, log := range logs(md) { go func(log metadata.Log) { wg.Add(1) defer wg.Done() @@ -128,7 +128,7 @@ func collect(opts options) error { for i := 0; i < len(eb.Entries); i++ { leafHashes = append(leafHashes, merkle.HashLeafNode(eb.Entries[i].LeafInput)) } - sans, errs := utils.SANsFromLeafEntries(eb.Start, eb.Entries) + sans, errs := x509.SANsFromLeafEntries(eb.Start, eb.Entries) for _, err := range errs { logger.Printf("NOTICE: %s: %v", *log.Description, err) } @@ -242,7 +242,7 @@ func persist(c *chunk.Chunk, if p.LeafIndex != c.Start { return false, fmt.Errorf("log says proof for entry %d is at index %d", c.Start, p.LeafIndex) } - if newTH.RootHash, err = merkle.TreeHeadFromRangeProof(c.LeafHashes, uint64(c.Start), utils.Proof(p.AuditPath)); err != nil { + if newTH.RootHash, err = merkle.TreeHeadFromRangeProof(c.LeafHashes, uint64(c.Start), proof(p.AuditPath)); err != nil { return false, err } @@ -253,7 +253,7 @@ func persist(c *chunk.Chunk, return true, nil // try again later } } - if err := merkle.VerifyConsistency(uint64(oldTH.TreeSize), uint64(newTH.TreeSize), oldTH.RootHash, newTH.RootHash, utils.Proof(hashes)); err != nil { + if err := merkle.VerifyConsistency(uint64(oldTH.TreeSize), uint64(newTH.TreeSize), oldTH.RootHash, newTH.RootHash, proof(hashes)); err != nil { return false, fmt.Errorf("%d %x is inconsistent with on-disk state: %v", newTH.TreeSize, newTH.RootHash, err) } @@ -261,7 +261,7 @@ func persist(c *chunk.Chunk, if hashes, err = cli.GetSTHConsistency(ctx, uint64(newTH.TreeSize), sth.TreeSize); err != nil { return true, nil // try again later } - if err := merkle.VerifyConsistency(uint64(newTH.TreeSize), sth.TreeSize, newTH.RootHash, sth.SHA256RootHash, utils.Proof(hashes)); err != nil { + if err := merkle.VerifyConsistency(uint64(newTH.TreeSize), sth.TreeSize, newTH.RootHash, sth.SHA256RootHash, proof(hashes)); err != nil { return false, fmt.Errorf("%d %x is inconsistent with signed tree head: %v", newTH.TreeSize, newTH.RootHash, err) } |