aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-12-11 09:04:27 -0800
committerSteven Fackler <[email protected]>2014-12-11 09:04:27 -0800
commitc1e225563d1e8a339a07df9d30649bfd25bfe4ca (patch)
tree764d93ae9135316b792acfa3ad534cb6f7d62b8a
parentMerge pull request #118 from vhbit/oibit-fix (diff)
downloadrust-openssl-c1e225563d1e8a339a07df9d30649bfd25bfe4ca.tar.xz
rust-openssl-c1e225563d1e8a339a07df9d30649bfd25bfe4ca.zip
Clean up Copy impls a bit
-rw-r--r--openssl-sys/src/lib.rs12
-rw-r--r--src/x509/mod.rs4
2 files changed, 10 insertions, 6 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index 8550ce33..2a99d710 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -39,7 +39,6 @@ pub type X509_NAME_ENTRY = c_void;
pub type X509_REQ = c_void;
pub type X509_STORE_CTX = c_void;
-#[allow(missing_copy_implementations)]
#[repr(C)]
pub struct EVP_MD_CTX {
digest: *mut EVP_MD,
@@ -50,7 +49,8 @@ pub struct EVP_MD_CTX {
update: *mut c_void
}
-#[allow(missing_copy_implementations)]
+impl Copy for EVP_MD_CTX {}
+
#[repr(C)]
pub struct HMAC_CTX {
md: *mut EVP_MD,
@@ -61,7 +61,8 @@ pub struct HMAC_CTX {
key: [c_uchar, ..128]
}
-#[allow(missing_copy_implementations)]
+impl Copy for HMAC_CTX {}
+
#[repr(C)]
pub struct X509V3_CTX {
flags: c_int,
@@ -75,7 +76,8 @@ pub struct X509V3_CTX {
// Maybe more here
}
-#[allow(missing_copy_implementations)]
+impl Copy for X509V3_CTX {}
+
#[repr(C)]
pub struct BIGNUM {
pub d: *mut c_void,
@@ -85,6 +87,8 @@ pub struct BIGNUM {
pub flags: c_int,
}
+impl Copy for BIGNUM {}
+
pub type CRYPTO_EX_new = extern "C" fn(parent: *mut c_void, ptr: *mut c_void,
ad: *const CRYPTO_EX_DATA, idx: c_int,
argl: c_long, argp: *const c_void) -> c_int;
diff --git a/src/x509/mod.rs b/src/x509/mod.rs
index 47294c3d..8baafe41 100644
--- a/src/x509/mod.rs
+++ b/src/x509/mod.rs
@@ -362,7 +362,7 @@ impl<'ctx> X509<'ctx> {
}
/// Reads certificate from PEM, takes ownership of handle
- pub fn from_pem(reader: &mut Reader) -> Result<X509<'ctx>, SslError> {
+ pub fn from_pem<R>(reader: &mut R) -> Result<X509<'ctx>, SslError> where R: Reader {
let mut mem_bio = try!(MemBio::new());
let buf = try!(reader.read_to_end().map_err(StreamError));
try!(mem_bio.write(buf.as_slice()).map_err(StreamError));
@@ -404,7 +404,7 @@ impl<'ctx> X509<'ctx> {
}
/// Writes certificate as PEM
- pub fn write_pem(&self, writer: &mut Writer) -> Result<(), SslError> {
+ pub fn write_pem<W>(&self, writer: &mut W) -> Result<(), SslError> where W: Writer{
let mut mem_bio = try!(MemBio::new());
unsafe {
try_ssl!(ffi::PEM_write_bio_X509(mem_bio.get_handle(),