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

Commit a08cee2

Browse files
committed
compile again
1 parent 1e47b0f commit a08cee2

File tree

3 files changed

+8
-24
lines changed

3 files changed

+8
-24
lines changed

core/monitor/verify.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
package monitor
2020

2121
import (
22-
"fmt"
2322
"crypto"
2423
"errors"
24+
"fmt"
2525

2626
"github.com/golang/glog"
2727

@@ -82,7 +82,6 @@ func VerifyResponse(logPubKey, mapPubKey crypto.PublicKey, resp *ktpb.GetMutatio
8282
return errors.New("TODO: implement verification logic")
8383
}
8484

85-
8685
func verifyMutations(muts []*ktpb.Mutation, expectedRoot []byte) error {
8786
// TODO: export applyMutations in CreateEpoch / signer.go?
8887
//
@@ -103,8 +102,11 @@ func verifyMutations(muts []*ktpb.Mutation, expectedRoot []byte) error {
103102
// glog.Errorf("VerifyMapInclusionProof(%x): %v", index, err)
104103
// return ErrInvalidMutation
105104
//}
106-
107-
newLeaf, err := mutator.Mutate(m.GetProof().GetLeaf().GetLeafValue(), m.GetUpdate())
105+
leafVal, err := entry.FromLeafValue(m.GetProof().GetLeaf().GetLeafValue())
106+
if err != nil {
107+
return ErrInvalidMutation
108+
}
109+
newLeaf, err := mutator.Mutate(leafVal, m.GetUpdate())
108110
if err != nil {
109111
// TODO(ismail): do not return; collect other errors if any
110112
return ErrInvalidMutation
@@ -139,8 +141,6 @@ func verifyMutations(muts []*ktpb.Mutation, expectedRoot []byte) error {
139141

140142
}
141143

142-
143-
144144
// compute the new leaf and store the intermediate hashes locally.
145145
// compute the new root using local intermediate hashes from epoch e.
146146
// verify rootHash

core/monitor/verify_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,9 @@
1414

1515
package monitor
1616

17-
import (
18-
"testing"
19-
"github.com/google/trillian/merkle"
20-
"fmt"
21-
)
22-
23-
2417
// TODO(ismail): write extensive tests for verification steps (if not existing
2518
// in trillian)
2619
const (
2720
emptyMapRootB64 = "xmifEIEqCYCXbZUz2Dh1KCFmFZVn7DUVVxbBQTr1PWo="
28-
mapID = int64(0)
21+
mapID = int64(0)
2922
)
30-
31-
func TestServerVerifyMutations(t *testing.T) {
32-
// verifyInclusionProof for empty leaf
33-
if err := merkle.VerifyMapInclusionProof(mapID, index,
34-
leafHash, rootHash, proof, hasher); err != nil {
35-
return fmt.Errorf("VerifyMapInclusionProof(%x): %v", index, err)
36-
}
37-
}

impl/monitor/monitor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ import (
3535
tcrypto "github.com/google/trillian/crypto"
3636

3737
cmon "github.com/google/keytransparency/core/monitor"
38-
mopb "github.com/google/keytransparency/core/proto/monitor_v1_types"
3938
ktpb "github.com/google/keytransparency/core/proto/keytransparency_v1_types"
40-
39+
mopb "github.com/google/keytransparency/core/proto/monitor_v1_types"
4140

4241
mupb "github.com/google/keytransparency/impl/proto/mutation_v1_service"
4342
)

0 commit comments

Comments
 (0)