-
Notifications
You must be signed in to change notification settings - Fork 30
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
Using Pin
with SecretKey
and other types that hold secret data
#59
Comments
The problem here is that One solution would be to add a |
Thanks for chiming in here! This issue was created back when
This is also how I've understood it. There is really nothing much we can do about the stack-allocated data, as you said yourself. Perhaps we should also re-consider/look into the current places where stack-allocated data is zeroed, to see if it even makes sense.
Strictly speaking, it could work with We could consider trying out the In any case, thanks again. Your input is very much appreciated here. |
The solution that I have ended up using in my own half-complete file encryption project, which uses I wonder if it would be possible to replicate |
Thanks for linking your implementation, this could serve as a good reference point! Using the new allocator API for specific sensitive-data types sounds like an interesting idea. I didn't even know about this new API until now. In the context of this crate, that would mean implementing such functionality in a different crate though, since Orion forbids unsafe. |
I suppose, zooming out for a minute, that one class of attack that this kind of memory protection is supposed to prevent is simply not possible in Rust -- in languages without memory safety it makes sense as a defence-in-depth measure against bounds checking bugs, but in (safe) Rust we have guarantees that that doesn't happen. Not to say that there aren't other classes of vulnerabilities that still exist for Rust programs though (e.g. core dumps, sensitive data being swapped to disk). Anyway, implementing that memory protection functionality in its own crate sounds like an interesting project. Maybe I or somebody else could take it up one day. |
Ways to use Pin for types that hold secret data need to be explored, to avoid copies being left around. The ideal scenario is implementing
Pin
with all types that hold secret data, without any changes to the public API's.The text was updated successfully, but these errors were encountered: