-
Notifications
You must be signed in to change notification settings - Fork 253
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
Implement ZeroizeOnDrop for SHA 1..=2 and Blake2 #516
Conversation
Enables using zeroize with a distinct name, enables cleanly working around msrv requirements.
Do not implement the |
Also it's probably worth to wait for the next breaking release of |
This does not return an invalid state. It's effectively a reset with a guarantee the prior state is gone. Please read the implementation. Also, I am unable to get CI happy 0_o |
You literally set zeros into hasher states, which may cause security issues if such state is to be accidentally used by users. For proper reset you should use the initialization constants. You SHOULD NOT implement the |
... and then immediately after setting zeroes, set the initialization constants. |
If you'd rather it directly set the initialization constants, that can be done. It'd just require re-implementing the zeroize's crate internal mechanisms to avoid being optimized out by the compiler. That would duplicate code (several times), notably increase maintenance effort, and be at greater risk of failure IMO. |
Yes, you are right, but it's not "zeroization" anymore, isn't it? The point of the I will repeat myself: you should not implement the |
It's not zeroization, yet the intent is to erase the prior state. This does perform exactly that erasure. I'm unsure of anyone who performs zeroization and then reads the memory, always expecting zeroes (no matter the type) like it's a As for whether or not this should solely implement |
Generally With |
The minimal versions CI failures are not relevant to this PR and should be fixed by RustCrypto/actions#34 |
Happy to hear. I just pushed a commit which solely adds ZeroizeOnDrop for SHA 1..= 2 and Blake2 👍 |
Pushed what I believe to be resolutions 👍 Thanks for the tips :) |
Is there anything I can do to push this forward? |
Closing in favor of #545. |
Relevant to #87.
Resets the hasher state after calling zeroize so it's still usable (1 and 2) indistinguishable from a newly constructed hasher.
This needs a impl Zeroize where Wrapped: Zeroize on CoreWrapper and associated in digest to be pleasantly effective. It's technically reachable now via wrappers'
decompose
functions. I would've done that with this PR yet the digest crate is in a distinct repo.