-
Notifications
You must be signed in to change notification settings - Fork 149
zeroize: mark optimization_barrier as public
#1261
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
base: master
Are you sure you want to change the base?
Conversation
|
Marking this function public allows to implement zeroization more efficiently. For example: https://rust.godbolt.org/z/neEn8s1ze Additionally, it allows to implement erasure for (plain) external types which haven't implemented zeroization support for some reason: struct Foo {
a: ExternalType,
b: u32,
}
impl Default for Foo {
fn drop(&mut self) {
self.a = Default::default();
self.b = 0;
zeroize::optimization_barrier(self);
}
}It could be a bit fragile (e.g. if type uses |
|
Okay, interesting, if we leave the volatile writes as-is, but make |
|
Unless there is a practical demonstration of As I wrote previously, I think that we misuse volatile writes in But we can leave this discussion for a separate issue or PR. |
|
The documentation has been edited in the past to make Without Making this function public seems like a reasonable enough middle ground between actually removing any of the primitives that provide actual guarantees. |
|
Ideally, we would just use Maybe we could propose addition of a |
The function was added in #1252.
TODO: update changelog, add test