aboutsummaryrefslogtreecommitdiff
path: root/ssl/mod.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-02-27 23:39:28 -0800
committerSteven Fackler <[email protected]>2014-02-27 23:39:28 -0800
commitf5f10deadcd39872caa654e5439b473a325953bf (patch)
tree3241361a24ce4ff2bfcd3a0a7b340441d82a184a /ssl/mod.rs
parentRemove deriving(ToStr) (diff)
downloadrust-openssl-f5f10deadcd39872caa654e5439b473a325953bf.tar.xz
rust-openssl-f5f10deadcd39872caa654e5439b473a325953bf.zip
Add SSLv2 support behind a cfg flag
Many OpenSSL distributions have SSLv2 support compiled out, so it should be opt-in.
Diffstat (limited to 'ssl/mod.rs')
-rw-r--r--ssl/mod.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/ssl/mod.rs b/ssl/mod.rs
index 706df857..ad6dd023 100644
--- a/ssl/mod.rs
+++ b/ssl/mod.rs
@@ -38,15 +38,29 @@ fn init() {
/// Determines the SSL method supported
pub enum SslMethod {
+ #[cfg(sslv2)]
+ /// Only support the SSLv2 protocol
+ Sslv2,
/// Only support the SSLv3 protocol
Sslv3,
/// Only support the TLSv1 protocol
Tlsv1,
/// Support the SSLv2, SSLv3 and TLSv1 protocols
- Sslv23
+ Sslv23,
}
impl SslMethod {
+ #[cfg(sslv2)]
+ unsafe fn to_raw(&self) -> *ffi::SSL_METHOD {
+ match *self {
+ Sslv2 => ffi::SSLv2_method(),
+ Sslv3 => ffi::SSLv3_method(),
+ Tlsv1 => ffi::TLSv1_method(),
+ Sslv23 => ffi::SSLv23_method()
+ }
+ }
+
+ #[cfg(not(sslv2))]
unsafe fn to_raw(&self) -> *ffi::SSL_METHOD {
match *self {
Sslv3 => ffi::SSLv3_method(),