diff options
| author | Steven Fackler <[email protected]> | 2016-11-03 21:15:47 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-11-03 22:45:54 -0700 |
| commit | 6fe7dd3024e5c62fa12c2c3abd30af5c0235bba6 (patch) | |
| tree | e0e72cbad6be16f4269d014d5561761c7f8facc2 /openssl/src/ssl | |
| parent | Clean up some bignum APIs (diff) | |
| download | rust-openssl-6fe7dd3024e5c62fa12c2c3abd30af5c0235bba6.tar.xz rust-openssl-6fe7dd3024e5c62fa12c2c3abd30af5c0235bba6.zip | |
Remove an enum
Diffstat (limited to 'openssl/src/ssl')
| -rw-r--r-- | openssl/src/ssl/mod.rs | 4 | ||||
| -rw-r--r-- | openssl/src/ssl/tests/mod.rs | 28 |
2 files changed, 15 insertions, 17 deletions
diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 68d411c7..4f5039de 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -567,7 +567,7 @@ impl SslContextBuilder { unsafe { cvt(ffi::SSL_CTX_use_certificate_file(self.as_ptr(), file.as_ptr() as *const _, - file_type as c_int)) + file_type.as_raw())) .map(|_| ()) } } @@ -607,7 +607,7 @@ impl SslContextBuilder { unsafe { cvt(ffi::SSL_CTX_use_PrivateKey_file(self.as_ptr(), file.as_ptr() as *const _, - file_type as c_int)) + file_type.as_raw())) .map(|_| ()) } } diff --git a/openssl/src/ssl/tests/mod.rs b/openssl/src/ssl/tests/mod.rs index 13b3a8a7..2a27dff4 100644 --- a/openssl/src/ssl/tests/mod.rs +++ b/openssl/src/ssl/tests/mod.rs @@ -20,9 +20,7 @@ use ssl::SSL_VERIFY_PEER; use ssl::{SslMethod, HandshakeError}; use ssl::{SslContext, SslStream, Ssl, ShutdownResult, SslConnectorBuilder, SslAcceptorBuilder, Error}; -use x509::X509StoreContext; -use x509::X509FileType; -use x509::X509; +use x509::{X509StoreContext, X509, X509_FILETYPE_PEM}; #[cfg(any(all(feature = "v102", ossl102), all(feature = "v110", ossl110)))] use x509::verify::X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS; use pkey::PKey; @@ -369,8 +367,8 @@ fn test_write_hits_stream() { let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); ctx.set_verify(SSL_VERIFY_PEER); - ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM).unwrap(); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM).unwrap(); + ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM).unwrap(); + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM).unwrap(); let stream = listener.accept().unwrap().0; let mut stream = Ssl::new(&ctx.build()).unwrap().accept(stream).unwrap(); @@ -634,9 +632,9 @@ fn test_npn_server_advertise_multiple() { let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); ctx.set_verify(SSL_VERIFY_PEER); ctx.set_npn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap(); - assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM) + assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM) .is_ok()); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM) + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM) .unwrap(); ctx.build() }; @@ -675,9 +673,9 @@ fn test_alpn_server_advertise_multiple() { let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); ctx.set_verify(SSL_VERIFY_PEER); ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap(); - assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM) + assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM) .is_ok()); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM) + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM) .unwrap(); ctx.build() }; @@ -716,9 +714,9 @@ fn test_alpn_server_select_none() { let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); ctx.set_verify(SSL_VERIFY_PEER); ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap(); - assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM) + assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM) .is_ok()); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM) + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM) .unwrap(); ctx.build() }; @@ -751,9 +749,9 @@ fn test_alpn_server_select_none() { let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); ctx.set_verify(SSL_VERIFY_PEER); ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap(); - assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM) + assert!(ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM) .is_ok()); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM) + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM) .unwrap(); ctx.build() }; @@ -1162,8 +1160,8 @@ fn shutdown() { thread::spawn(move || { let stream = listener.accept().unwrap().0; let mut ctx = SslContext::builder(SslMethod::tls()).unwrap(); - ctx.set_certificate_file(&Path::new("test/cert.pem"), X509FileType::PEM).unwrap(); - ctx.set_private_key_file(&Path::new("test/key.pem"), X509FileType::PEM).unwrap(); + ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM).unwrap(); + ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM).unwrap(); let ssl = Ssl::new(&ctx.build()).unwrap(); let mut stream = ssl.accept(stream).unwrap(); |