Skip to content

Commit

Permalink
Export OPENSSL_NO_* defines in bssl-sys for consumption in rust-openssl
Browse files Browse the repository at this point in the history
This is currently done by duplicating the list of constants. This was done for two reasons: 1) bindgen doesn't seem to do anything with bare-defines, 2) the list of defines appears to change incredibly rarely.

The `links` key is required in `Cargo.toml` to work around rust-lang/cargo#3544

Change-Id: I11dca6e7eb62ab1b04053df654a4061cb5e25723
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63305
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
  • Loading branch information
alex authored and Boringssl LUCI CQ committed Oct 12, 2023
1 parent a014bda commit 8d71d24
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/openssl/opensslconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef OPENSSL_HEADER_OPENSSLCONF_H
#define OPENSSL_HEADER_OPENSSLCONF_H

/* Keep in sync with the list in rust/bssl-sys/build.rs */

#define OPENSSL_NO_ASYNC
#define OPENSSL_NO_BF
Expand Down
4 changes: 4 additions & 0 deletions rust/bssl-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ authors = ["Benjamin Brittain <bwb@google.com>"]
edition = "2018"
publish = false
license = "MIT"

# This exists to workaround a limitation in cargo:
# https://github.com/rust-lang/cargo/issues/3544
links = "bssl"
53 changes: 53 additions & 0 deletions rust/bssl-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,57 @@ use std::env;
use std::path::Path;
use std::path::PathBuf;

// Keep in sync with the list in include/openssl/opensslconf.h
const OSSL_CONF_DEFINES: &[&str] = &[
"OPENSSL_NO_ASYNC",
"OPENSSL_NO_BF",
"OPENSSL_NO_BLAKE2",
"OPENSSL_NO_BUF_FREELISTS",
"OPENSSL_NO_CAMELLIA",
"OPENSSL_NO_CAPIENG",
"OPENSSL_NO_CAST",
"OPENSSL_NO_CMS",
"OPENSSL_NO_COMP",
"OPENSSL_NO_CT",
"OPENSSL_NO_DANE",
"OPENSSL_NO_DEPRECATED",
"OPENSSL_NO_DGRAM",
"OPENSSL_NO_DYNAMIC_ENGINE",
"OPENSSL_NO_EC_NISTP_64_GCC_128",
"OPENSSL_NO_EC2M",
"OPENSSL_NO_EGD",
"OPENSSL_NO_ENGINE",
"OPENSSL_NO_GMP",
"OPENSSL_NO_GOST",
"OPENSSL_NO_HEARTBEATS",
"OPENSSL_NO_HW",
"OPENSSL_NO_IDEA",
"OPENSSL_NO_JPAKE",
"OPENSSL_NO_KRB5",
"OPENSSL_NO_MD2",
"OPENSSL_NO_MDC2",
"OPENSSL_NO_OCB",
"OPENSSL_NO_OCSP",
"OPENSSL_NO_RC2",
"OPENSSL_NO_RC5",
"OPENSSL_NO_RFC3779",
"OPENSSL_NO_RIPEMD",
"OPENSSL_NO_RMD160",
"OPENSSL_NO_SCTP",
"OPENSSL_NO_SEED",
"OPENSSL_NO_SM2",
"OPENSSL_NO_SM3",
"OPENSSL_NO_SM4",
"OPENSSL_NO_SRP",
"OPENSSL_NO_SSL_TRACE",
"OPENSSL_NO_SSL2",
"OPENSSL_NO_SSL3",
"OPENSSL_NO_SSL3_METHOD",
"OPENSSL_NO_STATIC_ENGINE",
"OPENSSL_NO_STORE",
"OPENSSL_NO_WHIRLPOOL",
];

fn get_bssl_build_dir() -> PathBuf {
println!("cargo:rerun-if-env-changed=BORINGSSL_BUILD_DIR");
if let Some(build_dir) = env::var_os("BORINGSSL_BUILD_DIR") {
Expand Down Expand Up @@ -54,4 +105,6 @@ fn main() {
bssl_sys_build_dir.display()
);
println!("cargo:rustc-link-lib=static=rust_wrapper");

println!("cargo:conf={}", OSSL_CONF_DEFINES.join(","));
}

0 comments on commit 8d71d24

Please sign in to comment.