From 40e66bab6b532e3a0e496eaa74c4553b051037a9 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 7 Apr 2020 17:05:38 -0700 Subject: [PATCH 1/3] Add SslContextBuilder::set_cert_store --- openssl-sys/src/ssl.rs | 1 + openssl/src/ssl/mod.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/openssl-sys/src/ssl.rs b/openssl-sys/src/ssl.rs index f2e1bc47..1d76159d 100644 --- a/openssl-sys/src/ssl.rs +++ b/openssl-sys/src/ssl.rs @@ -901,6 +901,7 @@ extern "C" { #[cfg(any(ossl110, libressl273))] pub fn SSL_CTX_up_ref(x: *mut SSL_CTX) -> c_int; pub fn SSL_CTX_get_cert_store(ctx: *const SSL_CTX) -> *mut X509_STORE; + pub fn SSL_CTX_set_cert_store(ctx: *mut SSL_CTX, store: *mut X509_STORE); pub fn SSL_get_current_cipher(ssl: *const SSL) -> *const SSL_CIPHER; pub fn SSL_CIPHER_get_bits(cipher: *const SSL_CIPHER, alg_bits: *mut c_int) -> c_int; diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 8d81062c..82198c5f 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -762,6 +762,18 @@ impl SslContextBuilder { } } + /// Replaces the context's certificate store. + /// + /// This corresponds to [`SSL_CTX_set_cert_store`]. + /// + /// [`SSL_CTX_set_cert_store`]: https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_set_cert_store.html + pub fn set_cert_store(&mut self, cert_store: X509Store) { + unsafe { + ffi::SSL_CTX_set_cert_store(self.as_ptr(), cert_store.as_ptr()); + mem::forget(cert_store); + } + } + /// Controls read ahead behavior. /// /// If enabled, OpenSSL will read as much data as is available from the underlying stream, From df03bbf5b80f17f3e01d0be57cd98e4237fa22b0 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 7 Apr 2020 17:19:32 -0700 Subject: [PATCH 2/3] Deal with upstream archive location change --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f0f2dba9..aed422c1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,6 +8,9 @@ jobs: library: type: string default: "" + dl_path: + type: string + default: "" version: type: string default: "" @@ -71,7 +74,7 @@ jobs: URL="https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-<< parameters.version >>.tar.gz" ;; "openssl") - URL="https://openssl.org/source/openssl-<< parameters.version >>.tar.gz" + URL="https://openssl.org/source<< parameters.dl_path >>/openssl-<< parameters.version >>.tar.gz" ;; esac @@ -210,12 +213,15 @@ openssl_111: &openssl_111 openssl_110: &openssl_110 library: openssl version: 1.1.0l + dl_path: /old/1.1.0 openssl_102: &openssl_102 library: openssl version: 1.0.2u + dl_path: /old/1.0.2 openssl_101: &openssl_101 library: openssl version: 1.0.1u + dl_path: /old/1.0.1 workflows: test: From 1ed175f85f01726bd129b0d879b1c837c21552de Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 7 Apr 2020 17:39:56 -0700 Subject: [PATCH 3/3] FIx build --- openssl/src/ssl/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openssl/src/ssl/mod.rs b/openssl/src/ssl/mod.rs index 82198c5f..38d395c7 100644 --- a/openssl/src/ssl/mod.rs +++ b/openssl/src/ssl/mod.rs @@ -93,9 +93,7 @@ use ssl::bio::BioMethod; use ssl::callbacks::*; use ssl::error::InnerError; use stack::{Stack, StackRef}; -#[cfg(ossl102)] -use x509::store::X509Store; -use x509::store::{X509StoreBuilderRef, X509StoreRef}; +use x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef}; #[cfg(any(ossl102, libressl261))] use x509::verify::X509VerifyParamRef; use x509::{X509Name, X509Ref, X509StoreContextRef, X509VerifyResult, X509};