Use foreign-type's Opaque

This commit is contained in:
Steven Fackler 2017-07-15 21:53:49 -07:00
parent bcd0dcafcb
commit 374ad206d5
4 changed files with 6 additions and 18 deletions

View File

@ -71,7 +71,7 @@
//! } //! }
//! ``` //! ```
use ffi; use ffi;
use foreign_types::{ForeignType, ForeignTypeRef}; use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
use libc::{c_int, c_void, c_long, c_ulong}; use libc::{c_int, c_void, c_long, c_ulong};
use libc::{c_uchar, c_uint}; use libc::{c_uchar, c_uint};
use std::any::Any; use std::any::Any;
@ -107,7 +107,6 @@ use verify::X509VerifyParamRef;
use pkey::PKeyRef; use pkey::PKeyRef;
use error::ErrorStack; use error::ErrorStack;
use ex_data::Index; use ex_data::Index;
use util::Opaque;
use stack::{Stack, StackRef}; use stack::{Stack, StackRef};
use ssl::bio::BioMethod; use ssl::bio::BioMethod;
use ssl::callbacks::*; use ssl::callbacks::*;

View File

@ -1,4 +1,4 @@
use foreign_types::{ForeignTypeRef, ForeignType}; use foreign_types::{ForeignTypeRef, ForeignType, Opaque};
use libc::c_int; use libc::c_int;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::convert::AsRef; use std::convert::AsRef;
@ -11,8 +11,6 @@ use {cvt, cvt_p};
use error::ErrorStack; use error::ErrorStack;
use std::ops::{Deref, DerefMut, Index, IndexMut}; use std::ops::{Deref, DerefMut, Index, IndexMut};
use util::Opaque;
#[cfg(ossl10x)] #[cfg(ossl10x)]
use ffi::{sk_pop as OPENSSL_sk_pop, sk_free as OPENSSL_sk_free, sk_num as OPENSSL_sk_num, use ffi::{sk_pop as OPENSSL_sk_pop, sk_free as OPENSSL_sk_free, sk_num as OPENSSL_sk_num,
sk_value as OPENSSL_sk_value, _STACK as OPENSSL_STACK, sk_value as OPENSSL_sk_value, _STACK as OPENSSL_STACK,

View File

@ -358,10 +358,8 @@ impl Drop for Crypter {
} }
} }
#[doc = /** /// Encrypts data, using the specified crypter type in encrypt mode with the
* Encrypts data, using the specified crypter type in encrypt mode with the /// specified key and iv; returns the resulting (encrypted) data.
* specified key and iv; returns the resulting (encrypted) data.
*/]
pub fn encrypt( pub fn encrypt(
t: Cipher, t: Cipher,
key: &[u8], key: &[u8],
@ -371,10 +369,8 @@ pub fn encrypt(
cipher(t, Mode::Encrypt, key, iv, data) cipher(t, Mode::Encrypt, key, iv, data)
} }
#[doc = /** /// Decrypts data, using the specified crypter type in decrypt mode with the
* Decrypts data, using the specified crypter type in decrypt mode with the /// specified key and iv; returns the resulting (decrypted) data.
* specified key and iv; returns the resulting (decrypted) data.
*/]
pub fn decrypt( pub fn decrypt(
t: Cipher, t: Cipher,
key: &[u8], key: &[u8],

View File

@ -91,8 +91,3 @@ where
} }
} }
} }
/// This is intended to be used as the inner type for `FooRef` types converted from raw C pointers.
/// It has an `UnsafeCell` internally to inform the compiler about aliasability and doesn't
/// implement `Copy`, so it can't be dereferenced.
pub struct Opaque(UnsafeCell<()>);