Commit e8c55296 authored by Stephane Glondu's avatar Stephane Glondu

Rename helios_datatypes into serializable_compat

parent 5a9eaf5e
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
open Eliom_content.Html5.F
(* FIXME: these pages should be redesigned *)
......
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
type election_data = {
raw : string;
......@@ -29,13 +29,13 @@ let load_elections_and_votes dirname =
Lwt_io.lines_of_file |>
enforce_single_element
in
let election = Helios_datatypes_j.election_of_string
let election = Serializable_compat_j.election_of_string
Core_datatypes_j.read_number raw
in
(assert_lwt (Uuidm.equal uuid election.e_uuid)) >>
let public_data =
data "public.json" |>
load_from_file (Helios_datatypes_j.read_election_public_data Core_datatypes_j.read_number)
load_from_file (Serializable_compat_j.read_election_public_data Core_datatypes_j.read_number)
in
let fingerprint = hashB raw in
let ballots =
......@@ -43,7 +43,7 @@ let load_elections_and_votes dirname =
if Sys.file_exists file then (
Lwt_io.lines_of_file file |>
Lwt_stream.map (fun x ->
let v = Helios_datatypes_j.ballot_of_string Core_datatypes_j.read_number x in
let v = Serializable_compat_j.ballot_of_string Core_datatypes_j.read_number x in
assert (Uuidm.equal uuid v.election_uuid);
v
)
......@@ -54,7 +54,7 @@ let load_elections_and_votes dirname =
if Sys.file_exists file then (
Lwt_io.lines_of_file file |>
Lwt_stream.map (fun x ->
let v = Helios_datatypes_j.signature_of_string x in
let v = Serializable_compat_j.signature_of_string x in
v
)
) else Lwt_stream.from_direct (fun () -> None)
......@@ -96,5 +96,5 @@ let hash_ballot v =
hashB
let hash_user v =
Helios_datatypes_j.string_of_user v |>
Serializable_compat_j.string_of_user v |>
hashB
open Helios_datatypes_t
open Serializable_compat_t
type election_data = {
raw : string;
......
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
module type GROUP = sig
type t
......
(** ElGamal cryptographic operations *)
open Helios_datatypes_t
open Serializable_compat_t
module type GROUP = sig
type t
......
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
open Lwt
(* The following should be in configuration file... but
......@@ -117,7 +117,7 @@ let () = Eliom_registration.String.register
(if_eligible
(fun uuid election user () ->
return (
Helios_datatypes_j.string_of_election_public_data
Serializable_compat_j.string_of_election_public_data
Core_datatypes_j.write_number
election.Common.public_data,
"application/json"
......@@ -132,7 +132,7 @@ let () = Eliom_registration.String.register
let uuid_underscored = String.map (function '-' -> '_' | c -> c) (Uuidm.to_string uuid) in
let table = Ocsipersist.open_table ("ballots_" ^ uuid_underscored) in
lwt ballots = Ocsipersist.fold_step (fun hash v res ->
let s = Helios_datatypes_j.string_of_ballot Core_datatypes_j.write_number v ^ "\n" in
let s = Serializable_compat_j.string_of_ballot Core_datatypes_j.write_number v ^ "\n" in
return (s :: res)
) table [] in
let result = String.concat "" ballots in
......@@ -146,7 +146,7 @@ let () = Eliom_registration.String.register
(* FIXME: DoS/entropy exhaustion vulnerability *)
Lwt_preemptive.detach (fun () -> Cryptokit.Random.(string secure_rng 32)) () >>=
wrap1 Cryptokit.(transform_string (Base64.encode_compact ())) >>=
(fun x -> return (Helios_datatypes_j.string_of_randomness { randomness=x })) >>=
(fun x -> return (Serializable_compat_j.string_of_randomness { randomness=x })) >>=
(fun x -> return (x, "application/json"))
)
......@@ -182,7 +182,7 @@ let () = Eliom_registration.Html5.register
(fun uuid election user raw_ballot ->
let result =
try
let ballot = Helios_datatypes_j.ballot_of_string Core_datatypes_j.read_number raw_ballot in
let ballot = Serializable_compat_j.ballot_of_string Core_datatypes_j.read_number raw_ballot in
let {g; p; q; y} = election.Common.election.e_public_key in
let module G = (val ElGamal.make_ff_msubgroup p q g : ElGamal.GROUP with type t = Z.t) in
let module Crypto = ElGamal.Make (G) in
......
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
open Eliom_service
open Eliom_parameter
......
StdExtra
Core_datatypes_j
Helios_datatypes_t
Helios_datatypes_j
Serializable_compat_t
Serializable_compat_j
Common
Crypto
ElGamal
StdExtra
Core_datatypes_j
Helios_datatypes_j
Serializable_compat_j
ElGamal
Common
Helios_services
......
open StdExtra
open Helios_datatypes_t
open Serializable_compat_t
open Common
module type TYPES = sig
......@@ -30,7 +30,7 @@ module SFiniteFieldMult : SGROUP with type t = Z.t = struct
end
module MakeTypes (G : SGROUP) : TYPES with type elt = G.t = struct
open Helios_datatypes_j
open Serializable_compat_j
type elt = G.t
type 'a t = (Yojson.Safe.lexer_state -> Lexing.lexbuf -> 'a) * (Bi_outbuf.t -> 'a -> unit)
let read = fst
......
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