summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml8
-rw-r--r--src/lib.rs12
2 files changed, 15 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index e22d735..8875700 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ssh2"
-version = "0.2.12"
+version = "0.2.13"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
keywords = ["ssh"]
@@ -19,10 +19,10 @@ name = "all"
[dependencies]
bitflags = "0.1"
libc = "0.2"
+libssh2-sys = { path = "libssh2-sys", version = "0.1.38" }
-[dependencies.libssh2-sys]
-path = "libssh2-sys"
-version = "0.1.0"
+[target."cfg(unix)".dependencies]
+openssl-sys = "0.7"
[dev-dependencies]
tempdir = "0.3"
diff --git a/src/lib.rs b/src/lib.rs
index 0f64d5f..cf05eb5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -166,10 +166,20 @@ mod util;
pub fn init() {
static INIT: Once = ONCE_INIT;
INIT.call_once(|| unsafe {
- assert_eq!(raw::libssh2_init(0), 0);
+ platform_init();
+ assert_eq!(raw::libssh2_init(raw::LIBSSH2_INIT_NO_CRYPTO), 0);
assert_eq!(libc::atexit(shutdown), 0);
});
extern fn shutdown() { unsafe { raw::libssh2_exit(); } }
+
+ #[cfg(unix)]
+ fn platform_init() {
+ extern crate openssl_sys;
+ openssl_sys::init();
+ }
+
+ #[cfg(windows)]
+ fn platform_init() {}
}
unsafe fn opt_bytes<'a, T>(_: &'a T,