Skip to content

rng: Fix subkeys not initialized - #230

Merged
klauspost merged 1 commit into
minio:mainfrom
klauspost:fix-reset-not-rng
Apr 8, 2026
Merged

klauspost merged 1 commit into
minio:mainfrom
klauspost:fix-reset-not-rng

Conversation

@klauspost

Copy link
Copy Markdown
Contributor

This comment was marked as resolved.

@klauspost
klauspost requested a review from rraulinio April 7, 2026 12:25
@klauspost
klauspost merged commit ea0b47a into minio:main Apr 8, 2026
7 checks passed
@klauspost
klauspost deleted the fix-reset-not-rng branch April 8, 2026 10:07
Vonng added a commit to pgsty/silo-pkg that referenced this pull request Aug 2, 2026
Backport of minio#230 (ea0b47a).

init() reads 32 bytes from the source into r.tmp, then derived the four
subkeys from a zeroed local of the same name. The subkeys were therefore
always zero, which collapses the four per-block lanes onto one key and
makes Reset() and ResetSize() replay the previous stream byte for byte.

MinIO reaches this through randreader.New(), which builds a fresh reader
per call and never resets, so the practical effect here is small; warp is
what surfaced it. The fix costs five lines either way.

The tests read one aligned block rather than 64 MiB. ResetSize reseeds
the subkeys and nothing else, so if they stayed zero the very first bytes
after the reset would repeat - which the shrunk assertion still catches,
confirmed by reverting the fix. The original size cost roughly 430 MiB of
resident memory under -race for no extra coverage. Error returns from
NewReader, Reset, ResetSize and ReadFull are checked rather than dropped.

(cherry picked from commit afc57198ade9ae946705823183c5e54077c66b61)
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