From 04b22cbee1179bc7dacc211e7126f7a4f4ae8de6 Mon Sep 17 00:00:00 2001 From: Sanjit Bhat Date: Thu, 24 Oct 2024 15:21:53 -0400 Subject: [PATCH] adtr doesn't need to check server sig --- kt/auditor.go | 22 +++++++--------------- kt/basictest.go | 2 +- kt/test.go | 4 ++-- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/kt/auditor.go b/kt/auditor.go index 32d98d9..a9fe728 100644 --- a/kt/auditor.go +++ b/kt/auditor.go @@ -8,11 +8,10 @@ import ( ) type Auditor struct { - mu *sync.Mutex - sk cryptoffi.PrivateKey - servSigPk cryptoffi.PublicKey - keyMap *merkle.Tree - histInfo []*AdtrEpochInfo + mu *sync.Mutex + sk cryptoffi.PrivateKey + keyMap *merkle.Tree + histInfo []*AdtrEpochInfo } func (a *Auditor) checkOneUpd(nextEpoch uint64, mapLabel, mapVal []byte) bool { @@ -59,17 +58,10 @@ func (a *Auditor) Update(proof *UpdateProof) bool { } a.applyUpd(proof.Updates) - // check dig sig. + // sign dig. dig := a.keyMap.Digest() preSig := &PreSigDig{Epoch: nextEpoch, Dig: dig} preSigByt := PreSigDigEncode(make([]byte, 0), preSig) - ok0 := a.servSigPk.Verify(preSigByt, proof.Sig) - if !ok0 { - a.mu.Unlock() - return true - } - - // sign dig. sig := a.sk.Sign(preSigByt) newInfo := &AdtrEpochInfo{Dig: dig, ServSig: proof.Sig, AdtrSig: sig} a.histInfo = append(a.histInfo, newInfo) @@ -92,9 +84,9 @@ func (a *Auditor) Get(epoch uint64) (*AdtrEpochInfo, bool) { return info, false } -func newAuditor(servPk cryptoffi.PublicKey) (*Auditor, cryptoffi.PublicKey) { +func newAuditor() (*Auditor, cryptoffi.PublicKey) { mu := new(sync.Mutex) pk, sk := cryptoffi.GenerateKey() m := &merkle.Tree{} - return &Auditor{mu: mu, sk: sk, servSigPk: servPk, keyMap: m}, pk + return &Auditor{mu: mu, sk: sk, keyMap: m}, pk } diff --git a/kt/basictest.go b/kt/basictest.go index 159eb65..b96ede5 100644 --- a/kt/basictest.go +++ b/kt/basictest.go @@ -28,7 +28,7 @@ func setup(servAddr uint64, adtrAddrs []uint64) *setupParams { servRpc.Serve(servAddr) var adtrPks []cryptoffi.PublicKey for _, adtrAddr := range adtrAddrs { - adtr, adtrPk := newAuditor(servSigPk) + adtr, adtrPk := newAuditor() adtrRpc := newRpcAuditor(adtr) adtrRpc.Serve(adtrAddr) adtrPks = append(adtrPks, adtrPk) diff --git a/kt/test.go b/kt/test.go index 026cbf4..a804d17 100644 --- a/kt/test.go +++ b/kt/test.go @@ -51,10 +51,10 @@ func testAll(setup *setupParams) { doAudits(bob.cli, setup.adtrAddrs, setup.adtrPks) // final check. bob got the right key. - isReg, aliceKey := GetHist(alice.hist, bob.epoch) + isReg, alicePk := GetHist(alice.hist, bob.epoch) primitive.Assert(isReg == bob.isReg) if isReg { - primitive.Assert(std.BytesEqual(aliceKey, bob.alicePk)) + primitive.Assert(std.BytesEqual(alicePk, bob.alicePk)) } }