diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index b3c558c4e8079158581dbf9539b2fc9958c8a733..aa78514218e8b6a5ab31f91d2689d3a94ce2001b 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -968,6 +968,13 @@ impl Ssl { } } + /// Sets the verification mode to be used during the handshake process. + /// + /// Use `set_verify_callback` to additionally add a callback. + pub fn set_verify(&mut self, mode: SslVerifyMode) { + unsafe { ffi::SSL_set_verify(self.ssl, mode.bits as c_int, None) } + } + /// Sets the certificate verification callback to be used during the /// handshake process. /// @@ -975,7 +982,7 @@ impl Ssl { /// preveification process was successful, and an object providing access /// to the certificate chain. It should return `true` if the certificate /// chain is valid and `false` otherwise. - pub fn set_verify(&mut self, mode: SslVerifyMode, verify: F) + pub fn set_verify_callback(&mut self, mode: SslVerifyMode, verify: F) where F: Fn(bool, &X509StoreContext) -> bool + Any + 'static + Sync + Send { unsafe { diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs index 608d6fd7889567cbd8be0aec95ca6ea692c7478d..c3e7a363be621f714b3e462f0997154afcfe8680 100644 --- a/openssl/src/ssl/tests/mod.rs +++ b/openssl/src/ssl/tests/mod.rs @@ -392,7 +392,7 @@ run_test!(ssl_verify_callback, |method, stream| { let node_hash_str = "db400bb62f1b1f29c3b8f323b8f7d9dea724fdcd67104ef549c772ae3749655b"; let node_id = node_hash_str.from_hex().unwrap(); - ssl.set_verify(SSL_VERIFY_PEER, move |_, x509| { + ssl.set_verify_callback(SSL_VERIFY_PEER, move |_, x509| { CHECKED.store(1, Ordering::SeqCst); match x509.get_current_cert() { None => false,