Skip to content

Conversation

@dhardy
Copy link
Member

@dhardy dhardy commented Jan 29, 2026

  • Added a CHANGELOG.md entry

Motivation

Removes CryptoGenerator since rust-random/rand#1722 makes it useless.

Removes fn Generator::drop since it can be confusing.

Adds fn BlockRng::clear explicitly for use with zeroize, since it is clear we do need to care about that and an explicit method appears to be the best solution (without actually depending on the zeroize crate).

Soft-blocker: chacha20 will need a new zeroize release to use clear correctly.

@dhardy dhardy requested a review from newpavlov January 29, 2026 08:27
@dhardy
Copy link
Member Author

dhardy commented Jan 29, 2026

@tarcieri this PR requires using code like the following to implement zeroization. Do you approve?

block_rng.core.zeroize();
block_rng.clear();
zeroize::optimization_barrier(&block_rng)

@tarcieri
Copy link
Contributor

Has anyone inspected the generated assembly to confirm zeroization is actually working correctly?

@dhardy
Copy link
Member Author

dhardy commented Jan 29, 2026

I haven't.

If we don't get confirmation this works before Sunday, I guess I'll only remove CryptoGenerator and publish that. Or would you prefer to delay again? (I won't have any time on Saturday, should have some tomorrow.)

@tarcieri
Copy link
Contributor

I would prefer to avoid delays if possible

@newpavlov
Copy link
Member

@tarcieri
I demonstrated generated assembly for optimization_barrier using godbolt links in the zeroize PRs. Sure, I used [u8; N] instead of the BlockRng::clear method but it should make no difference.

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.

4 participants