Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

group.ml 2.34 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
(*  Copyright © 2012-2014 Inria                                           *)
(*                                                                        *)
(*  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/>.                                       *)
(**************************************************************************)

22
open Platform
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
open Serializable_j
open Signatures

(** Generic group parsing *)

(* For now, only finite fields are supported... *)

let of_string x =
  let group = ff_params_of_string x in
  let module G = (val Group_field.make group : Group_field.GROUP) in
  (module G : GROUP)

let read state buf =
  let group = read_ff_params state buf in
  let module G = (val Group_field.make group : Group_field.GROUP) in
  (module G : GROUP)

let election_params_of_string x =
41 42
  let params = params_of_string (read_wrapped_pubkey read_ff_params read_number) x in
  let {wpk_group=group; wpk_y=y} = params.e_public_key in
43 44
  let module X = struct
    module G = (val Group_field.make group : Group_field.GROUP)
Stephane Glondu's avatar
Stephane Glondu committed
45 46 47 48
    let election = {
      e_params = {params with e_public_key = y};
      e_fingerprint = sha256_b64 x;
    }
49
  end in
Stephane Glondu's avatar
Stephane Glondu committed
50
  (module X : ELECTION_DATA)