Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to mirage-crypto-rng 0.11.0 API #49

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion awa.opam
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ depends: [
"ppx_sexp_conv"
"ppx_cstruct"
"mirage-crypto" {>= "0.8.1"}
"mirage-crypto-rng"
"mirage-crypto-rng" {>= "0.11.0"}
"mirage-crypto-pk"
"mirage-crypto-ec" {>= "0.10.0"}
"x509" {>= "0.15.2"}
Expand Down
2 changes: 1 addition & 1 deletion test/awa_gen_key.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

let gen_key seed typ =
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
let b64s x = Cstruct.to_string x |> Base64.encode_string in
let seed = match seed with
| None -> b64s (Mirage_crypto_rng.generate 30)
Expand Down
2 changes: 1 addition & 1 deletion test/awa_lwt_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let rec wait_connection priv_key listen_fd server_port =
wait_connection priv_key listen_fd server_port

let main =
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
let g = Mirage_crypto_rng.(create ~seed:(Cstruct.of_string "180586") (module Fortuna)) in
let (ec_priv,_) = Mirage_crypto_ec.Ed25519.generate ~g () in
let priv_key = Awa.Hostkey.Ed25519_priv (ec_priv) in
Expand Down
2 changes: 1 addition & 1 deletion test/awa_test_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let write_cstruct fd buf =

let jump _ user seed typ keyfile authenticator host port =
let ( let* ) = Result.bind in
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
let fd = Unix.(socket PF_INET SOCK_STREAM 0) in
Unix.(connect fd (ADDR_INET (inet_addr_of_string host, port)));
match
Expand Down
2 changes: 1 addition & 1 deletion test/awa_test_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ let rec wait_connection priv_key listen_fd server_port =
wait_connection priv_key listen_fd server_port

let () =
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
let g = Mirage_crypto_rng.(create ~seed:(Cstruct.of_string "180586") (module Fortuna)) in
let (ec_priv,_) = Mirage_crypto_ec.Ed25519.generate ~g () in
let priv_key = Awa.Hostkey.Ed25519_priv (ec_priv) in
Expand Down
2 changes: 1 addition & 1 deletion test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ let all_tests = [
]

let _ =
Mirage_crypto_rng_unix.initialize ();
Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna);
Sys.set_signal Sys.sigalrm (Sys.Signal_handle (fun _ -> failwith "timeout"));
Unix.chmod "data/awa_test_rsa" 0o600;
List.iter run_test all_tests;