tls: no need to initialize rng (tls.lwt does this for us)

This commit is contained in:
Hannes Mehnert 2020-06-23 20:03:59 +02:00
parent c98ac0494d
commit d93a683d94
4 changed files with 4 additions and 7 deletions

View file

@ -22,9 +22,9 @@ depends: [
"astring" "astring"
"jsonm" "jsonm"
"x509" {>= "0.11.0"} "x509" {>= "0.11.0"}
"tls" {>= "0.12.0"} "tls" {>= "0.12.2"}
"mirage-crypto-pk" "mirage-crypto-pk"
"mirage-crypto-rng" {>= "0.7.0"} "mirage-crypto-rng" {>= "0.8.0"}
"asn1-combinators" {>= "0.2.0"} "asn1-combinators" {>= "0.2.0"}
"duration" "duration"
"decompress" {>= "0.9.0" & < "1.0.0"} "decompress" {>= "0.9.0" & < "1.0.0"}

View file

@ -15,7 +15,6 @@ let rec read_tls_write_cons t =
| Error e -> Lwt.return e | Error e -> Lwt.return e
let client cas host port cert priv_key = let client cas host port cert priv_key =
Mirage_crypto_rng_lwt.initialize () >>= fun () ->
let auth = if Sys.is_directory cas then `Ca_dir cas else `Ca_file cas in let auth = if Sys.is_directory cas then `Ca_dir cas else `Ca_file cas in
X509_lwt.authenticator auth >>= fun authenticator -> X509_lwt.authenticator auth >>= fun authenticator ->
Lwt.catch (fun () -> Lwt.catch (fun () ->

View file

@ -17,8 +17,7 @@ let jump _ cacert cert priv_key port tmpdir =
Sys.(set_signal sigpipe Signal_ignore); Sys.(set_signal sigpipe Signal_ignore);
Albatross_cli.set_tmpdir tmpdir; Albatross_cli.set_tmpdir tmpdir;
Lwt_main.run Lwt_main.run
(Mirage_crypto_rng_lwt.initialize () >>= fun () -> (server_socket port >>= fun socket ->
server_socket port >>= fun socket ->
tls_config cacert cert priv_key >>= fun config -> tls_config cacert cert priv_key >>= fun config ->
let rec loop () = let rec loop () =
Lwt.catch (fun () -> Lwt.catch (fun () ->

View file

@ -7,8 +7,7 @@ let jump cacert cert priv_key tmpdir =
Sys.(set_signal sigpipe Signal_ignore) ; Sys.(set_signal sigpipe Signal_ignore) ;
Albatross_cli.set_tmpdir tmpdir; Albatross_cli.set_tmpdir tmpdir;
Lwt_main.run Lwt_main.run
(Mirage_crypto_rng_lwt.initialize () >>= fun () -> (tls_config cacert cert priv_key >>= fun config ->
tls_config cacert cert priv_key >>= fun config ->
let fd = Lwt_unix.of_unix_file_descr Unix.stdin in let fd = Lwt_unix.of_unix_file_descr Unix.stdin in
Lwt.catch Lwt.catch
(fun () -> Tls_lwt.Unix.server_of_fd config fd) (fun () -> Tls_lwt.Unix.server_of_fd config fd)