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

Renamings

parent 99493221
......@@ -49,18 +49,19 @@ let finite_field ~p ~q ~g =
(** Homomorphic elections *)
module MakeHomomorphicElection (P : Crypto_sigs.ELECTION_PARAMS) = struct
module MakeElection (P : Crypto_sigs.ELECTION_PARAMS) = struct
open Serializable_t
open P
open G
type elt = G.t
type private_key = Z.t
type public_key = G.t
type public_key = elt
let election_params = params
let y = params.e_public_key
let ( / ) x y = x *~ invert y
type ciphertext = public_key Serializable_t.ciphertext array array
type ciphertext = elt Serializable_t.ciphertext array array
let dummy_ciphertext =
{
......@@ -78,7 +79,7 @@ module MakeHomomorphicElection (P : Crypto_sigs.ELECTION_PARAMS) = struct
let combine_ciphertexts = Array.mmap2 eg_combine
type plaintext = int array array
type ballot = public_key Serializable_t.ballot
type ballot = elt Serializable_t.ballot
type randomness = Z.t array array
(** ElGamal encryption. *)
......@@ -205,7 +206,7 @@ module MakeHomomorphicElection (P : Crypto_sigs.ELECTION_PARAMS) = struct
let extract_ciphertext b = Array.map (fun x -> x.choices) b.answers
type factor = public_key Serializable_t.partial_decryption
type factor = elt Serializable_t.partial_decryption
let eg_factor x {alpha; beta} =
alpha **~ x,
......@@ -235,7 +236,7 @@ module MakeHomomorphicElection (P : Crypto_sigs.ELECTION_PARAMS) = struct
in hash commitments =% challenge
) c f.decryption_factors f.decryption_proofs
type result = public_key Serializable_t.result
type result = elt Serializable_t.result
let combine_factors nb_tallied encrypted_tally partial_decryptions =
let dummy = Array.mmap (fun _ -> G.one) encrypted_tally in
......
......@@ -7,5 +7,5 @@ val finite_field : p:Z.t -> q:Z.t -> g:Z.t ->
checks on [p], [q] and [g] and raises [Invalid_argument] in caise
of failure. *)
module MakeHomomorphicElection (P : Crypto_sigs.ELECTION_PARAMS) :
Crypto_sigs.HOMOMORPHIC with type public_key = P.G.t
module MakeElection (P : Crypto_sigs.ELECTION_PARAMS) :
Crypto_sigs.ELECTION with type elt = P.G.t
......@@ -53,7 +53,7 @@ module type ELECTION_PARAMS = sig
end
(** Cryptographic primives for an election with homomorphic tally. *)
module type HOMOMORPHIC = sig
module type ELECTION = sig
(** {2 Election parameters} *)
......@@ -62,14 +62,15 @@ module type HOMOMORPHIC = sig
are integers modulo a large prime number. Public keys are
members of a suitably chosen group. *)
type elt
type private_key = Z.t
type public_key
type public_key = elt
val election_params : public_key Serializable_t.election
val election_params : elt Serializable_t.election
(** {2 Ciphertexts} *)
type ciphertext = public_key Serializable_t.ciphertext array array
type ciphertext = elt Serializable_t.ciphertext array array
(** A ciphertext that can be homomorphically combined. *)
val combine_ciphertexts : ciphertext -> ciphertext -> ciphertext
......@@ -83,7 +84,7 @@ module type HOMOMORPHIC = sig
ballot. When [x] is such a value, [x.(i).(j)] is the weight (0
or 1) given to answer [j] in question [i]. *)
type ballot = public_key Serializable_t.ballot
type ballot = elt Serializable_t.ballot
(** A ballot ready to be transmitted, containing the encrypted
answers and cryptographic proofs that they satisfy the election
constraints. *)
......@@ -109,7 +110,7 @@ module type HOMOMORPHIC = sig
(** {2 Partial decryptions} *)
type factor = public_key Serializable_t.partial_decryption
type factor = elt Serializable_t.partial_decryption
(** A decryption share. It is computed by a trustee from his or her
private key share and the encrypted tally, and contains a
cryptographic proof that he or she didn't cheat. *)
......@@ -123,7 +124,7 @@ module type HOMOMORPHIC = sig
(** {2 Result} *)
type result = public_key Serializable_t.result
type result = elt Serializable_t.result
(** The election result. It contains the needed data to validate the
result from the encrypted tally. *)
......
......@@ -83,7 +83,7 @@ let verbose_verify_election_test_data (e, ballots, signatures, private_data) =
let params = Serializable_compat.of_election e.election
let fingerprint = e.fingerprint
end in
let module Election = Crypto.MakeHomomorphicElection(P) in
let module Election = Crypto.MakeElection(P) in
(*
verbose_assert "election key" (lazy (
Crypto.check_election_key
......@@ -170,7 +170,7 @@ module P = struct
let fingerprint = e.fingerprint
end
module Election = Crypto.MakeHomomorphicElection(P)
module Election = Crypto.MakeElection(P)
module Compat = Serializable_compat.MakeCompat(P)
let nballots = Array.map Serializable_compat.of_ballot ballots;;
......
......@@ -189,7 +189,7 @@ let () = Eliom_registration.Html5.register
let params = Serializable_compat.of_election election.Common.election
let fingerprint = assert false
end in
let module Election = Crypto.MakeHomomorphicElection(P) in
let module Election = Crypto.MakeElection(P) in
if
Uuidm.equal uuid ballot.election_uuid &&
Election.check_ballot (Serializable_compat.of_ballot ballot)
......
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