Matter smart home protocol implementation for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: apply linter auto-fixes across hostname, initramfs, json-logs, jsonwt, linkedin, matter, mbr

+72 -69
+4
bin/matter_cli.ml
··· 7 7 8 8 open Cmdliner 9 9 10 + let src = Logs.Src.create "matter.cli" ~doc:"Matter CLI" 11 + 12 + module Log = (val Logs.src_log src : Logs.LOG) 13 + 10 14 (* Exit code for errors *) 11 15 let exit_error = 1 12 16
+4 -4
lib/pase.mli
··· 34 34 @param salt The salt from PBKDF params response 35 35 @param iterations The iteration count from PBKDF params response 36 36 @param context The PASE context from {!make_context} 37 - @return [(state, pA)] where pA is sent to the device *) 37 + @return [(state, pA)] where [pA] is sent to the device. *) 38 38 39 39 val prover_finish : 40 40 Spake2.Plus.prover_state -> ··· 42 42 (string * string * string, string) result 43 43 (** [prover_finish state pB] processes the device's pB message. 44 44 45 - @return [Ok (shared_key, confirmation_a, expected_confirmation_b)] or error 45 + @return [Ok (shared_key, confirmation_a, expected_confirmation_b)] or error. 46 46 *) 47 47 48 48 (** {1:verifier Verifier (Device) Operations} *) ··· 53 53 54 54 @param w0 The stored w0 value 55 55 @param l The stored L = w1*G value 56 - @return [(state, pB)] where pB is sent to the commissioner *) 56 + @return [(state, pB)] where [pB] is sent to the commissioner. *) 57 57 58 58 val verifier_finish : 59 59 Spake2.Plus.verifier_state -> ··· 61 61 (string * string * string, string) result 62 62 (** [verifier_finish state pA] processes the commissioner's pA message. 63 63 64 - @return [Ok (shared_key, confirmation_b, expected_confirmation_a)] or error 64 + @return [Ok (shared_key, confirmation_b, expected_confirmation_a)] or error. 65 65 *) 66 66 67 67 (** {1:setup Device Setup} *)
+9 -2
test/test.ml
··· 2 2 3 3 let () = 4 4 Alcotest.run "matter" 5 - (Test_tlv.suite @ Test_case.suite @ Test_session.suite @ Test_pase.suite 6 - @ Test_discovery.suite @ Test_msg.suite @ Test_aes_ccm.suite) 5 + [ 6 + Test_tlv.suite; 7 + Test_case.suite; 8 + Test_session.suite; 9 + Test_pase.suite; 10 + Test_discovery.suite; 11 + Test_msg.suite; 12 + Test_aes_ccm.suite; 13 + ]
+1 -1
test/test_aes_ccm.ml
··· 1 1 let test_accessible () = ignore (Fun.id 42) 2 2 3 3 let suite = 4 - [ ("aes_ccm", [ Alcotest.test_case "accessible" `Quick test_accessible ]) ] 4 + ("aes_ccm", [ Alcotest.test_case "accessible" `Quick test_accessible ])
+1 -1
test/test_aes_ccm.mli
··· 1 1 (** Aes_ccm tests. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list
+8 -6
test/test_case.ml
··· 273 273 let protocol_tests = [ ("full exchange", `Quick, test_case_full_exchange) ] 274 274 275 275 let suite = 276 - [ 277 - ("destination_id", destination_id_tests); 278 - ("session_keys", session_keys_tests); 279 - ("sigma_encoding", sigma_encoding_tests); 280 - ("protocol", protocol_tests); 281 - ] 276 + ( "case", 277 + List.concat_map snd 278 + [ 279 + ("destination_id", destination_id_tests); 280 + ("session_keys", session_keys_tests); 281 + ("sigma_encoding", sigma_encoding_tests); 282 + ("protocol", protocol_tests); 283 + ] )
+3
test/test_case.mli
··· 1 + (** Case tests. *) 2 + 3 + val suite : string * unit Alcotest.test_case list
+1 -1
test/test_discovery.ml
··· 1 1 let test_accessible () = ignore (Fun.id 42) 2 2 3 3 let suite = 4 - [ ("discovery", [ Alcotest.test_case "accessible" `Quick test_accessible ]) ] 4 + ("discovery", [ Alcotest.test_case "accessible" `Quick test_accessible ])
+1 -1
test/test_discovery.mli
··· 1 1 (** Discovery tests. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list
+1 -3
test/test_msg.ml
··· 1 1 let test_accessible () = ignore (Fun.id 42) 2 - 3 - let suite = 4 - [ ("msg", [ Alcotest.test_case "accessible" `Quick test_accessible ]) ] 2 + let suite = ("msg", [ Alcotest.test_case "accessible" `Quick test_accessible ])
+1 -1
test/test_msg.mli
··· 1 1 (** Msg tests. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list
+1 -3
test/test_pase.ml
··· 1 1 let test_accessible () = ignore (Fun.id 42) 2 - 3 - let suite = 4 - [ ("pase", [ Alcotest.test_case "accessible" `Quick test_accessible ]) ] 2 + let suite = ("pase", [ Alcotest.test_case "accessible" `Quick test_accessible ])
+1 -1
test/test_pase.mli
··· 1 1 (** Pase tests. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list
+1 -1
test/test_session.ml
··· 1 1 let test_accessible () = ignore (Fun.id 42) 2 2 3 3 let suite = 4 - [ ("session", [ Alcotest.test_case "accessible" `Quick test_accessible ]) ] 4 + ("session", [ Alcotest.test_case "accessible" `Quick test_accessible ])
+1 -1
test/test_session.mli
··· 1 1 (** Session tests. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list
+31 -43
test/test_tlv.ml
··· 213 213 | Error e -> Alcotest.fail e 214 214 215 215 let suite = 216 - [ 217 - ( "encoding", 218 - [ 219 - Alcotest.test_case "signed int 1-byte" `Quick 220 - test_encode_signed_int_1byte; 221 - Alcotest.test_case "signed int negative" `Quick 222 - test_encode_signed_int_negative; 223 - Alcotest.test_case "unsigned int 1-byte" `Quick 224 - test_encode_unsigned_int_1byte; 225 - Alcotest.test_case "unsigned int 2-byte" `Quick 226 - test_encode_unsigned_int_2byte; 227 - Alcotest.test_case "bool false" `Quick test_encode_bool_false; 228 - Alcotest.test_case "bool true" `Quick test_encode_bool_true; 229 - Alcotest.test_case "null" `Quick test_encode_null; 230 - Alcotest.test_case "string" `Quick test_encode_string; 231 - Alcotest.test_case "bytes" `Quick test_encode_bytes; 232 - Alcotest.test_case "context tag" `Quick test_encode_context_tag; 233 - Alcotest.test_case "structure" `Quick test_encode_structure; 234 - Alcotest.test_case "array" `Quick test_encode_array; 235 - ] ); 236 - ( "decoding", 237 - [ 238 - Alcotest.test_case "signed int" `Quick test_decode_signed_int; 239 - Alcotest.test_case "unsigned int" `Quick test_decode_unsigned_int; 240 - Alcotest.test_case "bool" `Quick test_decode_bool; 241 - Alcotest.test_case "string" `Quick test_decode_string; 242 - Alcotest.test_case "structure" `Quick test_decode_structure; 243 - Alcotest.test_case "truncated data" `Quick test_decode_truncated; 244 - Alcotest.test_case "invalid type" `Quick test_decode_invalid_type; 245 - ] ); 246 - ( "roundtrip", 247 - [ 248 - Alcotest.test_case "integers" `Quick test_roundtrip_int; 249 - Alcotest.test_case "unsigned integers" `Quick test_roundtrip_uint; 250 - Alcotest.test_case "strings" `Quick test_roundtrip_string; 251 - Alcotest.test_case "nested structures" `Quick test_roundtrip_nested; 252 - ] ); 253 - ( "floats", 254 - [ 255 - Alcotest.test_case "float32" `Quick test_float32; 256 - Alcotest.test_case "float64" `Quick test_float64; 257 - ] ); 258 - ] 216 + ( "tlv", 217 + [ 218 + Alcotest.test_case "signed int 1-byte" `Quick test_encode_signed_int_1byte; 219 + Alcotest.test_case "signed int negative" `Quick 220 + test_encode_signed_int_negative; 221 + Alcotest.test_case "unsigned int 1-byte" `Quick 222 + test_encode_unsigned_int_1byte; 223 + Alcotest.test_case "unsigned int 2-byte" `Quick 224 + test_encode_unsigned_int_2byte; 225 + Alcotest.test_case "bool false" `Quick test_encode_bool_false; 226 + Alcotest.test_case "bool true" `Quick test_encode_bool_true; 227 + Alcotest.test_case "null" `Quick test_encode_null; 228 + Alcotest.test_case "string" `Quick test_encode_string; 229 + Alcotest.test_case "bytes" `Quick test_encode_bytes; 230 + Alcotest.test_case "context tag" `Quick test_encode_context_tag; 231 + Alcotest.test_case "structure" `Quick test_encode_structure; 232 + Alcotest.test_case "array" `Quick test_encode_array; 233 + Alcotest.test_case "signed int" `Quick test_decode_signed_int; 234 + Alcotest.test_case "unsigned int" `Quick test_decode_unsigned_int; 235 + Alcotest.test_case "bool" `Quick test_decode_bool; 236 + Alcotest.test_case "string decode" `Quick test_decode_string; 237 + Alcotest.test_case "structure decode" `Quick test_decode_structure; 238 + Alcotest.test_case "truncated data" `Quick test_decode_truncated; 239 + Alcotest.test_case "invalid type" `Quick test_decode_invalid_type; 240 + Alcotest.test_case "integers" `Quick test_roundtrip_int; 241 + Alcotest.test_case "unsigned integers" `Quick test_roundtrip_uint; 242 + Alcotest.test_case "strings" `Quick test_roundtrip_string; 243 + Alcotest.test_case "nested structures" `Quick test_roundtrip_nested; 244 + Alcotest.test_case "float32" `Quick test_float32; 245 + Alcotest.test_case "float64" `Quick test_float64; 246 + ] )
+3
test/test_tlv.mli
··· 1 + (** Tlv tests. *) 2 + 3 + val suite : string * unit Alcotest.test_case list