aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2018-05-20 20:55:40 -0700
committerGitHub <[email protected]>2018-05-20 20:55:40 -0700
commitac1021373cdec4655eb8556f5f08fe7bb2949bd7 (patch)
tree2a50f42dfba9c428ea9e02e1d7b08298a95909a2
parentMerge pull request #927 from sfackler/move-prot-accessors (diff)
parentRevert "Move proto version accessors to SslContextRef" (diff)
downloadrust-openssl-ac1021373cdec4655eb8556f5f08fe7bb2949bd7.tar.xz
rust-openssl-ac1021373cdec4655eb8556f5f08fe7bb2949bd7.zip
Merge pull request #928 from sfackler/revert-927-move-prot-accessors
Revert "Move proto version accessors to SslContextRef"
-rw-r--r--openssl/src/ssl/mod.rs96
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.