Skip to content

Commit

Permalink
fix bindgen for BoringSSL
Browse files Browse the repository at this point in the history
- remove the -include flag (works for bindgen 0.68+)
- fix allowlist-file regex to match Windows' path backslash
  • Loading branch information
HMaker committed Nov 5, 2023
1 parent 6568376 commit 7081373
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
20 changes: 3 additions & 17 deletions openssl-sys/build/run_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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");
}

Expand All @@ -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")
Expand All @@ -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");
}

Expand Down
2 changes: 1 addition & 1 deletion openssl/src/x509/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7081373

Please sign in to comment.