-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove rand from public api. #167
Conversation
This has a corollary: if you'd like to avoid |
Well, the downside is that many users would have to wrap all of the ed25519-dalek api to get a simple generate function. It also precludes me from being able to use ed25519-dalek in my public apis. Also I'd assume it is more advanced users that want to customize the rng, since zeroizing the original bytes can be a bit tricky. Every time the bytes are moved on the stack they need to be zeroized. But this is probably a problem even in ed25519-dalek (when you pass a keypair by value to a function) I guess? |
Would adding a |
It's needed by any user who is using a platform which isn't supported by https://docs.rs/getrandom/0.2.2/getrandom/#supported-targets There is a new |
Interesting, so maybe |
7ded890
to
3036007
Compare
So tried the |
3036007
to
7744afb
Compare
Are there any objections? Other than the marker trait for csprng I don't think we lose anything with this approach. |
This is definitely a breaking change and as such should be part of a major release. It would also be good to look into the roadmap for If the API is almost stable, I'm not sure it's worth dropping support now. |
I didn't find a roadmap, could you point me to it?
Well, it's not dropping support, they're still interoperable. |
The use cases where I'm not sure the bounds you've supplied for the Especially in embedded use cases, the RNGs are owned and stateful, and don't fit into a |
it's a FnMut so you can have arbitrary mutable state in it, and &mut FnMut also implements FnMut. And if you have something like this: static mut RNG: HardwareRng = HardwareRng {}; you should be able to call I think the Send/Sync concern doesn't apply as there is no bound for Send or Sync, meaning you can supply any FnMut not just a Send or a Sync one. I think |
You can't just stick hardware RNGs (or Hardware peripheral access in the Rust Embedded ecosystem is generally managed explicitly via owned values which are passed as parameters to functions after device initialization. This avoids any sort of racy "life before main"-style initialization problems. |
Let me put it this way:
|
7744afb
to
3a54d0e
Compare
third time is the charm |
ping @isislovecruft |
Closing for now as there doesn't seem to be any interest. Feel free to reopen if things change. |
I expect for most users this is fine, and if some user would like to use a different
Rng
they can use thefrom_bytes
call.Since
rand
has a history of causing breakage ined25519-dalek
I think this change could be justified as a bug fix.Also updates the dependencies to new versions where appropriate.
Closes #160
Closes #159
Closes #162