diff options
| author | Steven Fackler <[email protected]> | 2018-05-20 20:55:20 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-05-20 20:55:20 -0700 |
| commit | 7a7f98a32c4b7d9bc4b9b6d60e13764a0e4e6d7e (patch) | |
| tree | 2a50f42dfba9c428ea9e02e1d7b08298a95909a2 /openssl/src/ssl | |
| parent | Merge pull request #927 from sfackler/move-prot-accessors (diff) | |
| download | rust-openssl-7a7f98a32c4b7d9bc4b9b6d60e13764a0e4e6d7e.tar.xz rust-openssl-7a7f98a32c4b7d9bc4b9b6d60e13764a0e4e6d7e.zip | |
Revert "Move proto version accessors to SslContextRef"
Diffstat (limited to 'openssl/src/ssl')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 96 |
1 files changed, 44 insertions, 52 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index e62c1dc9..08475888 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -1057,6 +1057,50 @@ impl SslContextBuilder { } } + /// Gets the minimum supported protocol version. + /// + /// A value of `None` indicates that all versions down the the lowest version supported by + /// OpenSSL are enabled. + /// + /// This corresponds to [`SSL_CTX_get_min_proto_version`]. + /// + /// Requires OpenSSL 1.1.0g or LibreSSL 2.7.0 or newer. + /// + /// [`SSL_CTX_get_min_proto_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_set_min_proto_version.html + #[cfg(any(ossl110g, libressl270))] + pub fn min_proto_version(&mut self) -> Option<SslVersion> { + unsafe { + let r = ffi::SSL_CTX_get_min_proto_version(self.as_ptr()); + if r == 0 { + None + } else { + Some(SslVersion(r)) + } + } + } + + /// Gets the maximum supported protocol version. + /// + /// A value of `None` indicates that all versions down the the highest version supported by + /// OpenSSL are enabled. + /// + /// This corresponds to [`SSL_CTX_get_max_proto_version`]. + /// + /// Requires OpenSSL 1.1.0g or LibreSSL 2.7.0 or newer. + /// + /// [`SSL_CTX_get_max_proto_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_set_min_proto_version.html + #[cfg(any(ossl110g, libressl270))] + pub fn max_proto_version(&mut self) -> Option<SslVersion> { + unsafe { + let r = ffi::SSL_CTX_get_max_proto_version(self.as_ptr()); + if r == 0 { + None + } else { + Some(SslVersion(r)) + } + } + } + /// Sets the protocols to sent to the server for Application Layer Protocol Negotiation (ALPN). /// /// The input must be in ALPN "wire format". It consists of a sequence of supported protocol @@ -1452,14 +1496,6 @@ impl SslContextBuilder { } } -impl Deref for SslContextBuilder { - type Target = SslContextRef; - - fn deref(&self) -> &SslContextRef { - &self.0 - } -} - foreign_type_and_impl_send_sync! { type CType = ffi::SSL_CTX; fn drop = ffi::SSL_CTX_free; @@ -1608,50 +1644,6 @@ impl SslContextRef { } } } - - /// Gets the minimum supported protocol version. - /// - /// A value of `None` indicates that all versions down the the lowest version supported by - /// OpenSSL are enabled. - /// - /// This corresponds to [`SSL_CTX_get_min_proto_version`]. - /// - /// Requires OpenSSL 1.1.0g or LibreSSL 2.7.0 or newer. - /// - /// [`SSL_CTX_get_min_proto_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_set_min_proto_version.html - #[cfg(any(ossl110g, libressl270))] - pub fn min_proto_version(&self) -> Option<SslVersion> { - unsafe { - let r = ffi::SSL_CTX_get_min_proto_version(self.as_ptr()); - if r == 0 { - None - } else { - Some(SslVersion(r)) - } - } - } - - /// Gets the maximum supported protocol version. - /// - /// A value of `None` indicates that all versions down the the highest version supported by - /// OpenSSL are enabled. - /// - /// This corresponds to [`SSL_CTX_get_max_proto_version`]. - /// - /// Requires OpenSSL 1.1.0g or LibreSSL 2.7.0 or newer. - /// - /// [`SSL_CTX_get_max_proto_version`]: https://www.openssl.org/docs/man1.1.0/ssl/SSL_set_min_proto_version.html - #[cfg(any(ossl110g, libressl270))] - pub fn max_proto_version(&self) -> Option<SslVersion> { - unsafe { - let r = ffi::SSL_CTX_get_max_proto_version(self.as_ptr()); - if r == 0 { - None - } else { - Some(SslVersion(r)) - } - } - } } /// Information about the state of a cipher. |