From 7081373c9981d2cfc991b220b9f5b4123e74da39 Mon Sep 17 00:00:00 2001 From: Heraldo Lucena <23155511+HMaker@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:30:34 -0300 Subject: [PATCH] fix bindgen for BoringSSL - remove the -include flag (works for bindgen 0.68+) - fix allowlist-file regex to match Windows' path backslash --- openssl-sys/build/run_bindgen.rs | 20 +++----------------- openssl/src/x509/mod.rs | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/openssl-sys/build/run_bindgen.rs b/openssl-sys/build/run_bindgen.rs index 1eeaad225d..22c8e84ca5 100644 --- a/openssl-sys/build/run_bindgen.rs +++ b/openssl-sys/build/run_bindgen.rs @@ -119,7 +119,7 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { .enable_function_attribute_detection() .default_macro_constant_type(MacroTypeVariation::Signed) .rustified_enum("point_conversion_form_t") - .allowlist_file(".*/openssl/[^/]+\\.h") + .allowlist_file(".*[/\\\\]openssl/[^/]+\\.h") .allowlist_recursively(false) .blocklist_function("BIO_vsnprintf") .blocklist_function("OPENSSL_vasprintf") @@ -148,13 +148,6 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { cc::Build::new() .file(out_dir.join("boring_static_wrapper.c")) .includes(include_dirs) - .flag("-include") - .flag( - &out_dir - .join("boring_static_wrapper.h") - .display() - .to_string(), - ) .compile("boring_static_wrapper"); } @@ -180,8 +173,8 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { .arg("--enable-function-attribute-detection") .arg("--default-macro-constant-type=signed") .arg("--rustified-enum=point_conversion_form_t") - .arg("--allowlist-file=.*/openssl/[^/]+\\.h") - .arg("--no-recursive-allowlist") + .arg("--allowlist-file=.*[/\\\\]openssl/[^/]+\\.h") + .arg("--no-recursive-allowlist") .arg("--blocklist-function=BIO_vsnprintf") .arg("--blocklist-function=OPENSSL_vasprintf") .arg("--experimental") @@ -203,13 +196,6 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { cc::Build::new() .file(out_dir.join("boring_static_wrapper.c")) .includes(include_dirs) - .flag("-include") - .flag( - &out_dir - .join("boring_static_wrapper.h") - .display() - .to_string(), - ) .compile("boring_static_wrapper"); } diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 97242ff4d8..5edc6ce257 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -761,7 +761,7 @@ impl X509 { ffi::PEM_read_bio_X509(bio.as_ptr(), ptr::null_mut(), None, ptr::null_mut()); if r.is_null() { let err = ffi::ERR_peek_last_error(); - if ffi::ERR_GET_LIB(err) as X509LenTy == ffi::ERR_LIB_PEM + if ffi::ERR_GET_LIB(err) as X509LenTy == ffi::ERR_LIB_PEM.try_into().unwrap() && ffi::ERR_GET_REASON(err) == ffi::PEM_R_NO_START_LINE { ffi::ERR_clear_error();