-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Revise "not a crypto library" policy and SECURITY.md #1565
base: master
Are you sure you want to change the base?
Conversation
I really like this, because it describes very well what |
@newpavlov I updated the section on WASM. BTW the WASI & Emscripten links in the getrandom docs both appear to be outdated. |
Update PR: rust-random/getrandom#597 |
- If the RNG implements `Default`, it may be default-constructed | ||
- If the RNG implements `SeedableRng`, it may be constructed and seeded using | ||
`SeedableRng::from_seed` with a cryptographically secure seed value | ||
- If the RNG implements `SeedableRng`, it may be constructed and seeded from | ||
another RNG which is itself cryptographically secure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I reading this correctly ...
Default means it will be seeded securely and automatically without any work by the caller.
SeedableRng relies on the caller providing a seed that is cryptographically secure from some other source, possibly from another RNG.
If so maybe this is more clear to have one SeedableRng bullet...
- If the RNG implements `Default`, it may be default-constructed | |
- If the RNG implements `SeedableRng`, it may be constructed and seeded using | |
`SeedableRng::from_seed` with a cryptographically secure seed value | |
- If the RNG implements `SeedableRng`, it may be constructed and seeded from | |
another RNG which is itself cryptographically secure | |
- If the RNG implements `Default`, it may be default-constructed | |
- If the RNG implements `SeedableRng`, it may be constructed and seeded using | |
`SeedableRng::from_seed` with a cryptographically secure seed value, possibly | |
from another RNG which is itself cryptographically secure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OsRng
and ThreadRng
can be default constructed and be secure.
Another way to read this is that a CryptoRng
should not support Default
if the result would be insecure.
I admit that there is potential for confusion here. Perhaps I should add to the first point:
Note that generators should only implement
Default
where a default-constructed instance is no more predictable than a securely seeded instance; for exampleOsRng
(which is a stateless) supportsDefault
construction.
Perhaps I should also add doc to the |
Attempt to slightly improve the wording left by #1514.
See also Reddit discussion.