Commit da4a0a30 authored by Stephane Glondu's avatar Stephane Glondu

Add step[135]_check

parent a8af9c7c
......@@ -245,10 +245,13 @@ module type PEDERSEN = sig
type elt
val step1 : unit -> (string * cert) m
val step1_check : cert -> bool
val step2 : certs -> unit
val step3 : certs -> string -> int -> polynomial m
val step3_check : certs -> int -> polynomial -> bool
val step4 : certs -> polynomial array -> vinput array
val step5 : certs -> string -> vinput -> elt voutput m
val step5_check : certs -> int -> polynomial array -> elt voutput -> bool
val step6 : certs -> polynomial array -> elt voutput array -> elt threshold_parameters
val check : elt threshold_parameters -> bool
......
......@@ -283,6 +283,8 @@ module MakePedersen (G : GROUP) (M : RANDOM)
P.make_cert ~sk ~dk >>= fun cert ->
M.return (seed, cert)
let step1_check cert = P.verify_cert cert
let step2 {certs} =
Array.iteri (fun i cert ->
if P.verify_cert cert then ()
......@@ -339,6 +341,10 @@ module MakePedersen (G : GROUP) (M : RANDOM)
in fill_secrets 0 >>= fun () ->
M.return {p_polynomial; p_secrets; p_coefexps}
let step3_check certs i polynomial =
let certs = Array.map (fun x -> cert_keys_of_string G.read x.s_message) certs.certs in
P.verify certs.(i).cert_verification polynomial.p_coefexps
let step4 certs polynomials =
let n = Array.length certs.certs in
let () = step2 certs in
......@@ -412,6 +418,22 @@ module MakePedersen (G : GROUP) (M : RANDOM)
)
)
let step5_check certs i polynomials voutput =
let n = Array.length certs.certs in
let certs = Array.map (fun x -> cert_keys_of_string G.read x.s_message) certs.certs in
assert (n = Array.length polynomials);
let coefexps =
Array.init n (fun i ->
let x = polynomials.(i).p_coefexps in
if not (P.verify certs.(i).cert_verification x) then
raise (PedersenFailure (Printf.sprintf "coefexps %d does not validate" (i+1)));
(raw_coefexps_of_string G.read x.s_message).coefexps
)
in
let computed_vk = (compute_verification_keys coefexps).(i) in
K.check voutput.vo_public_key &&
voutput.vo_public_key.trustee_public_key =~ computed_vk
let step6 certs polynomials voutputs =
let n = Array.length certs.certs in
let () = step2 certs in
......
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