Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Conversation

@gdbelvin
Copy link
Contributor

@gdbelvin gdbelvin commented Aug 1, 2017

MapID is part of SignedMapRoot and part of leaf and empty hash
computation. We can remove a bit of state from the client without a
reduction in security by relying on the value as reported by the server.

@gdbelvin gdbelvin force-pushed the client/mapid branch 2 times, most recently from f65d2d3 to 47915b0 Compare August 3, 2017 13:28
MapID is part of SignedMapRoot and part of leaf and empty hash
computation. We can remove a bit of state from the client without a
reduction in security by relying on the value as reported by the server.
@gdbelvin gdbelvin force-pushed the client/mapid branch 2 times, most recently from e880d78 to c42470e Compare August 3, 2017 14:07
@codecov-io
Copy link

codecov-io commented Aug 3, 2017

Codecov Report

Merging #721 into master will decrease coverage by 0.03%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #721      +/-   ##
==========================================
- Coverage   53.25%   53.22%   -0.04%     
==========================================
  Files          38       38              
  Lines        3207     3207              
==========================================
- Hits         1708     1707       -1     
- Misses       1208     1209       +1     
  Partials      291      291
Impacted Files Coverage Δ
core/client/kt/verify.go 19.44% <0%> (-0.28%) ⬇️
integration/testutil.go 65.21% <100%> (ø) ⬆️
core/tree/sparse/verifier/verifier.go 81.35% <100%> (-0.32%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d454063...128f93c. Read the comment docs.

@gdbelvin gdbelvin requested review from cesarghali, liamsi and phad August 3, 2017 14:38
Copy link
Contributor

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Question: the reason a server can not just present different (consistent) maps to different clients is that the server will staple back monitors signatures (and other gossip protocols), right?

@gdbelvin
Copy link
Contributor Author

gdbelvin commented Aug 4, 2017

That's right. An append-only log makes sure that if the server ever forks, it must continue to fork in perpetuity. This makes it much easier for a gossip protocol to detect the inconsistency.

@gdbelvin gdbelvin merged commit f839b54 into google:master Aug 4, 2017
@gdbelvin gdbelvin deleted the client/mapid branch August 4, 2017 11:04
// New creates a new client.
func New(mapID int64,
func New(
client spb.KeyTransparencyServiceClient,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to the line above it.

"github.com/google/keytransparency/core/crypto/commitments"
"github.com/google/keytransparency/core/crypto/vrf"
"github.com/google/keytransparency/core/tree/sparse"
tv "github.com/google/keytransparency/core/tree/sparse/verifier"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this here, AFAIK we're putting all Key Transparency imports in the same group regardless of they're renamed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grouping that we're using is:

  • Standard packages.
  • KT packages.
  • Others.
  • Proto.

I'm completely fine with a new scheme but we should apply it to all files.

"github.com/golang/protobuf/proto"
"github.com/google/trillian"
"github.com/google/trillian/client"
tcrypto "github.com/google/trillian/crypto"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

}

if err := v.tree.VerifyProof(leafProof.Inclusion, index[:], leafProof.Leaf.LeafValue, sparse.FromBytes(in.GetSmr().RootHash)); err != nil {
mapID := in.GetSmr().GetMapId()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to define mapID here. Its value can be inlined in the next line.

// VerifyProof verifies a tree proof of a given leaf at a given index based on
// the provided root and neighbor list
func (v *Verifier) VerifyProof(neighbors [][]byte, index, leaf []byte, root sparse.Hash) error {
func (v *Verifier) VerifyProof(treeID int64, neighbors [][]byte, index, leaf []byte, root sparse.Hash) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use mapID instead of treeID to keep the terms consistent.

// calculateRoot calculates the root of the tree branch defined by leaf and
// neighbors.
func (v *Verifier) calculateRoot(neighbors [][]byte, bindex string, leaf []byte) (sparse.Hash, error) {
func (v *Verifier) calculateRoot(treeID int64, neighbors [][]byte, bindex string, leaf []byte) (sparse.Hash, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@cesarghali
Copy link
Contributor

I just realized this got merged. I can apply those changes in a "small fixes" PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants