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

de-deprecate miou-unix

+18 -12
-1
rng/miou/mirage_crypto_rng_miou_unix.mli
··· 14 (** Type of tasks seeding the RNG. *) 15 16 val initialize : ?g:'a -> ?sleep:int64 -> 'a Mirage_crypto_rng.generator -> rng 17 - [@@deprecated "Use 'Mirage_crypto_rng_unix.use_default ()' instead."] 18 (** [initialize ?g ?sleep (module Generator)] will allow the RNG to operate in a 19 returned task. This task periodically launches sub-tasks that seed the 20 engine (using [getrandom()], [getentropy()] or [BCryptGenRandom()] depending
··· 14 (** Type of tasks seeding the RNG. *) 15 16 val initialize : ?g:'a -> ?sleep:int64 -> 'a Mirage_crypto_rng.generator -> rng 17 (** [initialize ?g ?sleep (module Generator)] will allow the RNG to operate in a 18 returned task. This task periodically launches sub-tasks that seed the 19 engine (using [getrandom()], [getentropy()] or [BCryptGenRandom()] depending
+12
rng/mirage_crypto_rng.mli
··· 30 Fortuna and producing random numbers is not thread-safe} (it is on Miou_unix 31 via Pfortuna). 32 33 The RNGs here are merely the deterministic part of a full random number 34 generation suite. For proper operation, they need to be seeded with a 35 high-quality entropy source.
··· 30 Fortuna and producing random numbers is not thread-safe} (it is on Miou_unix 31 via Pfortuna). 32 33 + Suitable entropy feeding of generators are provided by other libraries 34 + {{!Mirage_crypto_rng_mirage}mirage-crypto-rng-mirage} (for MirageOS), 35 + and {{!Mirage_crypto_rng_miou_unix}mirage-crypto-miou-unix} (for Miou_unix). 36 + 37 + The intention is that "initialize" in the respective sub-library is called 38 + once, which sets the default generator and registers entropy 39 + harvesting asynchronous tasks. The semantics is that the entropy is always 40 + fed to the {{!default_generator}default generator}, which is not necessarily 41 + the one set by "initialize". The reasoning behind this is that the default 42 + generator should be used in most setting, and that should be fed a constant 43 + stream of entropy. 44 + 45 The RNGs here are merely the deterministic part of a full random number 46 generation suite. For proper operation, they need to be seeded with a 47 high-quality entropy source.
+4 -1
rng/rng.ml
··· 15 following:\ 16 \n If you are using MirageOS, use the random device in config.ml: \ 17 `let main = Mirage.main \"Unikernel.Main\" (random @-> job)`, \ 18 - and `let () = register \"my_unikernel\" [main $ default_random]`." 19 20 let () = Printexc.register_printer (function 21 | Unseeded_generator ->
··· 15 following:\ 16 \n If you are using MirageOS, use the random device in config.ml: \ 17 `let main = Mirage.main \"Unikernel.Main\" (random @-> job)`, \ 18 + and `let () = register \"my_unikernel\" [main $ default_random]`. \ 19 + \n If you are using miou, execute \ 20 + `Mirage_crypto_rng_miou_unix.initialize (module Mirage_crypto_rng.Fortuna)` \ 21 + at startup." 22 23 let () = Printexc.register_printer (function 24 | Unseeded_generator ->
+1 -5
tests/test_miou_entropy_collection.ml
··· 20 21 let () = 22 Miou_unix.run @@ fun () -> 23 - let rng = 24 - begin[@alert "-deprecated"] 25 - Mirage_crypto_rng_miou_unix.initialize (module Printing_rng) 26 - end 27 - in 28 Format.printf "entropy sources: %a@,%!" 29 (fun ppf -> List.iter (fun x -> 30 Mirage_crypto_rng.Entropy.pp_source ppf x;
··· 20 21 let () = 22 Miou_unix.run @@ fun () -> 23 + let rng = Mirage_crypto_rng_miou_unix.initialize (module Printing_rng) in 24 Format.printf "entropy sources: %a@,%!" 25 (fun ppf -> List.iter (fun x -> 26 Mirage_crypto_rng.Entropy.pp_source ppf x;
+1 -5
tests/test_miou_rng.ml
··· 1 let () = Miou_unix.run @@ fun () -> 2 - let rng = 3 - begin[@alert "-deprecated"] 4 - Mirage_crypto_rng_miou_unix.(initialize (module Pfortuna)) 5 - end 6 - in 7 let random_num = Mirage_crypto_rng.generate 32 in 8 assert (String.length random_num = 32); 9 Printf.printf "32 bit random number: %s\n%!" (Ohex.encode random_num);
··· 1 let () = Miou_unix.run @@ fun () -> 2 + let rng = Mirage_crypto_rng_miou_unix.(initialize (module Pfortuna)) in 3 let random_num = Mirage_crypto_rng.generate 32 in 4 assert (String.length random_num = 32); 5 Printf.printf "32 bit random number: %s\n%!" (Ohex.encode random_num);