Skip to content

Commit a9f368d

Browse files
benbrittainmaurer
andcommitted
Adds support for linking against boringssl
The boringssl-sys crate is specific to the revision of boringssl you are using, so you will need to generate it from a boringssl build tree and point the openssl crate at it via cargo source replacement, or place the build tree next to rust-openssl while building. Co-authored-by: Matthew Maurer <[email protected]>
1 parent f8c321f commit a9f368d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+845
-477
lines changed

openssl-sys/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ build = "build/main.rs"
1515

1616
[features]
1717
vendored = ['openssl-src']
18+
unstable_boringssl = ['bssl-sys']
1819

1920
[dependencies]
2021
libc = "0.2"
22+
bssl-sys = { version = "0.1.0", optional = true }
2123

2224
[build-dependencies]
2325
bindgen = { version = "0.59.2", optional = true }

openssl-sys/build/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,21 @@ fn find_openssl(target: &str) -> (Vec<PathBuf>, PathBuf) {
6060
find_normal::get_openssl(target)
6161
}
6262

63+
fn check_ssl_kind() {
64+
if cfg!(feature = "unstable_boringssl") {
65+
println!("cargo:rustc-cfg=boringssl");
66+
// BoringSSL does not have any build logic, exit early
67+
std::process::exit(0);
68+
} else {
69+
println!("cargo:rustc-cfg=openssl");
70+
}
71+
}
72+
6373
fn main() {
6474
check_rustc_versions();
6575

76+
check_ssl_kind();
77+
6678
let target = env::var("TARGET").unwrap();
6779

6880
let (lib_dirs, include_dir) = find_openssl(&target);

openssl-sys/src/handwritten/mod.rs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
pub use handwritten::aes::*;
2-
pub use handwritten::asn1::*;
3-
pub use handwritten::bio::*;
4-
pub use handwritten::bn::*;
5-
pub use handwritten::cms::*;
6-
pub use handwritten::conf::*;
7-
pub use handwritten::crypto::*;
8-
pub use handwritten::dh::*;
9-
pub use handwritten::dsa::*;
10-
pub use handwritten::ec::*;
11-
pub use handwritten::err::*;
12-
pub use handwritten::evp::*;
13-
pub use handwritten::hmac::*;
14-
pub use handwritten::kdf::*;
15-
pub use handwritten::object::*;
16-
pub use handwritten::ocsp::*;
17-
pub use handwritten::pem::*;
18-
pub use handwritten::pkcs12::*;
19-
pub use handwritten::pkcs7::*;
20-
pub use handwritten::provider::*;
21-
pub use handwritten::rand::*;
22-
pub use handwritten::rsa::*;
23-
pub use handwritten::safestack::*;
24-
pub use handwritten::sha::*;
25-
pub use handwritten::srtp::*;
26-
pub use handwritten::ssl::*;
27-
pub use handwritten::stack::*;
28-
pub use handwritten::tls1::*;
29-
pub use handwritten::types::*;
30-
pub use handwritten::x509::*;
31-
pub use handwritten::x509_vfy::*;
32-
pub use handwritten::x509v3::*;
1+
pub use self::aes::*;
2+
pub use self::asn1::*;
3+
pub use self::bio::*;
4+
pub use self::bn::*;
5+
pub use self::cms::*;
6+
pub use self::conf::*;
7+
pub use self::crypto::*;
8+
pub use self::dh::*;
9+
pub use self::dsa::*;
10+
pub use self::ec::*;
11+
pub use self::err::*;
12+
pub use self::evp::*;
13+
pub use self::hmac::*;
14+
pub use self::kdf::*;
15+
pub use self::object::*;
16+
pub use self::ocsp::*;
17+
pub use self::pem::*;
18+
pub use self::pkcs12::*;
19+
pub use self::pkcs7::*;
20+
pub use self::provider::*;
21+
pub use self::rand::*;
22+
pub use self::rsa::*;
23+
pub use self::safestack::*;
24+
pub use self::sha::*;
25+
pub use self::srtp::*;
26+
pub use self::ssl::*;
27+
pub use self::stack::*;
28+
pub use self::tls1::*;
29+
pub use self::types::*;
30+
pub use self::x509::*;
31+
pub use self::x509_vfy::*;
32+
pub use self::x509v3::*;
3333

3434
mod aes;
3535
mod asn1;

0 commit comments

Comments
 (0)