Skip to content
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

zeroize: implement Zeroize for PhantomData/PhantomPinned #651

Closed
tarcieri opened this issue Nov 5, 2021 · 2 comments
Closed

zeroize: implement Zeroize for PhantomData/PhantomPinned #651

tarcieri opened this issue Nov 5, 2021 · 2 comments

Comments

@tarcieri
Copy link
Member

tarcieri commented Nov 5, 2021

Originally filed by @Allen-Webb as iqlusioninc/crates#651

Since often pinning is desired in conjunction with Zeroize, it would be nice to have zeroize define a Zeroize implementation for core::marker::PhantomPinned so that derive can be used with structs that contain PhantomPinned to prevent moving.

Originally filed by @daxpedda as iqlusioninc/crates#899

Sometimes, when you want to implement Zeroize for a structure that contains a PhantomData field, it's necessary to implement Zeroize by hand. I suggest improving this by simply implementing Zeroize for PhantomData, which should be no-op, as this has no representation data wise I believe.

Alternatively, the derive proc-macro could detect PhantomData and skip it. I prefer the above solution though.

Allen-Webb added a commit to Allen-Webb/utils that referenced this issue Nov 5, 2021
This adds Zeroize implementations for the following types:
* PhantomData<T>
* PhantomPinned
* Tuples from length 0, to 10

This fixes issue RustCrypto#651.
tarcieri pushed a commit that referenced this issue Nov 7, 2021
This adds Zeroize implementations for the following types:
* PhantomData<T>
* PhantomPinned
* Tuples from length 0, to 10

This fixes issue #651.
@daxpedda
Copy link
Contributor

daxpedda commented Jan 5, 2022

@tarcieri, this can be closed, right?

@tarcieri
Copy link
Member Author

tarcieri commented Jan 5, 2022

Yes

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

No branches or pull requests

2 participants