election.mli 2.37 KB
Newer Older
Stephane Glondu's avatar
Stephane Glondu committed
1 2 3
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
Stephane Glondu's avatar
Stephane Glondu committed
4
(*  Copyright © 2012-2016 Inria                                           *)
Stephane Glondu's avatar
Stephane Glondu committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  This program is distributed in the hope that it will be useful, but   *)
(*  WITHOUT ANY WARRANTY; without even the implied warranty of            *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

Stephane Glondu's avatar
Doc  
Stephane Glondu committed
22
(** Election primitives *)
Stephane Glondu's avatar
Stephane Glondu committed
23

24
open Platform
25
open Serializable_t
26
open Signatures
Stephane Glondu's avatar
Stephane Glondu committed
27

28 29
val question_length : question -> int

30 31 32 33
module MakeSimpleMonad (G : GROUP) : sig

  (** {2 Monadic definitions} *)

34
  include Signatures.MONAD with type 'a t = unit -> 'a
35 36 37 38 39

  (** {2 Random number generation} *)

  val random : Z.t -> Z.t t
  (** [random q] returns a random number modulo [q]. It uses a secure
40 41
      random number generator lazily initialized by a 128-bit seed
      shared by all instances. *)
42 43 44

  (** {2 Ballot box management} *)

45
  include Signatures.MONADIC_MAP_RO
46
  with type 'a m := 'a t
47
  and type elt = G.t ballot
48
  and type key := unit
49

50
  val cast : elt -> unit t
51 52 53
end
(** Simple election monad that keeps all ballots in memory. *)

Stephane Glondu's avatar
Stephane Glondu committed
54 55
module MakeElection (G : GROUP) (M : RANDOM) :
  ELECTION with type elt = G.t and type 'a m = 'a M.t
56
(** Implementation of {!Signatures.ELECTION}. *)