Skip to content

add ZeroizeOnDrop to XprvData and XPrv #6

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

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

palladionIT
Copy link

This is a small MR changing how Zeroize is being used. The main contribution is adding Zeroize and ZeroizeOnDrop to Xprv.

A secondary change is removing #[zeroize(drop)] from XprvData and replacing it with ZeroizeOnDrop because it is deprecated according to the documentation.

If I missed anything I am happy to edit the PR.

Copy link
Contributor

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR

@@ -134,7 +133,7 @@ struct XprvData {
}

/// The `D` digest type param must implement SHA512. Use `sha2::Sha512` if in doubt.
#[derive(Clone, Debug)]
#[derive(Zeroize, ZeroizeOnDrop, Clone, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this? Since XprvData already has these, and it's the only field in this struct, it seems that this does not add anything.

Copy link
Author

@palladionIT palladionIT Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid question, but XPriv does not zeroization out of the box which is not an issue on its own as you noted. However, if a downstream project wants to wrap Xprv and then have the zeroization derived on the wrapper it won't work because the wrapping type here (Xprv) does not support zeroization. Hope that makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense.

@palladionIT
Copy link
Author

palladionIT commented Jul 22, 2024

Local install seems to not want to amend the commit with a GPG signature. Please let me know if that is required for this PR.

@benma benma merged commit 30342ba into BitBoxSwiss:master Jul 22, 2024
2 checks passed
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