aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/pkey.rs
diff options
context:
space:
mode:
authorPaul Florence <[email protected]>2017-11-10 10:05:52 -0500
committerPaul Florence <[email protected]>2017-11-10 10:05:52 -0500
commit0bae121e1268565eb29e90e68b8c5e98ab1fe979 (patch)
treeac7fc87f39f98b905fa8c388b498749f28b18413 /openssl/src/pkey.rs
parentMerge pull request #757 from bvinc/master (diff)
downloadrust-openssl-0bae121e1268565eb29e90e68b8c5e98ab1fe979.tar.xz
rust-openssl-0bae121e1268565eb29e90e68b8c5e98ab1fe979.zip
Added a macro that wraps foreign type, and impl Send and Sync for both,
the borrowed type and the owned one. Replaced all invocation of `foreign_type` by `foreign_type_and_impl_send_sync`.
Diffstat (limited to 'openssl/src/pkey.rs')
-rw-r--r--openssl/src/pkey.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs
index f4e36892..9ef7e885 100644
--- a/openssl/src/pkey.rs
+++ b/openssl/src/pkey.rs
@@ -14,7 +14,7 @@ use rsa::{Rsa, Padding};
use error::ErrorStack;
use util::{CallbackState, invoke_passwd_cb, invoke_passwd_cb_old};
-foreign_type! {
+foreign_type_and_impl_send_sync! {
type CType = ffi::EVP_PKEY;
fn drop = ffi::EVP_PKEY_free;
@@ -75,9 +75,6 @@ impl PKeyRef {
}
}
-unsafe impl Send for PKey {}
-unsafe impl Sync for PKey {}
-
impl PKey {
/// Creates a new `PKey` containing an RSA key.
pub fn from_rsa(rsa: Rsa) -> Result<PKey, ErrorStack> {
@@ -226,7 +223,7 @@ impl PKey {
}
}
-foreign_type! {
+foreign_type_and_impl_send_sync! {
type CType = ffi::EVP_PKEY_CTX;
fn drop = ffi::EVP_PKEY_CTX_free;
@@ -234,9 +231,6 @@ foreign_type! {
pub struct PKeyCtxRef;
}
-unsafe impl Send for PKeyCtx {}
-unsafe impl Sync for PKeyCtx {}
-
impl PKeyCtx {
pub fn from_pkey(pkey: &PKeyRef) -> Result<PKeyCtx, ErrorStack> {
unsafe {