diff options
| author | Steven Fackler <[email protected]> | 2016-10-17 21:21:09 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-10-17 21:57:54 -0700 |
| commit | 194298a057bad2b79e45ef346a0e6f37f8bc0716 (patch) | |
| tree | 2725a3d891ba46de9b93a6e752a6f0c96f58ebbb /openssl/src/dh.rs | |
| parent | Merge pull request #476 from sfackler/error-handling (diff) | |
| download | rust-openssl-194298a057bad2b79e45ef346a0e6f37f8bc0716.tar.xz rust-openssl-194298a057bad2b79e45ef346a0e6f37f8bc0716.zip | |
Implement new feature setup
The basic idea here is that there is a feature for each supported
OpenSSL version. Enabling multiple features represents support for
multiple OpenSSL versions, but it's then up to you to check which
version you link against (probably by depending on openssl-sys and
making a build script similar to what openssl does).
Diffstat (limited to 'openssl/src/dh.rs')
| -rw-r--r-- | openssl/src/dh.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs index fec6bd98..3b06951e 100644 --- a/openssl/src/dh.rs +++ b/openssl/src/dh.rs @@ -33,21 +33,24 @@ impl DH { } } - #[cfg(feature = "openssl-102")] + /// 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 get_1024_160() -> Result<DH, ErrorStack> { unsafe { cvt_p(ffi::DH_get_1024_160()).map(DH) } } - #[cfg(feature = "openssl-102")] + /// 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 get_2048_224() -> Result<DH, ErrorStack> { unsafe { cvt_p(ffi::DH_get_2048_224()).map(DH) } } - #[cfg(feature = "openssl-102")] + /// 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 get_2048_256() -> Result<DH, ErrorStack> { unsafe { cvt_p(ffi::DH_get_2048_256()).map(DH) @@ -96,7 +99,7 @@ mod tests { use ssl::{SslMethod, SslContext}; #[test] - #[cfg(feature = "openssl-102")] + #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] fn test_dh_rfc5114() { let mut ctx = SslContext::new(SslMethod::tls()).unwrap(); let dh1 = DH::get_1024_160().unwrap(); |