diff --git a/openssl-sys/src/ssl.rs b/openssl-sys/src/ssl.rs index 8c2a34db9218181df7bb7f62c5441d41658d8085..db9a18dab298cb1ef597a3bca3f8eb9f61dcab1a 100644 --- a/openssl-sys/src/ssl.rs +++ b/openssl-sys/src/ssl.rs @@ -482,6 +482,11 @@ pub unsafe fn SSL_set_mtu(ssl: *mut SSL, mtu: c_long) -> c_long { SSL_ctrl(ssl, SSL_CTRL_SET_MTU, mtu, ptr::null_mut()) } +#[cfg(ossl110)] +pub unsafe fn SSL_get_extms_support(ssl: *mut SSL) -> c_long { + SSL_ctrl(ssl, SSL_CTRL_GET_EXTMS_SUPPORT, 0, ptr::null_mut()) +} + pub type GEN_SESSION_CB = Option c_int>; @@ -768,6 +773,8 @@ pub const SSL_CTRL_SET_SIGALGS_LIST: c_int = 98; #[cfg(ossl102)] pub const SSL_CTRL_SET_VERIFY_CERT_STORE: c_int = 106; #[cfg(ossl110)] +pub const SSL_CTRL_GET_EXTMS_SUPPORT: c_int = 122; +#[cfg(ossl110)] pub const SSL_CTRL_SET_MIN_PROTO_VERSION: c_int = 123; #[cfg(ossl110)] pub const SSL_CTRL_SET_MAX_PROTO_VERSION: c_int = 124; diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 38bf02f6ac440a8e5d2259d3c9e411ba625734bb..8289c9882b58a443503aa6c20d900569c8b0c69e 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -3112,6 +3112,23 @@ impl SslRef { } } + /// Determines if current session used Extended Master Secret + /// + /// Returns `None` if the handshake is still in-progress. + /// + /// This corresponds to [`SSL_get_extms_support`]. + /// + /// [`SSL_get_extms_support`]: https://www.openssl.org/docs/man1.1.1/man3/SSL_get_extms_support.html + #[cfg(ossl110)] + pub fn extms_support(&self) -> Option { + unsafe { + match ffi::SSL_get_extms_support(self.as_ptr()) { + -1 => None, + ret => Some(ret != 0), + } + } + } + /// Returns the server's OCSP response, if present. /// /// This corresponds to [`SSL_get_tlsext_status_ocsp_resp`].