aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/ssl
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-10-13 19:46:13 -0700
committerSteven Fackler <[email protected]>2016-10-13 19:46:13 -0700
commitedfc50f37db8d230eb17480f124b9fd70166a940 (patch)
tree1849ef2aaa0fece3a93b4bf797773ef5ee2ddfdc /openssl/src/ssl
parentCorrect feature selection in tests (diff)
downloadrust-openssl-edfc50f37db8d230eb17480f124b9fd70166a940.tar.xz
rust-openssl-edfc50f37db8d230eb17480f124b9fd70166a940.zip
Clean up features
Diffstat (limited to 'openssl/src/ssl')
-rw-r--r--openssl/src/ssl/mod.rs22
-rw-r--r--openssl/src/ssl/tests/mod.rs15
2 files changed, 17 insertions, 20 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs
index fc1c131c..74c924cc 100644
--- a/openssl/src/ssl/mod.rs
+++ b/openssl/src/ssl/mod.rs
@@ -117,7 +117,7 @@ fn get_ssl_verify_data_idx<T: Any + 'static>() -> c_int {
lazy_static! {
static ref NPN_PROTOS_IDX: c_int = get_new_idx::<Vec<u8>>();
}
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
lazy_static! {
static ref ALPN_PROTOS_IDX: c_int = get_new_idx::<Vec<u8>>();
}
@@ -260,7 +260,7 @@ extern fn raw_next_proto_select_cb(ssl: *mut ffi::SSL,
unsafe { select_proto_using(ssl, out, outlen, inbuf, inlen, *NPN_PROTOS_IDX) }
}
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
extern fn raw_alpn_select_cb(ssl: *mut ffi::SSL,
out: *mut *const c_uchar,
outlen: *mut c_uchar,
@@ -512,14 +512,16 @@ impl<'a> SslContextRef<'a> {
/// compatible clients, and automatically select an appropriate elliptic
/// curve.
///
- /// This method requires OpenSSL >= 1.0.2 or LibreSSL and the `ecdh_auto`
- /// feature.
- #[cfg(all(feature = "ecdh_auto", not(ossl101)))]
+ /// This feature is always enabled on OpenSSL 1.1.0, and calling this
+ /// method does nothing.
+ ///
+ /// This method requires the `openssl-102` feature.
+ #[cfg(feature = "openssl-102")]
pub fn set_ecdh_auto(&mut self, onoff: bool) -> Result<(), ErrorStack> {
self._set_ecdh_auto(onoff)
}
- #[cfg(all(feature = "ecdh_auto", ossl102))]
+ #[cfg(all(feature = "openssl-102", ossl102))]
fn _set_ecdh_auto(&mut self, onoff: bool) -> Result<(), ErrorStack> {
wrap_ssl_result(unsafe {
ffi::SSL_CTX_ctrl(self.as_ptr(),
@@ -529,7 +531,7 @@ impl<'a> SslContextRef<'a> {
})
}
- #[cfg(all(feature = "ecdh_auto", ossl110))]
+ #[cfg(all(feature = "openssl-102", ossl110))]
fn _set_ecdh_auto(&mut self, _onoff: bool) -> Result<(), ErrorStack> {
Ok(())
}
@@ -581,8 +583,8 @@ impl<'a> SslContextRef<'a> {
///
/// Note that ordering of the protocols controls the priority with which they are chosen.
///
- /// This method needs the `alpn` feature.
- #[cfg(all(feature = "alpn", not(ossl101)))]
+ /// This method needs the `openssl-102` feature.
+ #[cfg(feature = "openssl-102")]
pub fn set_alpn_protocols(&mut self, protocols: &[&[u8]]) {
let protocols: Box<Vec<u8>> = Box::new(ssl_encode_byte_strings(protocols));
unsafe {
@@ -922,7 +924,7 @@ impl<'a> SslRef<'a> {
/// to interpret it.
///
/// This method needs the `alpn` feature.
- #[cfg(all(feature = "alpn", not(ossl101)))]
+ #[cfg(feature = "openssl-102")]
pub fn selected_alpn_protocol(&self) -> Option<&[u8]> {
unsafe {
let mut data: *const c_uchar = ptr::null();
diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs
index 01c836e7..58520930 100644
--- a/openssl/src/ssl/tests/mod.rs
+++ b/openssl/src/ssl/tests/mod.rs
@@ -104,7 +104,6 @@ impl Server {
Server::new_tcp(&["-www"])
}
- #[cfg(all(any(feature = "alpn", feature = "npn"), not(ossl101)))]
fn new_alpn() -> (Server, TcpStream) {
Server::new_tcp(&["-www",
"-nextprotoneg",
@@ -549,7 +548,7 @@ fn test_state() {
/// Tests that connecting with the client using ALPN, but the server not does not
/// break the existing connection behavior.
#[test]
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
fn test_connect_with_unilateral_alpn() {
let (_s, stream) = Server::new();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -571,7 +570,6 @@ fn test_connect_with_unilateral_alpn() {
/// Tests that connecting with the client using NPN, but the server not does not
/// break the existing connection behavior.
#[test]
-#[cfg(all(feature = "npn", not(ossl101)))]
fn test_connect_with_unilateral_npn() {
let (_s, stream) = Server::new();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -593,7 +591,7 @@ fn test_connect_with_unilateral_npn() {
/// Tests that when both the client as well as the server use ALPN and their
/// lists of supported protocols have an overlap, the correct protocol is chosen.
#[test]
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
fn test_connect_with_alpn_successful_multiple_matching() {
let (_s, stream) = Server::new_alpn();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -615,7 +613,6 @@ fn test_connect_with_alpn_successful_multiple_matching() {
/// Tests that when both the client as well as the server use NPN and their
/// lists of supported protocols have an overlap, the correct protocol is chosen.
#[test]
-#[cfg(all(feature = "npn", not(ossl101)))]
fn test_connect_with_npn_successful_multiple_matching() {
let (_s, stream) = Server::new_alpn();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -638,7 +635,7 @@ fn test_connect_with_npn_successful_multiple_matching() {
/// lists of supported protocols have an overlap -- with only ONE protocol
/// being valid for both.
#[test]
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
fn test_connect_with_alpn_successful_single_match() {
let (_s, stream) = Server::new_alpn();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -662,7 +659,6 @@ fn test_connect_with_alpn_successful_single_match() {
/// lists of supported protocols have an overlap -- with only ONE protocol
/// being valid for both.
#[test]
-#[cfg(all(feature = "npn", not(ossl101)))]
fn test_connect_with_npn_successful_single_match() {
let (_s, stream) = Server::new_alpn();
let mut ctx = SslContext::new(Tls).unwrap();
@@ -684,7 +680,6 @@ fn test_connect_with_npn_successful_single_match() {
/// Tests that when the `SslStream` is created as a server stream, the protocols
/// are correctly advertised to the client.
#[test]
-#[cfg(all(feature = "npn", not(ossl101)))]
fn test_npn_server_advertise_multiple() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let localhost = listener.local_addr().unwrap();
@@ -725,7 +720,7 @@ fn test_npn_server_advertise_multiple() {
/// Tests that when the `SslStream` is created as a server stream, the protocols
/// are correctly advertised to the client.
#[test]
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
fn test_alpn_server_advertise_multiple() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let localhost = listener.local_addr().unwrap();
@@ -766,7 +761,7 @@ fn test_alpn_server_advertise_multiple() {
/// Test that Servers supporting ALPN don't report a protocol when none of their protocols match
/// the client's reported protocol.
#[test]
-#[cfg(all(feature = "alpn", not(ossl101)))]
+#[cfg(feature = "openssl-102")]
// TODO: not sure why this test is failing on OpenSSL 1.1.0, may be related to
// something about SSLv3 though?
#[cfg_attr(ossl110, ignore)]