package mirage-crypto-rng

  1. Overview
  2. Docs
A cryptographically secure PRNG

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mirage-crypto-2.3.0.tbz
sha256=840fbf4136605b4a1f1dd5c0611932a274fe3bf97464c82a6b3a9731a68e208e
sha512=8b983bf9e7fc03f3442b9e00f8ec562d6f0ae18702d10a9ca79182e135f85d1c264393d4033c78e51b945dbe4eb7f436a25ccfedeb0c1f9cdb4c46927cd94fbf

Description

Mirage-crypto-rng provides a random number generator interface, and implementations: Fortuna, HMAC-DRBG, getrandom/getentropy based (in the unix sublibrary)

Added to opam-repository:

README

OCaml cryptographic primitives library

This repository contains a small cryptographic library that puts emphasis on the applicative style and ease of use. It includes basic ciphers (AES, 3DES, RC4, ChaCha20/Poly1305), AEAD primitives (AES-GCM, AES-CCM, ChaCha20/Poly1305), public-key primitives (RSA, DSA, DH), elliptic curves (NIST P-256, P-384, P-521, and curve 25519), and a strong RNG (Fortuna).

RSA timing attacks are countered by blinding. AES timing attacks are avoided by delegating to AES-NI.

Initially, this package was developed for MirageOS, but it is very well suitable in any OCaml application. It is a fork of the ocaml-nocrypto package developed by David Kaloper. It was forked with the permission of the original author in order to facilitate changes (e.g. build system) required by MirageOS that the upstream didn't have time to keep up with.

The following packages are provided in this repository, each installable via opam install package-name:

  • mirage-crypto - the base for symmetric ciphers (AES, 3DES, RC4, ChaCha20/Poly1305) - uses allocation-free and loop-free C code,
  • mirage-crypto-ec - elliptic curves (NIST P-256, P-384, P-521, curve 25519) - uses primitives exported from fiat-crypto,
  • mirage-crypto-pk - asymmetric cryptography (RSA, DSA, DH) - uses zarith with gmp,
  • mirage-crypto-rng - random number generators (Fortuna, HMAC-DRBG),
  • mirage-crypto-rng-mirage - seed and feed entropy for the RNG with MirageOS unikernels,
  • mirage-crypto-rng-mkernel - seed and feed entropy for the RNG with mkernel (using the miou scheduler).

On Unix, getrandom() (and getentropy()) or /dev/urandom are used for random number generation. On MirageOS, entropy harvesting and feeding uses non-deterministic execution time (whirlwind RNG), and hooks into the main event loop to get some bits of the timestamp of each event, rdrand and rdseed CPU instructions if available.

RNG seeding

If RNG fails with Fatal error: exception Unseeded_generator, you need to seed it.

let () = Mirage_crypto_rng_unix.use_default ()

LICENSE

Mostly ISC, the mirage-crypto-rng and mirage-crypto-rng-mirage packages are 2 clause BSD licensed, the mirage-crypto-ec package is MIT licensed.

Dependencies (7)

  1. digestif >= "1.1.4"
  2. mirage-crypto = version
  3. logs
  4. duration
  5. dune-configurator >= "2.0.0"
  6. dune >= "2.7"
  7. ocaml >= "4.14.0"

Dev Dependencies (3)

  1. ohex with-test & >= "0.2.0"
  2. randomconv with-test & >= "0.2.0"
  3. ounit2 with-test

Used by (78)

  1. albatross = "2.1.0"
  2. anthropic
  3. arc >= "0.0.3"
  4. awa >= "0.4.0"
  5. awskit-eio < "0.2.0"
  6. awso-eio
  7. azure-cosmos-db-eio
  8. builder-web >= "0.2.0"
  9. caldav >= "0.2.4"
  10. capnp-rpc-net >= "1.2.4"
  11. capnp-rpc-unix >= "2.1"
  12. caqti-eio >= "2.1.2"
  13. chamelon >= "0.2.1"
  14. chamelon-unix >= "0.2.1"
  15. charrua-client >= "1.6.0"
  16. chatoyant
  17. cohttp-eio >= "6.1.0"
  18. conduit-mirage >= "8.0.0"
  19. conex-mirage-crypto >= "1.0.0"
  20. dkim >= "0.8.0"
  21. dkim-mirage >= "0.8.0"
  22. dns-certify >= "10.1.0"
  23. dns-cli >= "9.1.0"
  24. dns-client >= "9.1.0"
  25. dns-client-lwt >= "10.1.0"
  26. dns-client-mirage >= "10.1.0"
  27. dns-resolver >= "10.1.0"
  28. dns-server >= "9.1.0"
  29. dns-stub >= "10.1.0"
  30. dream >= "1.0.0~alpha7"
  31. flux >= "0.0.1~beta6"
  32. git >= "3.17.0"
  33. git-unix >= "3.17.0"
  34. granary
  35. http-mirage-client
  36. httpcats >= "0.3.1"
  37. irmin-cli >= "3.11.0"
  38. irmin-client >= "3.11.0"
  39. jose >= "0.10.0"
  40. jws
  41. letsencrypt >= "1.0.0" & < "2.0.0"
  42. letsencrypt-app >= "1.0.0"
  43. MlFront_Cache
  44. MlFront_Signify
  45. mhttp
  46. miou
  47. mirage-crypto-ec >= "2.3.0"
  48. mirage-crypto-pk >= "2.3.0"
  49. mirage-crypto-rng-mirage >= "2.3.0"
  50. mirage-crypto-rng-mkernel >= "2.3.0"
  51. mnet
  52. mnet-dhcp
  53. mrmime >= "0.7.0"
  54. noise
  55. ocluster >= "0.4.0"
  56. oidc
  57. opentelemetry-client-cohttp-eio >= "0.90"
  58. otr >= "1.0.0"
  59. paf >= "0.7.0"
  60. paf-cohttp >= "0.8.0"
  61. passe
  62. polymarket
  63. snf_mcp
  64. starred_ml >= "0.0.8"
  65. tcpip >= "8.2.0"
  66. tls >= "1.0.4"
  67. tls-async >= "2.0.1"
  68. tls-eio >= "2.0.1"
  69. tls-liquidsoap
  70. tls-lwt >= "2.0.1"
  71. tls-miou-unix >= "2.1.2"
  72. utcp
  73. valkey
  74. vif >= "0.0.1~beta4"
  75. webauthn >= "0.2.0"
  76. websocket >= "2.17"
  77. x509 >= "1.0.6"
  78. yocaml_git >= "2.2.0"

Conflicts (1)

  1. mirage-runtime < "3.8.0"