Skip to content

avoid u64 overflow in yescrypt prehash work-factor check#909

Open
dxbjavid wants to merge 1 commit into
RustCrypto:masterfrom
dxbjavid:yescrypt-prehash-overflow
Open

avoid u64 overflow in yescrypt prehash work-factor check#909
dxbjavid wants to merge 1 commit into
RustCrypto:masterfrom
dxbjavid:yescrypt-prehash-overflow

Conversation

@dxbjavid

@dxbjavid dxbjavid commented Jun 2, 2026

Copy link
Copy Markdown

yescrypt() gates pre-hashing on N / p * r >= 0x20000 computed in u64. For rw-mode params, N and r aren't bounded here (the rw Params validator checks neither N nor r*p), so a parsed $y$ hash with large N and r overflows the multiply and panics in debug builds at lib.rs:96. The check just below at line 127 already uses the division form to dodge this; widen the prehash operands to u128 to match.

@dxbjavid

Copy link
Copy Markdown
Author

Hi team,

Just checking in on this PR. I wanted to see if there are any updates regarding review or next steps.

Please let me know if any further changes are required from my side.

Thank you!

@tarcieri

Copy link
Copy Markdown
Member

We'll get to this (and the other PRs you opened on this repo) but these are minor fixes and there are more pressing issues we're currently working on

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