Skip to content

Commit

Permalink
Change TaggingDet function in order to correct functionning.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skinnery committed May 2, 2018
1 parent 0c05ac8 commit 2d111f2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions lib/proofs/aggregation_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ func TestAggregationProof(t *testing.T) {
det2 := testCipherVect1
det3 := testCipherVect2

protocolsunlynx.TaggingDet(det1, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det1, secKey, secKey, pubKey, true)
deterministicGroupAttributes := make(libunlynx.DeterministCipherVector, len(det1))
for j, c := range det1 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
}
newDetResponse1 := libunlynx.FilteredResponseDet{Fr: libunlynx.FilteredResponse{GroupByEnc: testCipherVect2, AggregatingAttributes: testCipherVect1}, DetTagGroupBy: deterministicGroupAttributes.Key()}

protocolsunlynx.TaggingDet(det2, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det2, secKey, secKey, pubKey, true)

deterministicGroupAttributes = make(libunlynx.DeterministCipherVector, len(det2))
for j, c := range det2 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
}
newDetResponse2 := libunlynx.FilteredResponseDet{Fr: libunlynx.FilteredResponse{GroupByEnc: testCipherVect1, AggregatingAttributes: testCipherVect1}, DetTagGroupBy: deterministicGroupAttributes.Key()}

protocolsunlynx.TaggingDet(det3, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det3, secKey, secKey, pubKey, true)
deterministicGroupAttributes = make(libunlynx.DeterministCipherVector, len(det3))
for j, c := range det3 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
Expand Down
6 changes: 3 additions & 3 deletions lib/proofs/collective_aggregation_proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ func TestCollectiveAggregationProof(t *testing.T) {
det2 := testCipherVect1
det3 := testCipherVect2

protocolsunlynx.TaggingDet(det1, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det1, secKey, secKey, pubKey, true)
deterministicGroupAttributes := make(libunlynx.DeterministCipherVector, len(det1))
for j, c := range det1 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
}
newDetResponse1 := libunlynx.FilteredResponseDet{Fr: libunlynx.FilteredResponse{GroupByEnc: testCipherVect2, AggregatingAttributes: testCipherVect1}, DetTagGroupBy: deterministicGroupAttributes.Key()}

protocolsunlynx.TaggingDet(det2, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det2, secKey, secKey, pubKey, true)

deterministicGroupAttributes = make(libunlynx.DeterministCipherVector, len(det2))
for j, c := range det2 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
}
newDetResponse2 := libunlynx.FilteredResponseDet{Fr: libunlynx.FilteredResponse{GroupByEnc: testCipherVect1, AggregatingAttributes: testCipherVect1}, DetTagGroupBy: deterministicGroupAttributes.Key()}

protocolsunlynx.TaggingDet(det3, secKey, secKey, pubKey, true)
protocolsunlynx.TaggingDet(&det3, secKey, secKey, pubKey, true)
deterministicGroupAttributes = make(libunlynx.DeterministCipherVector, len(det3))
for j, c := range det3 {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
Expand Down
18 changes: 9 additions & 9 deletions protocols/deterministic_tagging_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
j = len(deterministicTaggingTarget.Data)
}
tmp := deterministicTaggingTarget.Data[i:j]
TaggingDet(tmp, p.Private(), *p.SurveySecretKey, p.Public(), p.Proofs)
TaggingDet(&tmp, p.Private(), *p.SurveySecretKey, p.Public(), p.Proofs)
copy(deterministicTaggingTarget.Data[i:j], tmp)
}(i)
}
wg.Wait()
} else {
TaggingDet(deterministicTaggingTarget.Data, p.Private(), *p.SurveySecretKey, p.Public(), p.Proofs)
TaggingDet(&deterministicTaggingTarget.Data, p.Private(), *p.SurveySecretKey, p.Public(), p.Proofs)
}

var TaggedData []libunlynx.DeterministCipherText
Expand Down Expand Up @@ -269,24 +269,24 @@ func sendingDet(p DeterministicTaggingProtocol, detTarget DeterministicTaggingMe
}

// TaggingDet performs one step in the distributed deterministic tagging process and creates corresponding proof
func TaggingDet(cv libunlynx.CipherVector, privKey, secretContrib kyber.Scalar, pubKey kyber.Point, proofs bool) {
switchedVect := libunlynx.NewCipherVector(len(cv))
switchedVect.DeterministicTagging(&cv, privKey, secretContrib)
func TaggingDet(cv *libunlynx.CipherVector, privKey, secretContrib kyber.Scalar, pubKey kyber.Point, proofs bool) {
switchedVect := libunlynx.NewCipherVector(len(*cv))
switchedVect.DeterministicTagging(cv, privKey, secretContrib)

if proofs {
p1 := libunlynxproofs.VectorDeterministicTagProofCreation(cv, *switchedVect, secretContrib, privKey)
p1 := libunlynxproofs.VectorDeterministicTagProofCreation(*cv, *switchedVect, secretContrib, privKey)
//proof publication
commitSecret := libunlynx.SuiTe.Point().Mul(secretContrib, libunlynx.SuiTe.Point().Base())
publishedProof := libunlynxproofs.PublishedDeterministicTaggingProof{Dhp: p1, VectBefore: cv, VectAfter: *switchedVect, K: pubKey, SB: commitSecret}
publishedProof := libunlynxproofs.PublishedDeterministicTaggingProof{Dhp: p1, VectBefore: *cv, VectAfter: *switchedVect, K: pubKey, SB: commitSecret}
_ = publishedProof
}

cv = *switchedVect
*cv = *switchedVect
}

// CipherVectorToDeterministicTag creates a tag (grouping key) from a cipher vector
func CipherVectorToDeterministicTag(cipherVect libunlynx.CipherVector, privKey, secContrib kyber.Scalar, pubKey kyber.Point, proofs bool) libunlynx.GroupingKey {
TaggingDet(cipherVect, privKey, secContrib, pubKey, proofs)
TaggingDet(&cipherVect, privKey, secContrib, pubKey, proofs)
deterministicGroupAttributes := make(libunlynx.DeterministCipherVector, len(cipherVect))
for j, c := range cipherVect {
deterministicGroupAttributes[j] = libunlynx.DeterministCipherText{Point: c.C}
Expand Down
2 changes: 1 addition & 1 deletion simul/local_aggregation_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (sim *LocalAggregationSimulation) Run(config *onet.SimulationConfig) error
groupCipherVect = *tmp
cr := libunlynx.FilteredResponse{GroupByEnc: testCipherVect1, AggregatingAttributes: testCipherVect1}
det1 := groupCipherVect
protocolsunlynx.TaggingDet(det1, secKey, newSecKey, pubKey, sim.Proofs)
protocolsunlynx.TaggingDet(&det1, secKey, newSecKey, pubKey, sim.Proofs)

deterministicGroupAttributes := make(libunlynx.DeterministCipherVector, len(det1))
for j, c := range det1 {
Expand Down
2 changes: 1 addition & 1 deletion simul/proofs_verification_simul.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (sim *ProofsVerificationSimulation) Run(config *onet.SimulationConfig) erro

cipherVectGr = *tmp
det1 := cipherVectGr
protocolsunlynx.TaggingDet(det1, secKey, secKey, pubKey, false)
protocolsunlynx.TaggingDet(&det1, secKey, secKey, pubKey, false)
deterministicGroupAttributes := make(libunlynx.DeterministCipherVector, len(det1))

for j, c := range det1 {
Expand Down

0 comments on commit 2d111f2

Please sign in to comment.