diff options
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 12 | ||||
| -rw-r--r-- | openssl/src/ssl/tests.rs | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 5d3549ff..fe04e8ec 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -279,6 +279,18 @@ impl SslContext { ffi::SSL_CTX_set_cipher_list(*self.ctx, cipher_list.as_ptr()) }) } + + pub fn set_options(&mut self, option: c_long) -> c_long { + unsafe { + ffi::SSL_CTX_set_options(*self.ctx, option) + } + } + + pub fn get_options(&mut self) -> c_long { + unsafe { + ffi::SSL_CTX_get_options(*self.ctx) + } + } } #[allow(dead_code)] diff --git a/openssl/src/ssl/tests.rs b/openssl/src/ssl/tests.rs index 4bb3c2ca..c5e9c5e9 100644 --- a/openssl/src/ssl/tests.rs +++ b/openssl/src/ssl/tests.rs @@ -174,6 +174,20 @@ fn test_verify_callback_data() { } } +#[test] +fn test_get_ctx_options() { + let mut ctx = SslContext::new(Sslv23).unwrap(); + ctx.get_options(); +} + +#[test] +fn test_set_ctx_options() { + let mut ctx = SslContext::new(Sslv23).unwrap(); + let start_opts = ctx.get_options(); + let ssl_op_no_sslv3 = 0x02000000; + let res = ctx.set_options(ssl_op_no_sslv3); + assert_eq!(res, start_opts | ssl_op_no_sslv3); +} #[test] fn test_write() { |