Skip to content

Commit

Permalink
Merge pull request #49 from hannesm/mirage-crypto-011
Browse files Browse the repository at this point in the history
update to mirage-crypto-rng 0.11.0 API
  • Loading branch information
hannesm authored Feb 16, 2023
2 parents 7be0fcc + 9e8591e commit 69000f9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
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;

0 comments on commit 69000f9

Please sign in to comment.