From f4b70067719a6724658a2b67e80eaf9b38ab89bc Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 25 Oct 2016 23:12:56 -0700 Subject: Don't allow mutation of SslContexts SslContext is reference counted and the various setter methods don't take out locks where necessary. Fix this by adding a builder for the context. --- openssl/src/dh.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'openssl/src/dh.rs') diff --git a/openssl/src/dh.rs b/openssl/src/dh.rs index 3b06951e..7111a068 100644 --- a/openssl/src/dh.rs +++ b/openssl/src/dh.rs @@ -101,7 +101,7 @@ mod tests { #[test] #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] fn test_dh_rfc5114() { - let mut ctx = SslContext::new(SslMethod::tls()).unwrap(); + let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); let dh1 = DH::get_1024_160().unwrap(); ctx.set_tmp_dh(&dh1).unwrap(); let dh2 = DH::get_2048_224().unwrap(); @@ -112,7 +112,7 @@ mod tests { #[test] fn test_dh() { - let mut ctx = SslContext::new(SslMethod::tls()).unwrap(); + let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); let p = BigNum::from_hex_str("87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F25D2CEED4435\ E3B00E00DF8F1D61957D4FAF7DF4561B2AA3016C3D91134096FAA3BF429\ 6D830E9A7C209E0C6497517ABD5A8A9D306BCF67ED91F9E6725B4758C02\ @@ -142,7 +142,7 @@ mod tests { #[test] fn test_dh_from_pem() { - let mut ctx = SslContext::new(SslMethod::tls()).unwrap(); + let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); let params = include_bytes!("../test/dhparams.pem"); let dh = DH::from_pem(params).ok().expect("Failed to load PEM"); ctx.set_tmp_dh(&dh).unwrap(); -- cgit v1.2.3