aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/crypto/pkey.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2016-06-22 22:05:03 +0200
committerJonas Schievink <[email protected]>2016-06-26 18:25:54 +0200
commit41b78547ad0357d3e86462f72c0cff333096d59f (patch)
treebefb46c6e264cdf48d88caf38940a27c8b0fef87 /openssl/src/crypto/pkey.rs
parentMake the callback take a `&mut [c_char]` (diff)
downloadrust-openssl-41b78547ad0357d3e86462f72c0cff333096d59f.tar.xz
rust-openssl-41b78547ad0357d3e86462f72c0cff333096d59f.zip
Put password callbacks behind a cargo feature
Diffstat (limited to 'openssl/src/crypto/pkey.rs')
-rw-r--r--openssl/src/crypto/pkey.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/openssl/src/crypto/pkey.rs b/openssl/src/crypto/pkey.rs
index 238c1b9e..bbb8427d 100644
--- a/openssl/src/crypto/pkey.rs
+++ b/openssl/src/crypto/pkey.rs
@@ -1,4 +1,4 @@
-use libc::{c_int, c_uint, c_ulong, c_void, c_char};
+use libc::{c_int, c_uint, c_ulong};
use std::io;
use std::io::prelude::*;
use std::iter::repeat;
@@ -12,6 +12,10 @@ use crypto::hash::Type as HashType;
use ffi;
use ssl::error::{SslError, StreamError};
use crypto::rsa::RSA;
+
+#[cfg(feature = "catch_unwind")]
+use libc::{c_void, c_char};
+#[cfg(feature = "catch_unwind")]
use crypto::util::{CallbackState, invoke_passwd_cb};
#[derive(Copy, Clone)]
@@ -99,6 +103,7 @@ impl PKey {
///
/// The callback will be passed the password buffer and should return the number of characters
/// placed into the buffer.
+ #[cfg(feature = "catch_unwind")]
pub fn private_key_from_pem_cb<R, F>(reader: &mut R, pass_cb: F) -> Result<PKey, SslError>
where R: Read, F: FnMut(&mut [c_char]) -> usize
{