Commit d58d43e8 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Verbosity--

parent 30d04833
...@@ -123,7 +123,7 @@ type partial_decryption = { ...@@ -123,7 +123,7 @@ type partial_decryption = {
(** {1 Compound datastructures} *) (** {1 Compound datastructures} *)
type election_public_data = { type election_public_data = {
trustee_public_keys : trustee_public_key list <ocaml repr="array">; public_keys : trustee_public_key list <ocaml repr="array">;
votes : vote list <ocaml repr="array">; votes : vote list <ocaml repr="array">;
encrypted_tally : encrypted_tally; encrypted_tally : encrypted_tally;
partial_decryptions : partial_decryption list <ocaml repr="array">; partial_decryptions : partial_decryption list <ocaml repr="array">;
...@@ -131,5 +131,5 @@ type election_public_data = { ...@@ -131,5 +131,5 @@ type election_public_data = {
} }
type election_private_data = { type election_private_data = {
trustee_private_keys : private_key list <ocaml repr="array">; private_keys : private_key list <ocaml repr="array">;
} }
{"trustee_private_keys": [{"public_key": {"g": "14887492224963187634282421537186040801304008017743492304481737382571933937568724473847106029915040150784031882206090286938661464458896494215273989547889201144857352611058572236578734319505128042602372864570426550855201448111746579871811249114781674309062693442442368697449970648232621880001709535143047913661432883287150003429802392229361583608686643243349727791976247247948618930423866180410558458272606627111270040091203073580238905303994472202930783207472394578498507764703191288249547659899997131166130259700604433891232298182348403175947450284433411265966789131024573629546048637848902243503970966798589660808533", "p": "16328632084933010002384055033805457329601614771185955389739167309086214800406465799038583634953752941675645562182498120750264980492381375579367675648771293800310370964745767014243638518442553823973482995267304044326777047662957480269391322789378384619428596446446984694306187644767462460965622580087564339212631775817895958409016676398975671266179637898557687317076177218843233150695157881061257053019133078545928983562221396313169622475509818442661047018436264806901023966236718367204710755935899013750306107738002364137917426595737403871114187750804346564731250609196846638183903982387884578266136503697493474682071", "q": "61329566248342901292543872769978950870633559608669337131139375508370458778917", "y": "13413536485360596162117509074825082492146422492336993983220767543096612667335041152907231513824044913738906152541149857849737067859185342543622448311556712416080079971431641185273833852441264325481867696726488289145101401983297121479711309538219588042218732878057915656901430381090815194156076478057863101546026469415161926364987580263384129731992815360337654952915225618017615855899362635782363403142334181880226311848845722133441630063825175283518292350982441101548617569316612942610433088353640302787748937007618067190197809928467303825082570918742798139091993351332364996141428976368902435802194163628302762629032"}, "x": "45298523167338358817538343074024028933886309805828157085973885299032584889325"}]} {"private_keys": [{"public_key": {"g": "14887492224963187634282421537186040801304008017743492304481737382571933937568724473847106029915040150784031882206090286938661464458896494215273989547889201144857352611058572236578734319505128042602372864570426550855201448111746579871811249114781674309062693442442368697449970648232621880001709535143047913661432883287150003429802392229361583608686643243349727791976247247948618930423866180410558458272606627111270040091203073580238905303994472202930783207472394578498507764703191288249547659899997131166130259700604433891232298182348403175947450284433411265966789131024573629546048637848902243503970966798589660808533", "p": "16328632084933010002384055033805457329601614771185955389739167309086214800406465799038583634953752941675645562182498120750264980492381375579367675648771293800310370964745767014243638518442553823973482995267304044326777047662957480269391322789378384619428596446446984694306187644767462460965622580087564339212631775817895958409016676398975671266179637898557687317076177218843233150695157881061257053019133078545928983562221396313169622475509818442661047018436264806901023966236718367204710755935899013750306107738002364137917426595737403871114187750804346564731250609196846638183903982387884578266136503697493474682071", "q": "61329566248342901292543872769978950870633559608669337131139375508370458778917", "y": "13413536485360596162117509074825082492146422492336993983220767543096612667335041152907231513824044913738906152541149857849737067859185342543622448311556712416080079971431641185273833852441264325481867696726488289145101401983297121479711309538219588042218732878057915656901430381090815194156076478057863101546026469415161926364987580263384129731992815360337654952915225618017615855899362635782363403142334181880226311848845722133441630063825175283518292350982441101548617569316612942610433088353640302787748937007618067190197809928467303825082570918742798139091993351332364996141428976368902435802194163628302762629032"}, "x": "45298523167338358817538343074024028933886309805828157085973885299032584889325"}]}
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
...@@ -126,7 +126,7 @@ let verify_public_key {g; p; q; y} = ...@@ -126,7 +126,7 @@ let verify_public_key {g; p; q; y} =
check_subgroup p q g && check_subgroup p q g &&
check_subgroup p q y check_subgroup p q y
let verify_trustee_pok pk = let verify_pok pk =
let {g; p; q; y} = pk.trustee_public_key in let {g; p; q; y} = pk.trustee_public_key in
let {pok_commitment; pok_challenge; pok_response} = pk.trustee_pok in let {pok_commitment; pok_challenge; pok_response} = pk.trustee_pok in
let ( ** ) a b = Z.powm a b p in let ( ** ) a b = Z.powm a b p in
...@@ -235,7 +235,7 @@ let verify_partial_decryption e tpk pds = ...@@ -235,7 +235,7 @@ let verify_partial_decryption e tpk pds =
let verify_partial_decryptions e = let verify_partial_decryptions e =
array_forall2 (verify_partial_decryption e) array_forall2 (verify_partial_decryption e)
e.public_data.trustee_public_keys e.public_data.public_keys
e.public_data.partial_decryptions e.public_data.partial_decryptions
let verify_election_public_key pk tpks = let verify_election_public_key pk tpks =
...@@ -247,7 +247,7 @@ let verify_election_public_key pk tpks = ...@@ -247,7 +247,7 @@ let verify_election_public_key pk tpks =
let tpk = tpks.(i) in let tpk = tpks.(i) in
let {g = g'; p = p'; q = q'; y = y'} = tpk.trustee_public_key in let {g = g'; p = p'; q = q'; y = y'} = tpk.trustee_public_key in
g =~ g' && p =~ p' && q =~ q' && g =~ g' && p =~ p' && q =~ q' &&
verify_trustee_pok tpk && verify_pok tpk &&
loop (pred i) Z.(accu * y' mod p) loop (pred i) Z.(accu * y' mod p)
else accu =~ y else accu =~ y
in loop (pred n) Z.one in loop (pred n) Z.one
...@@ -278,12 +278,14 @@ let verbose_assert msg it = ...@@ -278,12 +278,14 @@ let verbose_assert msg it =
let load_election_and_verify_it_all dirname = let load_election_and_verify_it_all dirname =
let e = load_election_test_data ~verbose:true dirname in let e = load_election_test_data ~verbose:true dirname in
verbose_assert "election public key" verbose_assert "public key"
(lazy (verify_election_public_key (lazy (verify_election_public_key
e.election.e_public_key e.election.e_public_key
e.public_data.trustee_public_keys)); e.public_data.public_keys));
Array.iter (fun x -> verbose_assert "vote" verbose_assert "votes"
(lazy (verify_vote e.election e.fingerprint x))) e.public_data.votes; (lazy (array_foralli
(fun _ x -> verify_vote e.election e.fingerprint x)
e.public_data.votes));
verbose_assert "encrypted tally" verbose_assert "encrypted tally"
(lazy (e.public_data.encrypted_tally = (lazy (e.public_data.encrypted_tally =
compute_encrypted_tally e.election e.public_data.votes)); compute_encrypted_tally e.election e.public_data.votes));
...@@ -294,6 +296,6 @@ let load_election_and_verify_it_all dirname = ...@@ -294,6 +296,6 @@ let load_election_and_verify_it_all dirname =
verbose_assert "private keys" verbose_assert "private keys"
(lazy (array_foralli (lazy (array_foralli
(fun _ k -> verify_private_key k) (fun _ k -> verify_private_key k)
e.private_data.trustee_private_keys));; e.private_data.private_keys));;
let () = load_election_and_verify_it_all "tests/data/favorite-editor" let () = load_election_and_verify_it_all "tests/data/favorite-editor"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment