Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ schannel = "0.1.17"

[target.'cfg(not(any(target_os = "windows", target_vendor = "apple")))'.dependencies]
log = "0.4.5"
openssl = "0.10.46"
openssl = "0.10.69"
openssl-sys = "0.9.81"
openssl-probe = "0.1"

Expand Down
12 changes: 4 additions & 8 deletions src/imp/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use self::openssl::x509::{store::X509StoreBuilder, X509VerifyResult, X509};
use std::error;
use std::fmt;
use std::io;
use std::sync::Once;

use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};

Expand Down Expand Up @@ -85,11 +84,6 @@ fn supported_protocols(
Ok(())
}

fn init_trust() {
static ONCE: Once = Once::new();
ONCE.call_once(openssl_probe::init_ssl_cert_env_vars);
}

#[cfg(target_os = "android")]
fn load_android_root_certs(connector: &mut SslContextBuilder) -> Result<(), Error> {
use std::fs;
Expand Down Expand Up @@ -272,9 +266,11 @@ pub struct TlsConnector {

impl TlsConnector {
pub fn new(builder: &TlsConnectorBuilder) -> Result<TlsConnector, Error> {
init_trust();

let mut connector = SslConnector::builder(SslMethod::tls())?;

let probe = openssl_probe::probe();
connector.load_verify_locations(probe.cert_file.as_deref(), probe.cert_dir.as_deref())?;

if let Some(ref identity) = builder.identity {
connector.set_certificate(&identity.0.cert)?;
connector.set_private_key(&identity.0.pkey)?;
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ use std::fmt;
use std::io;
use std::result;

#[cfg(not(any(target_os = "windows", target_vendor = "apple",)))]
#[cfg(not(any(target_os = "windows", target_vendor = "apple")))]
#[macro_use]
extern crate log;
#[cfg(any(target_vendor = "apple",))]
#[cfg(target_vendor = "apple")]
#[path = "imp/security_framework.rs"]
mod imp;
#[cfg(target_os = "windows")]
#[path = "imp/schannel.rs"]
mod imp;
#[cfg(not(any(target_vendor = "apple", target_os = "windows",)))]
#[cfg(not(any(target_vendor = "apple", target_os = "windows")))]
#[path = "imp/openssl.rs"]
mod imp;

Expand Down
Loading