aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-11-06 11:57:50 -0800
committerSteven Fackler <[email protected]>2016-11-06 11:57:50 -0800
commita4e0581e4fabc2a038209176242213e4ed48125e (patch)
tree1fc252ed4e0df9e284208ee4aa6ebbe94f996149
parentAdd accessors for cert and private key (diff)
downloadrust-openssl-a4e0581e4fabc2a038209176242213e4ed48125e.tar.xz
rust-openssl-a4e0581e4fabc2a038209176242213e4ed48125e.zip
Fix build on 1.0.1
-rw-r--r--openssl-sys/src/lib.rs5
-rw-r--r--openssl/src/ssl/mod.rs6
2 files changed, 11 insertions, 0 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index 2c39f2ff..13532477 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -1576,6 +1576,9 @@ extern {
pub fn SSL_get_verify_result(ssl: *const SSL) -> c_long;
pub fn SSL_shutdown(ssl: *mut SSL) -> c_int;
pub fn SSL_get_certificate(ssl: *const SSL) -> *mut X509;
+ #[cfg(ossl101)]
+ pub fn SSL_get_privatekey(ssl: *mut SSL) -> *mut EVP_PKEY;
+ #[cfg(not(ossl101))]
pub fn SSL_get_privatekey(ssl: *const SSL) -> *mut EVP_PKEY;
#[cfg(not(osslconf = "OPENSSL_NO_COMP"))]
@@ -1608,7 +1611,9 @@ extern {
pub fn SSL_CTX_use_PrivateKey(ctx: *mut SSL_CTX, key: *mut EVP_PKEY) -> c_int;
pub fn SSL_CTX_check_private_key(ctx: *const SSL_CTX) -> c_int;
+ #[cfg(not(ossl101))]
pub fn SSL_CTX_get0_certificate(ctx: *const SSL_CTX) -> *mut X509;
+ #[cfg(not(ossl101))]
pub fn SSL_CTX_get0_privatekey(ctx: *const SSL_CTX) -> *mut EVP_PKEY;
pub fn SSL_CTX_set_cipher_list(ssl: *mut SSL_CTX, s: *const c_char) -> c_int;
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index 16bc386b..5c41f6ea 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -764,6 +764,9 @@ impl SslContext {
impl SslContextRef {
/// Returns the certificate associated with this `SslContext`, if present.
+ ///
+ /// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0.
+ #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
pub fn certificate(&self) -> Option<&X509Ref> {
unsafe {
let ptr = ffi::SSL_CTX_get0_certificate(self.as_ptr());
@@ -776,6 +779,9 @@ impl SslContextRef {
}
/// Returns the private key associated with this `SslContext`, if present.
+ ///
+ /// Requires the `v102` or `v110` features and OpenSSL 1.0.2 or OpenSSL 1.1.0.
+ #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))]
pub fn private_key(&self) -> Option<&PKeyRef> {
unsafe {
let ptr = ffi::SSL_CTX_get0_privatekey(self.as_ptr());