Skip to content

Commit

Permalink
added signature verification test
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteSwerve committed Nov 1, 2022
1 parent 8d9ffcb commit bd51c05
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions deku-p/src/core/crypto/tests/alg_intf_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ struct
(fun sk ->
List.map (fun hash -> (Signature.sign sk hash, hash)) to_sign)
secret_keys

let verified_normal_signatures =
let check_sig pk signatures =
List.map
(fun (signature, hash) -> Signature.verify pk signature hash)
signatures
in
List.map2
(fun key signatures -> check_sig key signatures)
public_keys signatures
end

module Test_secret_key_data = struct
Expand Down Expand Up @@ -145,5 +155,11 @@ struct
Alcotest.(check' string)
~msg:"signatures are equal" ~expected:Tezos_data.signatures
~actual:signatures

let verified_normal_signatures () =
Alcotest.(check' (list (list bool)))
~msg:"verified normal signatures are equal"
~expected:Tezos_data.verified_normal_signatures
~actual:Signature_data.verified_normal_signatures
end
end
2 changes: 2 additions & 0 deletions deku-p/src/core/crypto/tests/test_ed25519.ml
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@ let run () =
[
test_case "to sign" `Quick Test_signature_data.to_sign;
test_case "signatures" `Quick Test_signature_data.signatures;
test_case "verified normal signatures" `Quick
Test_signature_data.verified_normal_signatures;
] );
]

0 comments on commit bd51c05

Please sign in to comment.