Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ossl3 thread pool bindings #2293

Merged
merged 1 commit into from
Sep 1, 2024
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 openssl-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn check_ssl_kind() {
}

fn main() {
println!("cargo:rustc-check-cfg=cfg(osslconf, values(\"OPENSSL_NO_OCB\", \"OPENSSL_NO_SM4\", \"OPENSSL_NO_SEED\", \"OPENSSL_NO_CHACHA\", \"OPENSSL_NO_CAST\", \"OPENSSL_NO_IDEA\", \"OPENSSL_NO_CAMELLIA\", \"OPENSSL_NO_RC4\", \"OPENSSL_NO_BF\", \"OPENSSL_NO_PSK\", \"OPENSSL_NO_DEPRECATED_3_0\", \"OPENSSL_NO_SCRYPT\", \"OPENSSL_NO_SM3\", \"OPENSSL_NO_RMD160\", \"OPENSSL_NO_EC2M\", \"OPENSSL_NO_OCSP\", \"OPENSSL_NO_CMS\", \"OPENSSL_NO_COMP\", \"OPENSSL_NO_SOCK\", \"OPENSSL_NO_STDIO\", \"OPENSSL_NO_EC\", \"OPENSSL_NO_SSL3_METHOD\", \"OPENSSL_NO_KRB5\", \"OPENSSL_NO_TLSEXT\", \"OPENSSL_NO_SRP\", \"OPENSSL_NO_RFC3779\", \"OPENSSL_NO_SHA\", \"OPENSSL_NO_NEXTPROTONEG\", \"OPENSSL_NO_ENGINE\", \"OPENSSL_NO_BUF_FREELISTS\"))");
println!("cargo:rustc-check-cfg=cfg(osslconf, values(\"OPENSSL_THREADS\", \"OPENSSL_NO_OCB\", \"OPENSSL_NO_SM4\", \"OPENSSL_NO_SEED\", \"OPENSSL_NO_CHACHA\", \"OPENSSL_NO_CAST\", \"OPENSSL_NO_IDEA\", \"OPENSSL_NO_CAMELLIA\", \"OPENSSL_NO_RC4\", \"OPENSSL_NO_BF\", \"OPENSSL_NO_PSK\", \"OPENSSL_NO_DEPRECATED_3_0\", \"OPENSSL_NO_SCRYPT\", \"OPENSSL_NO_SM3\", \"OPENSSL_NO_RMD160\", \"OPENSSL_NO_EC2M\", \"OPENSSL_NO_OCSP\", \"OPENSSL_NO_CMS\", \"OPENSSL_NO_COMP\", \"OPENSSL_NO_SOCK\", \"OPENSSL_NO_STDIO\", \"OPENSSL_NO_EC\", \"OPENSSL_NO_SSL3_METHOD\", \"OPENSSL_NO_KRB5\", \"OPENSSL_NO_TLSEXT\", \"OPENSSL_NO_SRP\", \"OPENSSL_NO_RFC3779\", \"OPENSSL_NO_SHA\", \"OPENSSL_NO_NEXTPROTONEG\", \"OPENSSL_NO_ENGINE\", \"OPENSSL_NO_BUF_FREELISTS\"))");

println!("cargo:rustc-check-cfg=cfg(openssl)");
println!("cargo:rustc-check-cfg=cfg(libressl)");
Expand Down
4 changes: 4 additions & 0 deletions openssl-sys/build/run_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ const INCLUDES: &str = "
#if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL)
#include <openssl/poly1305.h>
#endif

#if OPENSSL_VERSION_NUMBER >= 0x30200000 && defined(OPENSSL_THREADS)
#include <openssl/thread.h>
#endif
";

#[cfg(feature = "bindgen")]
Expand Down
4 changes: 4 additions & 0 deletions openssl-sys/src/handwritten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub use self::sha::*;
pub use self::srtp::*;
pub use self::ssl::*;
pub use self::stack::*;
#[cfg(all(ossl320, osslconf = "OPENSSL_THREADS"))]
pub use self::thread::*;
pub use self::tls1::*;
pub use self::types::*;
pub use self::x509::*;
Expand Down Expand Up @@ -66,6 +68,8 @@ mod sha;
mod srtp;
mod ssl;
mod stack;
#[cfg(all(ossl320, osslconf = "OPENSSL_THREADS"))]
mod thread;
mod tls1;
mod types;
mod x509;
Expand Down
7 changes: 7 additions & 0 deletions openssl-sys/src/handwritten/thread.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use super::super::*;
use libc::*;

extern "C" {
pub fn OSSL_set_max_threads(ctx: *mut OSSL_LIB_CTX, max_threads: u64) -> c_int;
pub fn OSSL_get_max_threads(ctx: *mut OSSL_LIB_CTX) -> u64;
}
4 changes: 4 additions & 0 deletions systest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ fn main() {
if version >= 0x30000000 {
cfg.header("openssl/provider.h");
}
if version >= 0x30200000 {
// thread is present as a header even if OPENSSL_THREADS is not defined
cfg.header("openssl/thread.h");
}
}

#[allow(clippy::if_same_then_else)]
Expand Down