Skip to content

Commit 0ea6760

Browse files
ghedokornelski
authored andcommitted
remove vendored BoringSSL option
We should just use the one provided via boring/boring-sys crates. It should still be possible to build a different BoringSSL version through the facilities provided by those crates.
1 parent f938b0d commit 0ea6760

10 files changed

Lines changed: 26 additions & 253 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434
toolchain: ${{ env.RUSTTOOLCHAIN }}
3535

3636
- name: Run cargo test
37-
run: cargo test --verbose --all-targets --features=boringssl-boring-crate,${{ env.FEATURES }}
37+
run: cargo test --verbose --all-targets --features=${{ env.FEATURES }}
3838

3939
# Need to run doc tests separately.
4040
# (https://github.com/rust-lang/cargo/issues/6669)
4141
- name: Run cargo doc test
42-
run: cargo test --verbose --doc --features=boringssl-boring-crate,${{ env.FEATURES }}
42+
run: cargo test --verbose --doc --features=${{ env.FEATURES }}
4343

4444
# NOTE: this is disabled as it fails when building changes that bump
4545
# version of local crates (e.g. when doing a `qlog` release) that have not

.github/workflows/stable.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
tls-feature:
25-
- "" # default, boringssl-vendored
26-
- "boringssl-boring-crate"
25+
- "" # default
2726
- "openssl"
2827
# Only run on "pull_request" event for external PRs. This is to avoid
2928
# duplicate builds for PRs created from internal branches.
@@ -56,29 +55,29 @@ jobs:
5655
echo "LD_LIBRARY_PATH=$PWD" >> "$GITHUB_ENV"
5756
5857
- name: Run cargo test
59-
if: ${{ matrix.tls-feature == 'boringssl-boring-crate' }}
60-
run: cargo test --verbose --all-targets --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }}
58+
if: ${{ matrix.tls-feature == '' }}
59+
run: cargo test --verbose --all-targets --no-default-features --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }}
6160

6261
# tokio-quiche requires the `boring` crate, so don't run its tests when
6362
# building without it.
6463
- name: Run cargo test
65-
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
66-
run: cargo test --verbose --all-targets --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
64+
if: ${{ matrix.tls-feature != '' }}
65+
run: cargo test --verbose --all-targets --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
6766

6867
# Need to run doc tests separately.
6968
# (https://github.com/rust-lang/cargo/issues/6669)
7069
- name: Run cargo doc test
71-
if: ${{ matrix.tls-feature == 'boringssl-boring-crate' }}
72-
run: cargo test --verbose --doc --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }}
70+
if: ${{ matrix.tls-feature == '' }}
71+
run: cargo test --verbose --doc --no-default-features --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }}
7372

7473
# Need to run doc tests separately.
7574
# (https://github.com/rust-lang/cargo/issues/6669)
7675
#
7776
# tokio-quiche requires the `boring` crate, so don't run its tests when
7877
# building without it.
7978
- name: Run cargo doc test
80-
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
81-
run: cargo test --verbose --doc --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
79+
if: ${{ matrix.tls-feature != '' }}
80+
run: cargo test --verbose --doc --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
8281

8382
# NOTE: this is disabled as it fails when building changes that bump
8483
# version of local crates (e.g. when doing a `qlog` release) that have not
@@ -88,10 +87,10 @@ jobs:
8887
# run: cargo package --verbose --workspace --exclude=quiche_apps --allow-dirty
8988

9089
- name: Run cargo clippy
91-
run: cargo clippy --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
90+
run: cargo clippy --no-default-features --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
9291

9392
- name: Run cargo clippy on examples
94-
run: cargo clippy --examples --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
93+
run: cargo clippy --examples --no-default-features --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
9594

9695
- name: Run cargo doc
9796
run: cargo doc --no-deps --all-features --document-private-items
@@ -199,11 +198,11 @@ jobs:
199198

200199
- name: Run cargo build
201200
if: endsWith(matrix.target, '-gnu')
202-
run: cargo build --target=${{ matrix.target }} --verbose --all-targets ${{ env.DEFAULT_OPTIONS }} --features=boringssl-boring-crate
201+
run: cargo build --target=${{ matrix.target }} --verbose --all-targets ${{ env.DEFAULT_OPTIONS }}
203202

204203
- name: Run cargo test
205204
if: endsWith(matrix.target, '-msvc')
206-
run: cargo test --target=${{ matrix.target }} --verbose --all-targets ${{ env.DEFAULT_OPTIONS }} --features=boringssl-boring-crate
205+
run: cargo test --target=${{ matrix.target }} --verbose --all-targets ${{ env.DEFAULT_OPTIONS }}
207206

208207
quiche_multiarch:
209208
runs-on: ubuntu-latest

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "boringssl"]
2-
path = quiche/deps/boringssl
3-
url = https://github.com/google/boringssl.git
4-
ignore = dirty

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY quiche/ ./quiche/
1313
COPY task-killswitch ./task-killswitch/
1414
COPY tokio-quiche ./tokio-quiche/
1515

16-
RUN apt-get update && apt-get install -y cmake && rm -rf /var/lib/apt/lists/*
16+
RUN apt-get update && apt-get install -y clang cmake && rm -rf /var/lib/apt/lists/*
1717

1818
RUN cargo build --release --manifest-path apps/Cargo.toml
1919

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,17 @@ cargo can also be used to run the testsuite:
328328
Note that [BoringSSL], which is used to implement QUIC's cryptographic handshake
329329
based on TLS, needs to be built and linked to quiche. This is done automatically
330330
when building quiche using cargo, but requires the `cmake` command to be
331-
available during the build process. On Windows you also need
332-
[NASM](https://www.nasm.us/). The [official BoringSSL
331+
available during the build process.
332+
333+
On Windows [NASM](https://www.nasm.us/) is also required. The [official BoringSSL
333334
documentation](https://github.com/google/boringssl/blob/master/BUILDING.md) has
334335
more details.
335336

336-
In alternative you can use your own custom build of BoringSSL by configuring
337-
the BoringSSL directory with the ``QUICHE_BSSL_PATH`` environment variable:
337+
In alternative you can use your own custom build of BoringSSL by configuring the
338+
BoringSSL directory with the ``BORING_BSSL_PATH`` environment variable:
338339

339340
```bash
340-
$ QUICHE_BSSL_PATH="/path/to/boringssl" cargo build --examples
341+
$ BORING_BSSL_PATH="/path/to/boringssl" cargo build --examples
341342
```
342343

343344
Alternatively you can use [OpenSSL/quictls]. To enable quiche to use this vendor

apps/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ fuzzing = ["quiche/fuzzing"]
1616
# Enable qlog support.
1717
qlog = ["quiche/qlog"]
1818

19-
# Use BoringSSL provided by the boring crate.
20-
boringssl-boring-crate = ["quiche/boringssl-boring-crate"]
21-
2219
# Enable sfv support.
2320
sfv = ["quiche/sfv"]
2421

quiche/Cargo.toml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,14 @@ include = [
1515
"/*.md",
1616
"/*.toml",
1717
"/COPYING",
18-
"/deps/boringssl/**/*.[chS]",
19-
"/deps/boringssl/**/*.asm",
20-
"/deps/boringssl/src/**/*.cc",
21-
"/deps/boringssl/**/CMakeLists.txt",
22-
"/deps/boringssl/**/sources.cmake",
23-
"/deps/boringssl/LICENSE",
2418
"/examples",
2519
"/include",
2620
"/quiche.svg",
2721
"/src",
2822
]
2923

3024
[features]
31-
default = ["boringssl-vendored"]
32-
33-
# Build the vendored BoringSSL library.
34-
boringssl-vendored = []
25+
default = ["boringssl-boring-crate"]
3526

3627
# Use the BoringSSL library provided by the boring crate.
3728
boringssl-boring-crate = ["boring", "foreign-types-shared"]
@@ -60,11 +51,10 @@ tag-prefix = ""
6051

6152
[package.metadata.docs.rs]
6253
no-default-features = true
63-
features = ["boringssl-boring-crate", "qlog"]
54+
features = ["qlog"]
6455
rustdoc-args = ["--cfg", "docsrs"]
6556

6657
[build-dependencies]
67-
cmake = "0.1"
6858
pkg-config = { version = "0.3", optional = true }
6959
cdylib-link-lines = { version = "0.1", optional = true }
7060

quiche/deps/boringssl

Lines changed: 0 additions & 1 deletion
This file was deleted.

quiche/src/build.rs

Lines changed: 0 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,3 @@
1-
// Additional parameters for Android build of BoringSSL.
2-
//
3-
// Requires Android NDK >= 19.
4-
const CMAKE_PARAMS_ANDROID_NDK: &[(&str, &[(&str, &str)])] = &[
5-
("aarch64", &[("ANDROID_ABI", "arm64-v8a")]),
6-
("arm", &[("ANDROID_ABI", "armeabi-v7a")]),
7-
("x86", &[("ANDROID_ABI", "x86")]),
8-
("x86_64", &[("ANDROID_ABI", "x86_64")]),
9-
];
10-
11-
// iOS.
12-
const CMAKE_PARAMS_IOS: &[(&str, &[(&str, &str)])] = &[
13-
("aarch64", &[
14-
("CMAKE_OSX_ARCHITECTURES", "arm64"),
15-
("CMAKE_OSX_SYSROOT", "iphoneos"),
16-
]),
17-
("x86_64", &[
18-
("CMAKE_OSX_ARCHITECTURES", "x86_64"),
19-
("CMAKE_OSX_SYSROOT", "iphonesimulator"),
20-
]),
21-
];
22-
23-
// ARM Linux.
24-
const CMAKE_PARAMS_ARM_LINUX: &[(&str, &[(&str, &str)])] = &[
25-
("aarch64", &[("CMAKE_SYSTEM_PROCESSOR", "aarch64")]),
26-
("arm", &[("CMAKE_SYSTEM_PROCESSOR", "arm")]),
27-
];
28-
29-
/// Returns the platform-specific output path for lib.
30-
///
31-
/// MSVC generator on Windows place static libs in a target sub-folder,
32-
/// so adjust library location based on platform and build target.
33-
/// See issue: https://github.com/alexcrichton/cmake-rs/issues/18
34-
fn get_boringssl_platform_output_path() -> String {
35-
if cfg!(target_env = "msvc") {
36-
// Code under this branch should match the logic in cmake-rs
37-
let debug_env_var =
38-
std::env::var("DEBUG").expect("DEBUG variable not defined in env");
39-
40-
let deb_info = match &debug_env_var[..] {
41-
"false" => false,
42-
"true" => true,
43-
unknown => panic!("Unknown DEBUG={unknown} env var."),
44-
};
45-
46-
let opt_env_var = std::env::var("OPT_LEVEL")
47-
.expect("OPT_LEVEL variable not defined in env");
48-
49-
let subdir = match &opt_env_var[..] {
50-
"0" => "Debug",
51-
"1" | "2" | "3" =>
52-
if deb_info {
53-
"RelWithDebInfo"
54-
} else {
55-
"Release"
56-
},
57-
"s" | "z" => "MinSizeRel",
58-
unknown => panic!("Unknown OPT_LEVEL={unknown} env var."),
59-
};
60-
61-
subdir.to_string()
62-
} else {
63-
"".to_string()
64-
}
65-
}
66-
67-
/// Returns a new cmake::Config for building BoringSSL.
68-
///
69-
/// It will add platform-specific parameters if needed.
70-
fn get_boringssl_cmake_config() -> cmake::Config {
71-
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
72-
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
73-
let pwd = std::env::current_dir().unwrap();
74-
75-
let mut boringssl_cmake = cmake::Config::new("deps/boringssl");
76-
77-
// Add platform-specific parameters.
78-
match os.as_ref() {
79-
"android" => {
80-
// We need ANDROID_NDK_HOME to be set properly.
81-
let android_ndk_home = std::env::var("ANDROID_NDK_HOME")
82-
.expect("Please set ANDROID_NDK_HOME for Android build");
83-
let android_ndk_home = std::path::Path::new(&android_ndk_home);
84-
for (android_arch, params) in CMAKE_PARAMS_ANDROID_NDK {
85-
if *android_arch == arch {
86-
for (name, value) in *params {
87-
boringssl_cmake.define(name, value);
88-
}
89-
}
90-
}
91-
let toolchain_file =
92-
android_ndk_home.join("build/cmake/android.toolchain.cmake");
93-
let toolchain_file = toolchain_file.to_str().unwrap();
94-
boringssl_cmake.define("CMAKE_TOOLCHAIN_FILE", toolchain_file);
95-
96-
// 21 is the minimum level tested. You can give higher value.
97-
boringssl_cmake.define("ANDROID_NATIVE_API_LEVEL", "21");
98-
boringssl_cmake.define("ANDROID_STL", "c++_shared");
99-
100-
boringssl_cmake
101-
},
102-
103-
"ios" => {
104-
for (ios_arch, params) in CMAKE_PARAMS_IOS {
105-
if *ios_arch == arch {
106-
for (name, value) in *params {
107-
boringssl_cmake.define(name, value);
108-
}
109-
}
110-
}
111-
112-
// Bitcode is always on.
113-
let bitcode_cflag = "-fembed-bitcode";
114-
115-
// Hack for Xcode 10.1.
116-
let target_cflag = if arch == "x86_64" {
117-
"-target x86_64-apple-ios-simulator"
118-
} else {
119-
""
120-
};
121-
122-
let cflag = format!("{bitcode_cflag} {target_cflag}");
123-
124-
boringssl_cmake.define("CMAKE_ASM_FLAGS", &cflag);
125-
boringssl_cmake.cflag(&cflag);
126-
127-
boringssl_cmake
128-
},
129-
130-
"linux" => match arch.as_ref() {
131-
"aarch64" | "arm" => {
132-
for (arm_arch, params) in CMAKE_PARAMS_ARM_LINUX {
133-
if *arm_arch == arch {
134-
for (name, value) in *params {
135-
boringssl_cmake.define(name, value);
136-
}
137-
}
138-
}
139-
boringssl_cmake.define("CMAKE_SYSTEM_NAME", "Linux");
140-
boringssl_cmake.define("CMAKE_SYSTEM_VERSION", "1");
141-
142-
boringssl_cmake
143-
},
144-
145-
"x86" => {
146-
boringssl_cmake.define(
147-
"CMAKE_TOOLCHAIN_FILE",
148-
pwd.join("deps/boringssl/src/util/32-bit-toolchain.cmake")
149-
.as_os_str(),
150-
);
151-
152-
boringssl_cmake
153-
},
154-
155-
_ => boringssl_cmake,
156-
},
157-
158-
_ => {
159-
// Configure BoringSSL for building on 32-bit non-windows platforms.
160-
if arch == "x86" && os != "windows" {
161-
boringssl_cmake.define(
162-
"CMAKE_TOOLCHAIN_FILE",
163-
pwd.join("deps/boringssl/src/util/32-bit-toolchain.cmake")
164-
.as_os_str(),
165-
);
166-
}
167-
168-
boringssl_cmake
169-
},
170-
}
171-
}
172-
1731
fn write_pkg_config() {
1742
use std::io::prelude::*;
1753

@@ -216,40 +44,6 @@ fn target_dir_path() -> std::path::PathBuf {
21644
}
21745

21846
fn main() {
219-
if cfg!(feature = "boringssl-vendored") &&
220-
!cfg!(feature = "boringssl-boring-crate") &&
221-
!cfg!(feature = "openssl")
222-
{
223-
let bssl_dir = std::env::var("QUICHE_BSSL_PATH").unwrap_or_else(|_| {
224-
let mut cfg = get_boringssl_cmake_config();
225-
226-
if cfg!(feature = "fuzzing") {
227-
cfg.cxxflag("-DBORINGSSL_UNSAFE_DETERMINISTIC_MODE")
228-
.cxxflag("-DBORINGSSL_UNSAFE_FUZZER_MODE");
229-
}
230-
231-
cfg.build_target("ssl").build();
232-
cfg.build_target("crypto").build().display().to_string()
233-
});
234-
235-
println!("cargo:rustc-link-arg=-Wl,-rpath,{bssl_dir}");
236-
237-
let build_path = get_boringssl_platform_output_path();
238-
let mut build_dir = format!("{bssl_dir}/build/{build_path}");
239-
240-
// If build directory doesn't exist, use the specified path as is.
241-
if !std::path::Path::new(&build_dir).is_dir() {
242-
build_dir = bssl_dir;
243-
}
244-
245-
println!("cargo:rustc-link-search=native={build_dir}");
246-
247-
let bssl_link_kind = std::env::var("QUICHE_BSSL_LINK_KIND")
248-
.unwrap_or("static".to_string());
249-
println!("cargo:rustc-link-lib={bssl_link_kind}=ssl");
250-
println!("cargo:rustc-link-lib={bssl_link_kind}=crypto");
251-
}
252-
25347
if cfg!(feature = "boringssl-boring-crate") {
25448
println!("cargo:rustc-link-lib=static=ssl");
25549
println!("cargo:rustc-link-lib=static=crypto");

0 commit comments

Comments
 (0)