Skip to content

Commit b16013e

Browse files
added signature verification test
1 parent ec9f1cb commit b16013e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

deku-p/src/core/crypto/tests/alg_intf_tests.ml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ struct
5151
(fun sk ->
5252
List.map (fun hash -> (Signature.sign sk hash, hash)) to_sign)
5353
secret_keys
54+
55+
let verified_normal_signatures =
56+
let check_sig pk signatures =
57+
List.map
58+
(fun (signature, hash) -> Signature.verify pk signature hash)
59+
signatures
60+
in
61+
List.map2
62+
(fun key signatures -> check_sig key signatures)
63+
public_keys signatures
5464
end
5565

5666
module Test_secret_key_data = struct
@@ -145,5 +155,11 @@ struct
145155
Alcotest.(check' string)
146156
~msg:"signatures are equal" ~expected:Tezos_data.signatures
147157
~actual:signatures
158+
159+
let verified_normal_signatures () =
160+
Alcotest.(check' (list (list bool)))
161+
~msg:"verified normal signatures are equal"
162+
~expected:Tezos_data.verified_normal_signatures
163+
~actual:Signature_data.verified_normal_signatures
148164
end
149165
end

deku-p/src/core/crypto/tests/test_ed25519.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,7 @@ let run () =
102102
[
103103
test_case "to sign" `Quick Test_signature_data.to_sign;
104104
test_case "signatures" `Quick Test_signature_data.signatures;
105+
test_case "verified normal signatures" `Quick
106+
Test_signature_data.verified_normal_signatures;
105107
] );
106108
]

0 commit comments

Comments
 (0)