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

support no_std #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

support no_std #5

wants to merge 1 commit into from

Conversation

soralit
Copy link

@soralit soralit commented Mar 28, 2023

Hello 😃 , I want to use this crate in a embedded device, so I added [no_std] support.

src/securemem.rs Outdated
// of this function and that we use the length (in bytes) of the given
// slice, this call is safe.
unsafe { ::std::ptr::write_bytes(to_zero.as_mut_ptr(), 0, to_zero.len()) }
to_zero.zeroize()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not simply using the core's function for write_bytes instead of adding a new dependency ?

Suggested change
to_zero.zeroize()
unsafe { ::core::ptr::write_bytes(to_zero.as_mut_ptr(), 0, to_zero.len()) };

documentation on write_bytes

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you are right. Just modified to use this method. 😄

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