SPAKE2/SPAKE2+ password-authenticated key exchange for OCaml
0
fork

Configure Feed

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

fix(lint): resolve doc style, test conventions, and fmt issues across sle, space-packet, spake2, sqlite

+37 -36
+2 -2
lib/spake2.mli
··· 139 139 140 140 @param password The shared password 141 141 @param role Either [`A] or [`B] 142 - @return [(state, message)] where [message] is the public share to send *) 142 + @return [(state, message)] where [message] is the public share to send. *) 143 143 144 144 val finish : 145 145 ?context:string -> ··· 155 155 @param id_b Optional identity of party B 156 156 @param state The state from {!init} 157 157 @param peer_message The message received from the peer 158 - @return [Ok shared_secret] (32 bytes) or [Error msg] *) 158 + @return [Ok shared_secret] (32 bytes) or [Error msg]. *) 159 159 160 160 (** {1 SPAKE2+ (Augmented PAKE)} *) 161 161
+1 -1
test/test.ml
··· 1 1 let () = 2 2 Crypto_rng_unix.use_default (); 3 - Alcotest.run "spake2" Test_spake2.suite 3 + Alcotest.run "spake2" [ Test_spake2.suite ]
+33 -32
test/test_spake2.ml
··· 212 212 Alcotest.(check string) "PBKDF2-SHA256 c=1" expected (Ohex.encode result) 213 213 214 214 let suite = 215 - [ 216 - ( "P256", 215 + ( "spake2", 216 + List.concat 217 217 [ 218 - Alcotest.test_case "encoding roundtrip" `Quick 219 - test_p256_encoding_roundtrip; 220 - Alcotest.test_case "negate" `Quick test_p256_negate; 221 - Alcotest.test_case "M encoding" `Quick test_p256_m_encoding; 222 - Alcotest.test_case "N encoding" `Quick test_p256_n_encoding; 223 - Alcotest.test_case "M matches RFC 9382" `Quick test_p256_m_rfc9382; 224 - Alcotest.test_case "N matches RFC 9382" `Quick test_p256_n_rfc9382; 225 - ] ); 226 - ( "SPAKE2", 227 - [ 228 - Alcotest.test_case "basic exchange" `Quick test_spake2_basic; 229 - Alcotest.test_case "with context" `Quick test_spake2_with_context; 230 - Alcotest.test_case "wrong password" `Quick test_spake2_wrong_password; 231 - Alcotest.test_case "different context" `Quick 232 - test_spake2_different_context; 233 - ] ); 234 - ( "SPAKE2+", 235 - [ 236 - Alcotest.test_case "basic exchange" `Quick test_spake2_plus_basic; 237 - Alcotest.test_case "wrong password" `Quick 238 - test_spake2_plus_wrong_password; 239 - ] ); 240 - ( "Crypto", 241 - [ 242 - Alcotest.test_case "SHA256" `Quick test_sha256; 243 - Alcotest.test_case "HMAC-SHA256" `Quick test_hmac_sha256; 244 - Alcotest.test_case "HKDF" `Quick test_hkdf; 245 - Alcotest.test_case "PBKDF2" `Quick test_pbkdf2; 246 - ] ); 247 - ] 218 + [ 219 + Alcotest.test_case "P256 encoding roundtrip" `Quick 220 + test_p256_encoding_roundtrip; 221 + Alcotest.test_case "P256 negate" `Quick test_p256_negate; 222 + Alcotest.test_case "P256 M encoding" `Quick test_p256_m_encoding; 223 + Alcotest.test_case "P256 N encoding" `Quick test_p256_n_encoding; 224 + Alcotest.test_case "P256 M matches RFC 9382" `Quick 225 + test_p256_m_rfc9382; 226 + Alcotest.test_case "P256 N matches RFC 9382" `Quick 227 + test_p256_n_rfc9382; 228 + ]; 229 + [ 230 + Alcotest.test_case "basic exchange" `Quick test_spake2_basic; 231 + Alcotest.test_case "with context" `Quick test_spake2_with_context; 232 + Alcotest.test_case "wrong password" `Quick test_spake2_wrong_password; 233 + Alcotest.test_case "different context" `Quick 234 + test_spake2_different_context; 235 + ]; 236 + [ 237 + Alcotest.test_case "SPAKE2+ basic exchange" `Quick 238 + test_spake2_plus_basic; 239 + Alcotest.test_case "SPAKE2+ wrong password" `Quick 240 + test_spake2_plus_wrong_password; 241 + ]; 242 + [ 243 + Alcotest.test_case "SHA256" `Quick test_sha256; 244 + Alcotest.test_case "HMAC-SHA256" `Quick test_hmac_sha256; 245 + Alcotest.test_case "HKDF" `Quick test_hkdf; 246 + Alcotest.test_case "PBKDF2" `Quick test_pbkdf2; 247 + ]; 248 + ] )
+1 -1
test/test_spake2.mli
··· 1 1 (** Unit tests for SPAKE2 password-authenticated key exchange. *) 2 2 3 - val suite : (string * unit Alcotest.test_case list) list 3 + val suite : string * unit Alcotest.test_case list