WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Nov 4, 2025

Since OsRng has been moved to rand, and rand depends on chacha20 which depends on cipher -> crypto-common which needs access to OsRng, this temporarily vendors the relevant code (which is a thin wrapper around getrandom) until we can sort out a better solution for accessing OsRng without creating a circular dependency on rand.

cc @dhardy

@tarcieri tarcieri requested a review from newpavlov November 4, 2025 17:34
@tarcieri tarcieri force-pushed the rand_core/v0.10.0-rc-2 branch 2 times, most recently from 7974444 to c9cce6c Compare November 4, 2025 17:43
@tarcieri
Copy link
Member Author

tarcieri commented Nov 4, 2025

I guess another way to solve this would be to remove OsRng entirely and use getrandom directly

@tarcieri
Copy link
Member Author

tarcieri commented Nov 4, 2025

#2064 switches (back) to using getrandom directly, which eliminates the OsRng dependency

tarcieri added a commit that referenced this pull request Nov 5, 2025
Replaces usages of `OsRng` with `getrandom`, and `OsError` with
`getrandom::Error`.

In `rand_core` v0.10 prereleases, `OsRng` has been moved to the `rand`
crate (at least for now). The `rand` crate also depends on `chacha20`,
so if we were to depend on `rand` it would create a circular dependency.
We can avoid this circular dependency by using `getrandom` directly.

By changing the feature name back to `getrandom`, it also matches the
existing feature name in stable releases, which is one less thing people
need to change in updates.

Since `aead` was consuming `OsRng` via `crypto-common`, the latter has
been changed to re-export `getrandom`.

See also: #1379, #1746, #2063
@tarcieri tarcieri force-pushed the rand_core/v0.10.0-rc-2 branch from c9cce6c to 8addf55 Compare November 5, 2025 14:05
@tarcieri tarcieri merged commit db3d49d into master Nov 5, 2025
74 checks passed
@tarcieri tarcieri deleted the rand_core/v0.10.0-rc-2 branch November 5, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants