From 390e59e38665abee76cef06c5b9a738b53b837eb Mon Sep 17 00:00:00 2001 From: Gary Belvin Date: Fri, 4 Aug 2017 13:48:37 +0100 Subject: [PATCH] Use the CONIKS hasher The moment of truth! - Where we finally switch back to using the CONIKS hashing algorithm successfully :-) --- cmd/keytransparency-client/grpcc/grpc_client.go | 4 ++-- core/client/kt/verify.go | 3 +-- integration/testutil.go | 2 +- scripts/map_payload.json | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/keytransparency-client/grpcc/grpc_client.go b/cmd/keytransparency-client/grpcc/grpc_client.go index 780903fa2..4e4e3ddca 100644 --- a/cmd/keytransparency-client/grpcc/grpc_client.go +++ b/cmd/keytransparency-client/grpcc/grpc_client.go @@ -34,7 +34,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/trillian/client" - "github.com/google/trillian/merkle/maphasher" + "github.com/google/trillian/merkle/coniks" "golang.org/x/net/context" "google.golang.org/grpc" @@ -94,7 +94,7 @@ func New(client spb.KeyTransparencyServiceClient, return &Client{ cli: client, vrf: vrf, - kt: kt.New(vrf, maphasher.Default, verifier, log), + kt: kt.New(vrf, coniks.Default, verifier, log), log: log, mutator: entry.New(), RetryCount: 1, diff --git a/core/client/kt/verify.go b/core/client/kt/verify.go index 63d1c6d3a..0c1bf3a2b 100644 --- a/core/client/kt/verify.go +++ b/core/client/kt/verify.go @@ -110,8 +110,7 @@ func (v *Verifier) VerifyGetEntryResponse(ctx context.Context, userID, appID str proof := leafProof.GetInclusion() expectedRoot := in.GetSmr().GetRootHash() mapID := in.GetSmr().GetMapId() - leafHash := v.hasher.HashLeaf(mapID, index[:], leaf) - if err := merkle.VerifyMapInclusionProof(mapID, index[:], leafHash, expectedRoot, proof, v.hasher); err != nil { + if err := merkle.VerifyMapInclusionProof(mapID, index[:], leaf, expectedRoot, proof, v.hasher); err != nil { Vlog.Printf("✗ Sparse tree proof verification failed.") return fmt.Errorf("VerifyMapInclusionProof(): %v", err) } diff --git a/integration/testutil.go b/integration/testutil.go index 91061fe14..17908f305 100644 --- a/integration/testutil.go +++ b/integration/testutil.go @@ -127,7 +127,7 @@ func NewEnv(t *testing.T) *Env { // Configure map. treeParams := stestonly.MapTree - treeParams.HashStrategy = trillian.HashStrategy_TEST_MAP_HASHER + treeParams.HashStrategy = trillian.HashStrategy_CONIKS_SHA512_256 tree, err := mapEnv.AdminClient.CreateTree(ctx, &trillian.CreateTreeRequest{ Tree: treeParams, }) diff --git a/scripts/map_payload.json b/scripts/map_payload.json index aa963817a..51ff52993 100644 --- a/scripts/map_payload.json +++ b/scripts/map_payload.json @@ -2,7 +2,7 @@ "tree":{ "tree_state":"ACTIVE", "tree_type":"MAP", - "hash_strategy":"TEST_MAP_HASHER", + "hash_strategy":"CONIKS_SHA512_256", "signature_algorithm":"ECDSA", "max_root_duration":"0", "hash_algorithm":"SHA256" @@ -12,4 +12,4 @@ "curve":"P256" } } -} \ No newline at end of file +}