File tree Expand file tree Collapse file tree 9 files changed +12
-16
lines changed Expand file tree Collapse file tree 9 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ depends: [
20
20
"cstruct" {>= "6.0.0"}
21
21
"mtime" {>= "1.0.0"}
22
22
"lwt" {>= "5.3.0"}
23
- "mirage-time " {>= "2 .0.0"}
23
+ "mirage-sleep " {>= "4 .0.0"}
24
24
"duration" {>= "0.2.0"}
25
25
"mirage-flow" {>= "4.0.0"}
26
- "mirage-clock " {>= "3 .0.0"}
26
+ "mirage-mtime " {>= "4 .0.0"}
27
27
"logs"
28
28
]
29
29
synopsis: "SSH implementation in OCaml"
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ depends: [
17
17
"ocaml" {>= "4.10.0"}
18
18
"dune" {>= "2.7"}
19
19
"mirage-crypto" {>= "1.0.0"}
20
- "mirage-crypto-rng" {>= "1.0 .0"}
20
+ "mirage-crypto-rng" {>= "1.2 .0"}
21
21
"mirage-crypto-pk"
22
22
"mirage-crypto-ec" {>= "1.0.0"}
23
23
"x509" {>= "1.0.0"}
Original file line number Diff line number Diff line change @@ -3,10 +3,7 @@ open Lwt.Infix
3
3
let src = Logs.Src. create " awa.mirage" ~doc: " Awa mirage"
4
4
module Log = (val Logs. src_log src : Logs.LOG )
5
5
6
- module Make (F : Mirage_flow.S ) (T : Mirage_time.S ) (M : Mirage_clock.MCLOCK ) = struct
7
-
8
- module MCLOCK = M
9
-
6
+ module Make (F : Mirage_flow.S ) = struct
10
7
type error = [ `Msg of string
11
8
| `Read of F .error
12
9
| `Write of F .write_error ]
@@ -81,8 +78,7 @@ module Make (F : Mirage_flow.S) (T : Mirage_time.S) (M : Mirage_clock.MCLOCK) =
81
78
| Ok () -> write_flow t d)
82
79
(Ok () ) bufs
83
80
84
- let now () =
85
- Mtime. of_uint64_ns (M. elapsed_ns () )
81
+ let now () = Mtime. of_uint64_ns (Mirage_mtime. elapsed_ns () )
86
82
87
83
let read_react t =
88
84
match t.state with
@@ -305,7 +301,7 @@ module Make (F : Mirage_flow.S) (T : Mirage_time.S) (M : Mirage_clock.MCLOCK) =
305
301
match server.Awa.Server. key_eol with
306
302
| None -> []
307
303
| Some mtime ->
308
- [ T. sleep_ns (Mtime. to_uint64_ns mtime) >> = fun () -> Lwt. return Rekey ]
304
+ [ Mirage_sleep. ns (Mtime. to_uint64_ns mtime) >> = fun () -> Lwt. return Rekey ]
309
305
310
306
let rec nexus t fd server input_buffer pending_promises =
311
307
wrapr (Awa.Server. pop_msg2 server input_buffer)
Original file line number Diff line number Diff line change 1
1
(* * Effectful operations using Mirage for pure SSH. *)
2
2
3
3
(* * SSH module given a flow *)
4
- module Make (F : Mirage_flow.S ) ( T : Mirage_time.S ) ( M : Mirage_clock.MCLOCK ) : sig
4
+ module Make (F : Mirage_flow.S ) : sig
5
5
6
6
(* * possible errors: incoming alert, processing failure, or a
7
7
problem in the underlying flow. *)
Original file line number Diff line number Diff line change 2
2
(name awa_mirage)
3
3
(public_name awa-mirage)
4
4
(wrapped false)
5
- (libraries awa mirage-flow mirage-clock mirage-time duration lwt mtime logs))
5
+ (libraries awa mirage-flow mirage-mtime mirage-sleep duration lwt mtime logs))
Original file line number Diff line number Diff line change 1
1
2
2
let gen_key seed typ =
3
- Mirage_crypto_rng_unix. initialize ( module Mirage_crypto_rng. Fortuna );
3
+ Mirage_crypto_rng_unix. use_default ( ) ;
4
4
let seed = match seed with
5
5
| None -> Base64. encode_string (Mirage_crypto_rng. generate 30 )
6
6
| Some x -> x
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ let write_cstruct fd buf =
39
39
40
40
let jump _ user pass seed typ keyfile authenticator host port =
41
41
let ( let * ) = Result. bind in
42
- Mirage_crypto_rng_unix. initialize ( module Mirage_crypto_rng. Fortuna );
42
+ Mirage_crypto_rng_unix. use_default ( ) ;
43
43
let fd = Unix. (socket PF_INET SOCK_STREAM 0 ) in
44
44
Unix. (connect fd (ADDR_INET (inet_addr_of_string host, port)));
45
45
match
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ let rec wait_connection priv_key listen_fd server_port =
225
225
wait_connection priv_key listen_fd server_port
226
226
227
227
let jump () =
228
- Mirage_crypto_rng_unix. initialize ( module Mirage_crypto_rng. Fortuna );
228
+ Mirage_crypto_rng_unix. use_default ( ) ;
229
229
let g = Mirage_crypto_rng. (create ~seed: " 180586" (module Fortuna )) in
230
230
let (ec_priv,_) = Mirage_crypto_ec.Ed25519. generate ~g () in
231
231
let priv_key = Awa.Hostkey. Ed25519_priv (ec_priv) in
Original file line number Diff line number Diff line change @@ -608,7 +608,7 @@ let all_tests = [
608
608
]
609
609
610
610
let _ =
611
- Mirage_crypto_rng_unix. initialize ( module Mirage_crypto_rng. Fortuna );
611
+ Mirage_crypto_rng_unix. use_default ( ) ;
612
612
Sys. set_signal Sys. sigalrm (Sys. Signal_handle (fun _ -> failwith " timeout" ));
613
613
Unix. chmod " data/awa_test_rsa" 0o600 ;
614
614
List. iter run_test all_tests;
You can’t perform that action at this time.
0 commit comments