Shortened name of the partial decryption verification function
This commit is contained in:
2 files changed
+7
-7
No files matched your search
+4
-4
@@ -48,7 +48,7 @@ func (tk *ThresholdPublicKey) delta() *big.Int {
|
|||||||
// Checks if the number of received, unique shares is less than the
|
// Checks if the number of received, unique shares is less than the
|
||||||
// required threshold.
|
// required threshold.
|
||||||
// This method does not execute ZKP on received shares.
|
// This method does not execute ZKP on received shares.
|
||||||
func (tk *ThresholdPublicKey) makeVerificationBeforeCombiningPartialDecryptions(shares []*PartialDecryption) error {
|
func (tk *ThresholdPublicKey) verifyPartialDecryptions(shares []*PartialDecryption) error {
|
||||||
if len(shares) < tk.Threshold {
|
if len(shares) < tk.Threshold {
|
||||||
return errors.New("Threshold not meet")
|
return errors.New("Threshold not meet")
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ func (tk *ThresholdPublicKey) computeDecryption(cprime *big.Int) *big.Int {
|
|||||||
// This function does not verify zero knowledge proofs. Returned message can be
|
// This function does not verify zero knowledge proofs. Returned message can be
|
||||||
// incorrectly decrypted if an adversary corrupted partial decryption.
|
// incorrectly decrypted if an adversary corrupted partial decryption.
|
||||||
func (tk *ThresholdPublicKey) CombinePartialDecryptions(shares []*PartialDecryption) (*big.Int, error) {
|
func (tk *ThresholdPublicKey) CombinePartialDecryptions(shares []*PartialDecryption) (*big.Int, error) {
|
||||||
if err := tk.makeVerificationBeforeCombiningPartialDecryptions(shares); err != nil {
|
if err := tk.verifyPartialDecryptions(shares); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,8 +131,8 @@ func (tk *ThresholdPublicKey) CombinePartialDecryptions(shares []*PartialDecrypt
|
|||||||
return tk.computeDecryption(cprime), nil
|
return tk.computeDecryption(cprime), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combines partial decryptions provided by decription servers and returns
|
// Combines partial decryptions provided by decryption servers and returns
|
||||||
// decrypted message.
|
// full decrypted message.
|
||||||
// Function verifies zero knowledge proofs and filters out all shares that failed
|
// Function verifies zero knowledge proofs and filters out all shares that failed
|
||||||
// verification.
|
// verification.
|
||||||
func (tk *ThresholdPublicKey) CombinePartialDecryptionsZKP(shares []*PartialDecryptionZKP) (*big.Int, error) {
|
func (tk *ThresholdPublicKey) CombinePartialDecryptionsZKP(shares []*PartialDecryptionZKP) (*big.Int, error) {
|
||||||
|
|||||||
@@ -129,16 +129,16 @@ func TestDecryptAndProduceZNP(t *testing.T) {
|
|||||||
func TestMakeVerificationBeforeCombiningPartialDecryptions(t *testing.T) {
|
func TestMakeVerificationBeforeCombiningPartialDecryptions(t *testing.T) {
|
||||||
tk := new(ThresholdPublicKey)
|
tk := new(ThresholdPublicKey)
|
||||||
tk.Threshold = 2
|
tk.Threshold = 2
|
||||||
if tk.makeVerificationBeforeCombiningPartialDecryptions([]*PartialDecryption{}) == nil {
|
if tk.verifyPartialDecryptions([]*PartialDecryption{}) == nil {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
prms := []*PartialDecryption{new(PartialDecryption), new(PartialDecryption)}
|
prms := []*PartialDecryption{new(PartialDecryption), new(PartialDecryption)}
|
||||||
prms[1].Id = 1
|
prms[1].Id = 1
|
||||||
if tk.makeVerificationBeforeCombiningPartialDecryptions(prms) != nil {
|
if tk.verifyPartialDecryptions(prms) != nil {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
prms[1].Id = 0
|
prms[1].Id = 0
|
||||||
if tk.makeVerificationBeforeCombiningPartialDecryptions(prms) == nil {
|
if tk.verifyPartialDecryptions(prms) == nil {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user