diff --git a/mirage-crypto-rng.opam b/mirage-crypto-rng.opam index 35acbbd7..b8f4471d 100644 --- a/mirage-crypto-rng.opam +++ b/mirage-crypto-rng.opam @@ -18,7 +18,6 @@ depends: [ "dune-configurator" {>= "2.0.0"} "duration" "logs" - "backoff" "mirage-crypto" {=version} "digestif" {>= "1.1.4"} "ounit2" {with-test} diff --git a/rng/dune b/rng/dune index 8ae2c924..e70f9743 100644 --- a/rng/dune +++ b/rng/dune @@ -1,5 +1,5 @@ (library (name mirage_crypto_rng) (public_name mirage-crypto-rng) - (libraries mirage-crypto backoff digestif) + (libraries mirage-crypto digestif) (private_modules entropy fortuna hmac_drbg rng)) diff --git a/rng/entropy.ml b/rng/entropy.ml index 46bf492f..008bdb80 100644 --- a/rng/entropy.ml +++ b/rng/entropy.ml @@ -55,15 +55,10 @@ let _sources = Atomic.make S.empty type source = Rng.source let register_source name = - let rec go backoff = - let seen = Atomic.get _sources in - let n = S.cardinal seen in - let source = (n, name) in - let after = S.add source (Atomic.get _sources) in - if Atomic.compare_and_set _sources seen after = false - then go (Backoff.once backoff) - else source in - go Backoff.default + let n = S.cardinal (Atomic.get _sources) in + let source = (n, name) in + Atomic.set _sources (S.add source (Atomic.get _sources)); + source let id (idx, _) = idx