Loading openssl-sys/build/cfgs.rs +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& } else { let openssl_version = openssl_version.unwrap(); if openssl_version >= 0x3_03_00_00_0 { cfgs.push("ossl330"); } if openssl_version >= 0x3_02_00_00_0 { cfgs.push("ossl320"); } Loading openssl-sys/build/main.rs +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ fn main() { println!("cargo:rustc-check-cfg=cfg(ossl300)"); println!("cargo:rustc-check-cfg=cfg(ossl310)"); println!("cargo:rustc-check-cfg=cfg(ossl320)"); println!("cargo:rustc-check-cfg=cfg(ossl330)"); check_ssl_kind(); Loading openssl-sys/build/run_bindgen.rs +8 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ const INCLUDES: &str = " #include <openssl/provider.h> #endif #if OPENSSL_VERSION_NUMBER >= 0x30200000 #include <openssl/quic.h> #endif #if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL) #include <openssl/poly1305.h> #endif Loading @@ -70,8 +74,9 @@ pub fn run(include_dirs: &[PathBuf]) { .rust_target(RustTarget::Stable_1_47) .ctypes_prefix("::libc") .raw_line("use libc::*;") .raw_line("#[cfg(windows)] use std::os::windows::raw::HANDLE;") .raw_line("type evp_pkey_st = EVP_PKEY;") .allowlist_file(".*/openssl/[^/]+\\.h") .allowlist_file(".*[/\\\\]openssl/[^/\\\\]+\\.h") .allowlist_recursively(false) // libc is missing pthread_once_t on macOS .blocklist_type("CRYPTO_ONCE") Loading @@ -85,6 +90,8 @@ pub fn run(include_dirs: &[PathBuf]) { .blocklist_type("OSSL_FUNC_core_vset_error_fn") .blocklist_type("OSSL_FUNC_BIO_vprintf_fn") .blocklist_type("OSSL_FUNC_BIO_vsnprintf_fn") // struct hostent * does not exist on Windows .blocklist_function("BIO_gethostbyname") // Maintain compatibility for existing enum definitions .rustified_enum("point_conversion_form_t") // Maintain compatibility for pre-union definitions Loading openssl-sys/src/bio.rs +44 −0 Original line number Diff line number Diff line Loading @@ -70,3 +70,47 @@ extern "C" { destroy: unsafe extern "C" fn(*mut BIO) -> c_int, ) -> c_int; } cfg_if! { if #[cfg(ossl320)] { use std::ptr; pub const BIO_CTRL_DGRAM_GET_MTU: c_int = 41; pub const BIO_CTRL_DGRAM_SET_MTU: c_int = 42; pub const BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP: c_int = 82; pub const BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE: c_int = 83; pub const BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE: c_int = 84; pub const BIO_CTRL_DGRAM_GET_CAPS: c_int = 86; pub const BIO_CTRL_DGRAM_SET_CAPS: c_int = 87; pub const BIO_CTRL_DGRAM_GET_NO_TRUNC: c_int = 88; pub const BIO_CTRL_DGRAM_SET_NO_TRUNC: c_int = 89; pub unsafe fn BIO_dgram_get_no_trunc(bio: *mut BIO) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_NO_TRUNC, 0, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_set_no_trunc(bio: *mut BIO, enable: c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_NO_TRUNC, enable as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_cap(bio: *mut BIO) -> u32 { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_CAPS, 0, ptr::null_mut()) as u32 } pub unsafe fn BIO_dgram_set_cap(bio: *mut BIO, cap: u32) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_CAPS, cap as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_local_addr_cap(bio: *mut BIO) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP, 0, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_local_addr_enable(bio: *mut BIO, enable: *mut c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE, 0, enable as *mut c_void) as c_int } pub unsafe fn BIO_dgram_set_local_addr_enable(bio: *mut BIO, enable: c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE, enable as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_mtu(bio: *mut BIO) -> c_uint { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_MTU, 0, ptr::null_mut()) as c_uint } pub unsafe fn BIO_dgram_set_mtu(bio: *mut BIO, mtu: c_uint) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_MTU, mtu as c_long, ptr::null_mut()) as c_int } } } openssl-sys/src/err.rs +2 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ pub const ERR_LIB_ASN1: c_int = 13; cfg_if! { if #[cfg(ossl300)] { pub const ERR_SYSTEM_FLAG: c_ulong = c_int::max_value() as c_ulong + 1; pub const ERR_SYSTEM_MASK: c_ulong = c_int::max_value() as c_ulong; pub const ERR_SYSTEM_FLAG: c_ulong = c_int::MAX as c_ulong + 1; pub const ERR_SYSTEM_MASK: c_ulong = c_int::MAX as c_ulong; pub const ERR_LIB_OFFSET: c_ulong = 23; pub const ERR_LIB_MASK: c_ulong = 0xff; Loading Loading
openssl-sys/build/cfgs.rs +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<& } else { let openssl_version = openssl_version.unwrap(); if openssl_version >= 0x3_03_00_00_0 { cfgs.push("ossl330"); } if openssl_version >= 0x3_02_00_00_0 { cfgs.push("ossl320"); } Loading
openssl-sys/build/main.rs +1 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ fn main() { println!("cargo:rustc-check-cfg=cfg(ossl300)"); println!("cargo:rustc-check-cfg=cfg(ossl310)"); println!("cargo:rustc-check-cfg=cfg(ossl320)"); println!("cargo:rustc-check-cfg=cfg(ossl330)"); check_ssl_kind(); Loading
openssl-sys/build/run_bindgen.rs +8 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,10 @@ const INCLUDES: &str = " #include <openssl/provider.h> #endif #if OPENSSL_VERSION_NUMBER >= 0x30200000 #include <openssl/quic.h> #endif #if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL) #include <openssl/poly1305.h> #endif Loading @@ -70,8 +74,9 @@ pub fn run(include_dirs: &[PathBuf]) { .rust_target(RustTarget::Stable_1_47) .ctypes_prefix("::libc") .raw_line("use libc::*;") .raw_line("#[cfg(windows)] use std::os::windows::raw::HANDLE;") .raw_line("type evp_pkey_st = EVP_PKEY;") .allowlist_file(".*/openssl/[^/]+\\.h") .allowlist_file(".*[/\\\\]openssl/[^/\\\\]+\\.h") .allowlist_recursively(false) // libc is missing pthread_once_t on macOS .blocklist_type("CRYPTO_ONCE") Loading @@ -85,6 +90,8 @@ pub fn run(include_dirs: &[PathBuf]) { .blocklist_type("OSSL_FUNC_core_vset_error_fn") .blocklist_type("OSSL_FUNC_BIO_vprintf_fn") .blocklist_type("OSSL_FUNC_BIO_vsnprintf_fn") // struct hostent * does not exist on Windows .blocklist_function("BIO_gethostbyname") // Maintain compatibility for existing enum definitions .rustified_enum("point_conversion_form_t") // Maintain compatibility for pre-union definitions Loading
openssl-sys/src/bio.rs +44 −0 Original line number Diff line number Diff line Loading @@ -70,3 +70,47 @@ extern "C" { destroy: unsafe extern "C" fn(*mut BIO) -> c_int, ) -> c_int; } cfg_if! { if #[cfg(ossl320)] { use std::ptr; pub const BIO_CTRL_DGRAM_GET_MTU: c_int = 41; pub const BIO_CTRL_DGRAM_SET_MTU: c_int = 42; pub const BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP: c_int = 82; pub const BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE: c_int = 83; pub const BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE: c_int = 84; pub const BIO_CTRL_DGRAM_GET_CAPS: c_int = 86; pub const BIO_CTRL_DGRAM_SET_CAPS: c_int = 87; pub const BIO_CTRL_DGRAM_GET_NO_TRUNC: c_int = 88; pub const BIO_CTRL_DGRAM_SET_NO_TRUNC: c_int = 89; pub unsafe fn BIO_dgram_get_no_trunc(bio: *mut BIO) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_NO_TRUNC, 0, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_set_no_trunc(bio: *mut BIO, enable: c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_NO_TRUNC, enable as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_cap(bio: *mut BIO) -> u32 { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_CAPS, 0, ptr::null_mut()) as u32 } pub unsafe fn BIO_dgram_set_cap(bio: *mut BIO, cap: u32) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_CAPS, cap as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_local_addr_cap(bio: *mut BIO) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_LOCAL_ADDR_CAP, 0, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_local_addr_enable(bio: *mut BIO, enable: *mut c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_LOCAL_ADDR_ENABLE, 0, enable as *mut c_void) as c_int } pub unsafe fn BIO_dgram_set_local_addr_enable(bio: *mut BIO, enable: c_int) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_LOCAL_ADDR_ENABLE, enable as c_long, ptr::null_mut()) as c_int } pub unsafe fn BIO_dgram_get_mtu(bio: *mut BIO) -> c_uint { BIO_ctrl(bio, BIO_CTRL_DGRAM_GET_MTU, 0, ptr::null_mut()) as c_uint } pub unsafe fn BIO_dgram_set_mtu(bio: *mut BIO, mtu: c_uint) -> c_int { BIO_ctrl(bio, BIO_CTRL_DGRAM_SET_MTU, mtu as c_long, ptr::null_mut()) as c_int } } }
openssl-sys/src/err.rs +2 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ pub const ERR_LIB_ASN1: c_int = 13; cfg_if! { if #[cfg(ossl300)] { pub const ERR_SYSTEM_FLAG: c_ulong = c_int::max_value() as c_ulong + 1; pub const ERR_SYSTEM_MASK: c_ulong = c_int::max_value() as c_ulong; pub const ERR_SYSTEM_FLAG: c_ulong = c_int::MAX as c_ulong + 1; pub const ERR_SYSTEM_MASK: c_ulong = c_int::MAX as c_ulong; pub const ERR_LIB_OFFSET: c_ulong = 23; pub const ERR_LIB_MASK: c_ulong = 0xff; Loading