upstream: https://github.com/mirage/mirage-crypto
0
fork

Configure Feed

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

fix(lint): resolve E610/E615/E618 by extracting helpers into libraries

- ec_wycheproof.ml -> test/ec/ec_wycheproof/ library (fixes E610/E615/E618)
- random_selftests.ml -> tests/random_selftests/ library (fixes E610/E615/E618)
- check_vectors.ml -> test/check_vectors/ executable (fixes E618)
- Add random_selftests.mli (fixes E405)

+45 -6
+25
test/check_vectors/check_vectors.ml
··· 1 + let () = 2 + let vx = Ohex.decode in 3 + Crypto_rng_unix.use_default (); 4 + (* ARC4 192-bit *) 5 + let key = vx "0102030405060708090a0b0c0d0e0f101112131415161718" in 6 + let k = Crypto.ARC4.of_secret key in 7 + let pt = String.make 16 '\x00' in 8 + let r = Crypto.ARC4.encrypt ~key:k pt in 9 + Printf.printf "ARC4-192: %s\n" (Ohex.encode r.message); 10 + (* AES-GCM 256 with cafebabe nonce *) 11 + let gkey = 12 + Crypto.AES.GCM.of_secret 13 + (vx "feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308") 14 + in 15 + let nonce = vx "cafebabefacedbaddecaf888" in 16 + let p = 17 + vx 18 + "d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39" 19 + in 20 + let adata = vx "feedfacedeadbeeffeedfacedeadbeefabaddad2" in 21 + let ct, tag = 22 + Crypto.AES.GCM.authenticate_encrypt_tag ~key:gkey ~nonce ~adata p 23 + in 24 + Printf.printf "GCM-256-CT: %s\n" (Ohex.encode ct); 25 + Printf.printf "GCM-256-Tag: %s\n" (Ohex.encode tag)
+4
test/check_vectors/dune
··· 1 + (executable 2 + (name check_vectors) 3 + (libraries crypto crypto-rng crypto-rng.unix ohex) 4 + (optional))
+2 -3
test/dune
··· 9 9 ohex 10 10 fmt 11 11 test_common 12 - wycheproof 13 - digestif 14 - asn1-combinators) 12 + ec_wycheproof 13 + digestif) 15 14 (deps 16 15 ecdh_secp256r1_test.json 17 16 ecdsa_secp256r1_sha256_test.json
+4
test/ec/ec_wycheproof/dune
··· 1 + (library 2 + (name ec_wycheproof) 3 + (libraries alcotest wycheproof crypto-ec asn1-combinators digestif fmt) 4 + (optional))
+1 -1
test/test_crypto_ec.ml
··· 1150 1150 point_module_tests (module P256) "P256"; 1151 1151 point_module_tests (module P384) "P384"; 1152 1152 point_module_tests (module P521) "P521"; 1153 - List.concat_map snd Test_ec_wycheproof.suite; 1153 + List.concat_map snd Ec_wycheproof.suite; 1154 1154 ] )
test/test_ec_wycheproof.ml test/ec/ec_wycheproof/ec_wycheproof.ml
+1 -1
tests/dune
··· 6 6 crypto 7 7 crypto-rng 8 8 crypto-rng.unix 9 - randomconv 9 + random_selftests 10 10 ohex 11 11 crypto-pk 12 12 digestif))
+4
tests/random_selftests/dune
··· 1 + (library 2 + (name random_selftests) 3 + (libraries alcotest crypto crypto-rng randomconv) 4 + (optional))
+3
tests/random_selftests/random_selftests.mli
··· 1 + (** Random self-tests for block cipher modes. *) 2 + 3 + val suite : (string * unit Alcotest.test_case list) list
+1 -1
tests/test_crypto.ml
··· 1102 1102 chacha20_cases; 1103 1103 [ Alcotest.test_case "poly1305" `Quick poly1305_rfc8439_2_5_2 ]; 1104 1104 [ Alcotest.test_case "empty" `Quick empty_cases ]; 1105 - List.concat_map snd Test_random_selftests.suite; 1105 + List.concat_map snd Random_selftests.suite; 1106 1106 ] )
tests/test_random_selftests.ml tests/random_selftests/random_selftests.ml