Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

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

Consistency

parent 5d0e34e4
......@@ -351,7 +351,7 @@ module MakeElection (P : ELECTION_PARAMS) (M : RANDOM) = struct
type result = elt Serializable_t.result
let combine_factors nb_tallied encrypted_tally partial_decryptions =
let combine_factors num_tallied encrypted_tally partial_decryptions =
let dummy = Array.mmap (fun _ -> G.one) encrypted_tally in
let factors = Array.fold_left (fun a b ->
Array.mmap2 ( *~ ) a b.decryption_factors
......@@ -362,7 +362,7 @@ module MakeElection (P : ELECTION_PARAMS) (M : RANDOM) = struct
let log =
let module GMap = Map.Make(G) in
let rec loop i cur accu =
if i <= nb_tallied
if i <= num_tallied
then loop (succ i) (cur *~ g) (GMap.add cur i accu)
else accu
in
......@@ -374,10 +374,10 @@ module MakeElection (P : ELECTION_PARAMS) (M : RANDOM) = struct
invalid_arg "Cannot compute result"
in
let result = Array.mmap log results in
{nb_tallied; encrypted_tally; partial_decryptions; result}
{num_tallied; encrypted_tally; partial_decryptions; result}
let check_result r =
let {encrypted_tally; partial_decryptions; result; nb_tallied} = r in
let {encrypted_tally; partial_decryptions; result; num_tallied} = r in
check_ciphertext encrypted_tally &&
Array.forall2 (check_factor encrypted_tally)
public_keys partial_decryptions &&
......
......@@ -69,7 +69,7 @@ type 'a partial_decryption = {
}
type 'a result = {
nb_tallied : int;
num_tallied : int;
encrypted_tally : 'a ciphertext list <ocaml repr="array"> list <ocaml repr="array">;
partial_decryptions : 'a partial_decryption list <ocaml repr="array">;
result : int list <ocaml repr="array"> list <ocaml repr="array">;
......
......@@ -270,9 +270,10 @@ assert (Serializable_t.(test_factor.decryption_factors) = (List.hd partial_decry
let () =
let partial_decryptions = List.map Serializable_compat.partial_decryption partial_decryptions in
let num_tallied = encrypted_tally.num_tallied in
let open Serializable_t in
let nresult' = E.combine_factors
encrypted_tally.num_tallied encrypted_tally.tally (Array.of_list partial_decryptions)
num_tallied encrypted_tally.tally (Array.of_list partial_decryptions)
in
assert (nresult'.result = result);
assert (E.check_result nresult');
......
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