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

Add optional support for Zeroize #112

Closed
wants to merge 1 commit into from
Closed

Conversation

cbeck88
Copy link

@cbeck88 cbeck88 commented Feb 10, 2021

zeroize is the most popular crate for zeroizing memory after use.
generic-array is the most popular crate for representing bytes in
cryptographic implementations which can't use an allocator.

Issues have been opened in RustCrypto about zeroizing instances of
generic-array, for instance here:
RustCrypto/hashes#87

However, sometimes you want to return generic-array from an API
while also commiting it to be zeroized after use, because the caller
might forget to do this on some code path. The natural way to do that
in zeroize crate is the Zeroizing wrapper. However, Zeroizing
cannot be used with generic-array unless generic-array implements
the Zeroize trait.

The easiest way to do that is create an optional dependency on
Zeroize and put the implementation in a conditionally-compiled
module, as we did in this commit.

zeroize is the most popular crate for zeroizing memory after use.
generic-array is the most popular crate for representing bytes in
cryptographic implementations which can't use an allocator.

Issues have been opened in RustCrypto about zeroizing instances of
generic-array, for instance here:
RustCrypto/hashes#87

However, sometimes you want to return generic-array from an API
while also commiting it to be zeroized after use, because the caller
might forget to do this on some code path. The natural way to do that
in zeroize crate is the `Zeroizing` wrapper. However, `Zeroizing`
cannot be used with `generic-array` unless `generic-array` implements
the `Zeroize` trait.

The easiest way to do that is create an optional dependency on
`Zeroize` and put the implementation in a conditionally-compiled
module, as we did in this commit.
@novacrazy
Copy link
Collaborator

novacrazy commented Aug 2, 2022

This feature has been added in 0.14.6

@novacrazy novacrazy closed this Aug 2, 2022
@cbeck88
Copy link
Author

cbeck88 commented Aug 2, 2022

Thank you

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.

None yet

2 participants