briansmith / ring

Safe, fast, small crypto using Rust
Other
3.69k stars 697 forks source link

Implement `std::marker::Send` and `std::marker::Sync` for relevant types #37

Closed briansmith closed 7 years ago

briansmith commented 8 years ago

This means using std::ptr::Unique for things like ECDHEphemeralKeyPair. We should probably have some helper in ring::ffi that wraps a pointer with std::ptr::Unque, implements Send, and also implements Drop by calling a one-argument C function to delete the object. That's particularly true because std::ptr::Unique is unstable, so we can't actually use it.

See also https://internals.rust-lang.org/t/pre-rfc-raw-pointer-cleanup/2544.

briansmith commented 7 years ago

This ends up happening "for free" whenever we remove uses of the heap, for the most part. Also, in general we've become good at ensuring that std::marker::Send and std::marker::Sync are automatically implemented by the compiler automatically, or adding the necessary implementations. If we've missed users of ring should file bugs for the specific missing implementations.