Skip to content

Commit bcf1b89

Browse files
committed
Remove 'boringssl-vendored' feature
1 parent 492f8ab commit bcf1b89

13 files changed

Lines changed: 60 additions & 1180 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
steps:
2626
- name: Checkout sources
2727
uses: actions/checkout@v4
28-
with:
29-
submodules: 'recursive'
3028

3129
- name: Install nightly toolchain
3230
uses: dtolnay/rust-toolchain@master
@@ -66,14 +64,21 @@ jobs:
6664
6765
fuzz:
6866
runs-on: ubuntu-latest
67+
# `quiche-fuzz` calls `RAND_reset_for_fuzzing`, which BoringSSL only
68+
# exports when built with `FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION`.
69+
# `boring-sys` doesn't expose a feature for that, but cmake-rs (via
70+
# cc-rs) honors `CFLAGS`/`CXXFLAGS`/`ASMFLAGS`, so inject the define
71+
# there. This forces a from-scratch BoringSSL build with the
72+
# fuzzer-mode RNG path enabled.
73+
env:
74+
CFLAGS: "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
75+
CXXFLAGS: "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
6976
# Only run on "pull_request" event for external PRs. This is to avoid
7077
# duplicate builds for PRs created from internal branches.
7178
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
7279
steps:
7380
- name: Checkout sources
7481
uses: actions/checkout@v4
75-
with:
76-
submodules: 'recursive'
7782

7883
- name: Install nightly toolchain
7984
uses: dtolnay/rust-toolchain@master
@@ -100,8 +105,6 @@ jobs:
100105
steps:
101106
- name: Checkout sources
102107
uses: actions/checkout@v4
103-
with:
104-
submodules: 'recursive'
105108

106109
- name: Install nightly toolchain
107110
uses: dtolnay/rust-toolchain@master
@@ -119,8 +122,6 @@ jobs:
119122
steps:
120123
- name: Checkout sources
121124
uses: actions/checkout@v4
122-
with:
123-
submodules: 'recursive'
124125

125126
- name: Install nightly toolchain
126127
uses: dtolnay/rust-toolchain@master

.github/workflows/stable.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
strategy:
2323
matrix:
2424
tls-feature:
25-
- "" # default, boringssl-vendored
2625
- "boringssl-boring-crate"
2726
- "openssl"
2827
# Only run on "pull_request" event for external PRs. This is to avoid
@@ -31,8 +30,6 @@ jobs:
3130
steps:
3231
- name: Checkout sources
3332
uses: actions/checkout@v4
34-
with:
35-
submodules: 'recursive'
3633

3734
- name: Install stable toolchain
3835
uses: dtolnay/rust-toolchain@master
@@ -46,7 +43,7 @@ jobs:
4643
sudo apt-get install libexpat1-dev libfreetype6-dev libfontconfig1-dev
4744
4845
- name: Unused dependency check
49-
if: ${{ matrix.tls-feature == '' }}
46+
if: ${{ matrix.tls-feature == 'boringssl-boring-crate' }}
5047
uses: bnjbvr/cargo-machete@main
5148

5249
- name: Build OpenSSL
@@ -65,10 +62,12 @@ jobs:
6562
run: cargo test --verbose --all-targets --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }}
6663

6764
# tokio-quiche requires the `boring` crate, so don't run its tests when
68-
# building without it.
65+
# building without it. `--no-default-features` disables the
66+
# `boringssl-boring-crate` default so the openssl backend is the only
67+
# TLS backend in the build.
6968
- name: Run cargo test
7069
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
71-
run: cargo test --verbose --all-targets --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
70+
run: cargo test --verbose --all-targets --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
7271

7372
# Need to run doc tests separately.
7473
# (https://github.com/rust-lang/cargo/issues/6669)
@@ -80,10 +79,12 @@ jobs:
8079
# (https://github.com/rust-lang/cargo/issues/6669)
8180
#
8281
# tokio-quiche requires the `boring` crate, so don't run its tests when
83-
# building without it.
82+
# building without it. `--no-default-features` disables the
83+
# `boringssl-boring-crate` default so the openssl backend is the only
84+
# TLS backend in the build.
8485
- name: Run cargo doc test
8586
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
86-
run: cargo test --verbose --doc --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
87+
run: cargo test --verbose --doc --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }}
8788

8889
# NOTE: this is disabled as it fails when building changes that bump
8990
# version of local crates (e.g. when doing a `qlog` release) that have not
@@ -93,11 +94,21 @@ jobs:
9394
# run: cargo package --verbose --workspace --exclude=quiche_apps --allow-dirty
9495

9596
- name: Run cargo clippy
97+
if: ${{ matrix.tls-feature == 'boringssl-boring-crate' }}
9698
run: cargo clippy --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
9799

100+
- name: Run cargo clippy
101+
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
102+
run: cargo clippy --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }} -- -D warnings
103+
98104
- name: Run cargo clippy on examples
105+
if: ${{ matrix.tls-feature == 'boringssl-boring-crate' }}
99106
run: cargo clippy --examples --features=${{ matrix.tls-feature }} ${{ env.DEFAULT_OPTIONS }} -- -D warnings
100107

108+
- name: Run cargo clippy on examples
109+
if: ${{ matrix.tls-feature != 'boringssl-boring-crate' }}
110+
run: cargo clippy --examples --no-default-features --features=${{ matrix.tls-feature }} ${{ env.NO_BORING_OPTIONS }} -- -D warnings
111+
101112
- name: Run cargo doc
102113
run: cargo doc --no-deps --all-features --document-private-items
103114

@@ -119,8 +130,6 @@ jobs:
119130
steps:
120131
- name: Checkout sources
121132
uses: actions/checkout@v4
122-
with:
123-
submodules: 'recursive'
124133

125134
- name: Install stable toolchain
126135
uses: dtolnay/rust-toolchain@master
@@ -148,8 +157,6 @@ jobs:
148157
steps:
149158
- name: Checkout sources
150159
uses: actions/checkout@v4
151-
with:
152-
submodules: 'recursive'
153160

154161
- name: Install stable toolchain
155162
uses: dtolnay/rust-toolchain@master
@@ -192,8 +199,6 @@ jobs:
192199
steps:
193200
- name: Checkout sources
194201
uses: actions/checkout@v4
195-
with:
196-
submodules: 'recursive'
197202

198203
- name: Install stable toolchain
199204
uses: dtolnay/rust-toolchain@master
@@ -275,8 +280,6 @@ jobs:
275280
steps:
276281
- name: Checkout sources
277282
uses: actions/checkout@v4
278-
with:
279-
submodules: 'recursive'
280283

281284
- name: Install stable toolchain
282285
uses: dtolnay/rust-toolchain@master
@@ -290,7 +293,7 @@ jobs:
290293
run: cargo-binstall -y cross
291294

292295
- name: Run cargo test using cross
293-
run: cross test --target=${{ matrix.target }} --verbose --all-targets ${{ env.NO_BORING_OPTIONS }} --exclude qlog-dancer
296+
run: cross test --target=${{ matrix.target }} --verbose --all-targets ${{ env.NO_BORING_OPTIONS }} --exclude qlog-dancer --features=boringssl-boring-crate
294297

295298
http3_test:
296299
runs-on: ubuntu-latest
@@ -300,8 +303,6 @@ jobs:
300303
steps:
301304
- name: Checkout sources
302305
uses: actions/checkout@v4
303-
with:
304-
submodules: 'recursive'
305306

306307
- name: Install stable toolchain
307308
uses: dtolnay/rust-toolchain@master
@@ -323,8 +324,6 @@ jobs:
323324
steps:
324325
- name: Checkout sources
325326
uses: actions/checkout@v4
326-
with:
327-
submodules: 'recursive'
328327

329328
- name: Build Docker images
330329
run: make docker-build
@@ -351,8 +350,6 @@ jobs:
351350
steps:
352351
- name: Checkout sources
353352
uses: actions/checkout@v4
354-
with:
355-
submodules: 'recursive'
356353

357354
- name: Install stable toolchain for the target
358355
uses: dtolnay/rust-toolchain@master

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

AGENTS.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ quiche datagram-socket qlog-dancer (Layer 1)
9898
## FEATURE FLAGS
9999

100100
```
101-
quiche: default=boringssl-vendored | boringssl-boring-crate | openssl
101+
quiche: default=boringssl-boring-crate | openssl
102102
qlog, gcongestion, internal, ffi, fuzzing, sfv, custom-client-dcid
103103
tokio-quiche: fuzzing, quiche_internal, gcongestion, zero-copy, rpk
104104
(hardcodes: quiche/boringssl-boring-crate + quiche/qlog)
@@ -109,12 +109,12 @@ h3i: async (enables tokio-quiche dependency)
109109

110110
```bash
111111
# Dev
112-
cargo build # build workspace (vendored BoringSSL)
112+
cargo build # build workspace (BoringSSL via boring crate)
113113
cargo test --all-targets --features=async,ffi,qlog --workspace # full test suite
114114
cargo test --doc --features=async,ffi,qlog --workspace # doc tests (separate!)
115115

116116
# Lint
117-
cargo clippy --features=boringssl-vendored --workspace -- -D warnings
117+
cargo clippy --features=boringssl-boring-crate --workspace -- -D warnings
118118
cargo +nightly fmt -- --check
119119

120120
# Fuzz
@@ -126,10 +126,9 @@ make docker-build # quiche-base + quiche-qns
126126

127127
## NOTES
128128

129-
- **Git submodules required**: `git submodule update --init --recursive` for BoringSSL.
130129
- **MSRV 1.85**: `rust-version` field in Cargo.toml.
131130
- **Doc tests are separate**: `cargo test --all-targets` does NOT run doc tests (cargo#6669).
132-
- **`QUICHE_BSSL_PATH`**: env var to skip vendored BoringSSL build (use pre-built).
131+
- **BoringSSL via boring crate**: `boring-sys` vendors and builds BoringSSL itself (cmake required).
133132
- **`RUSTFLAGS="-D warnings"`**: CI enforces; all warnings are errors.
134133
- **Cargo.lock is gitignored** (library project).
135134
- **Dual CI**: GitHub Actions (real) + GitLab CI (no-op stub).

Cross.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,14 @@ pre-build = [
2727
"ln -sf /usr/bin/gcc /usr/local/bin/i686-linux-gnu-gcc",
2828
"ln -sf /usr/bin/g++ /usr/local/bin/i686-linux-gnu-g++",
2929
]
30+
31+
# BoringSSL's x86 assembly requires SSE2. `boring-sys`'s cmake build
32+
# doesn't add `-msse2` for i686 targets, so inject it via the
33+
# target-scoped `CFLAGS`/`CXXFLAGS` env vars. `cc-rs` (and through it,
34+
# `cmake-rs`) honors these and passes them along to BoringSSL's cmake
35+
# build.
36+
[target.i686-unknown-linux-gnu.env]
37+
passthrough = [
38+
"CFLAGS_i686_unknown_linux_gnu=-msse2 -mfpmath=sse",
39+
"CXXFLAGS_i686_unknown_linux_gnu=-msse2 -mfpmath=sse",
40+
]

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ COPY quiche/ ./quiche/
1515
COPY task-killswitch ./task-killswitch/
1616
COPY tokio-quiche ./tokio-quiche/
1717

18-
RUN apt-get update && apt-get install -y cmake && rm -rf /var/lib/apt/lists/*
18+
# `cmake` and `clang` are needed by `boring-sys`: it builds BoringSSL via
19+
# cmake and runs `bindgen` (which loads `libclang`) to generate FFI
20+
# bindings.
21+
RUN apt-get update && apt-get install -y cmake clang && rm -rf /var/lib/apt/lists/*
1922

2023
RUN cargo build --release --manifest-path apps/Cargo.toml
2124

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Once the Rust build environment is setup, the quiche source code can be fetched
312312
using git:
313313

314314
```bash
315-
$ git clone --recursive https://github.com/cloudflare/quiche
315+
$ git clone https://github.com/cloudflare/quiche
316316
```
317317

318318
and then built using cargo:
@@ -327,27 +327,18 @@ cargo can also be used to run the testsuite:
327327
$ cargo test
328328
```
329329

330-
Note that [BoringSSL], which is used to implement QUIC's cryptographic handshake
331-
based on TLS, needs to be built and linked to quiche. This is done automatically
332-
when building quiche using cargo, but requires the `cmake` command to be
333-
available during the build process. On Windows you also need
334-
[NASM](https://www.nasm.us/). The [official BoringSSL
335-
documentation](https://github.com/google/boringssl/blob/master/BUILDING.md) has
336-
more details.
337-
338-
In alternative you can use your own custom build of BoringSSL by configuring
339-
the BoringSSL directory with the ``QUICHE_BSSL_PATH`` environment variable:
340-
341-
```bash
342-
$ QUICHE_BSSL_PATH="/path/to/boringssl" cargo build --examples
343-
```
330+
[BoringSSL], which is used to implement QUIC's cryptographic handshake based on
331+
TLS, is provided by the [boring] crate, which vendors and builds its own copy
332+
of BoringSSL automatically when building quiche using cargo.
344333

345334
Alternatively you can use [OpenSSL/quictls]. To enable quiche to use this vendor
346335
the ``openssl`` feature can be added to the ``--feature`` list. Be aware that
347336
``0-RTT`` is not supported if this vendor is used.
348337

349338
[BoringSSL]: https://boringssl.googlesource.com/boringssl/
350339

340+
[boring]: https://crates.io/crates/boring
341+
351342
[OpenSSL/quictls]: https://github.com/quictls/openssl
352343

353344
### Building for Android

quiche/AGENTS.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ src/
3535
minmax.rs Windowed min/max filter
3636
test_utils.rs Pipe struct for in-memory QUIC pairs (pub via `internal` feature)
3737
tests.rs (12k) Integration tests
38-
build.rs BoringSSL cmake build (NOTE: lives in src/, not crate root)
38+
build.rs pkg-config / cdylib link plumbing (NOTE: lives in src/, not crate root)
3939
include/
4040
quiche.h (1.2k) C API header — mirrors ffi.rs
41-
deps/
42-
boringssl/ Git submodule
4341
```
4442

4543
## WHERE TO LOOK
@@ -53,7 +51,7 @@ deps/
5351
| TLS handshake | `tls/mod.rs` — cfg-gated per backend |
5452
| C bindings | `ffi.rs` + `include/quiche.h` |
5553
| Test harness | `test_utils.rs` (`Pipe` struct) |
56-
| Build system | `src/build.rs`BoringSSL cmake, cross-compile params |
54+
| Build system | `src/build.rs`pkg-config + cdylib link plumbing |
5755

5856
## ANTI-PATTERNS
5957

@@ -66,10 +64,9 @@ deps/
6664
## NOTES
6765

6866
- `build.rs` is at `src/build.rs` (Cargo.toml: `build = "src/build.rs"`), not crate root.
69-
- Three TLS backends: `boringssl-vendored` (default), `boringssl-boring-crate`, `openssl` — mutually exclusive features.
67+
- Two TLS backends: `boringssl-boring-crate` (default, via `boring` crate), `openssl` (quictls) — mutually exclusive features.
7068
- `quiche::Error` is `Copy + Clone` — intentional for hot-path ergonomics.
7169
- `test_utils::Pipe` exposed via `internal` feature for downstream crate integration tests.
7270
- Tests use `rstest` with `#[values("cubic", "bbr2_gcongestion")]` parameterization for CC coverage.
73-
- `QUICHE_BSSL_PATH` env var skips vendored BoringSSL build.
7471
- Crate-type: `lib` + `staticlib` + `cdylib` — the latter two for C consumers.
7572
- `BufFactory` trait (`buffers.rs`) enables zero-copy buffer creation; `Connection<F>` is generic over it.

quiche/Cargo.toml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ include = [
1414
"/*.md",
1515
"/*.toml",
1616
"/COPYING",
17-
"/deps/boringssl/**/*.[chS]",
18-
"/deps/boringssl/**/*.asm",
19-
"/deps/boringssl/src/**/*.cc",
20-
"/deps/boringssl/**/CMakeLists.txt",
21-
"/deps/boringssl/**/sources.cmake",
22-
"/deps/boringssl/LICENSE",
2317
"/examples",
2418
"/include",
2519
"/quiche.svg",
@@ -28,24 +22,14 @@ include = [
2822
rust-version = "1.85"
2923

3024
[features]
31-
default = ["boringssl-vendored", "boringssl-pq-patch"]
25+
default = ["boringssl-boring-crate"]
3226

3327
# Allow client connections to provide a custom DCID when initiating a
3428
# connection. Be aware that RFC 9000 places requirements for unpredictability and
3529
# length on the client DCID field. Enabling this feature can be dangerous if these
3630
# requirements are not satisfied.
3731
custom-client-dcid = []
3832

39-
# Build the vendored BoringSSL library.
40-
boringssl-vendored = []
41-
42-
# When building the vendored BoringSSL library, apply a patch that
43-
# enables post-quantum key shares (X25519MLKEM768, P256Kyber768Draft00)
44-
# in the default supported-groups list. This matches what `boring-sys`
45-
# vendors, so behavior is consistent across the two BoringSSL feature
46-
# paths. Has no effect without `boringssl-vendored`.
47-
boringssl-pq-patch = []
48-
4933
# Use the BoringSSL library provided by the boring crate.
5034
boringssl-boring-crate = ["boring", "foreign-types-shared"]
5135

@@ -80,7 +64,6 @@ features = ["boringssl-boring-crate", "qlog", "custom-client-dcid"]
8064
rustdoc-args = ["--cfg", "docsrs"]
8165

8266
[build-dependencies]
83-
cmake = "0.1"
8467
pkg-config = { version = "0.3", optional = true }
8568
cdylib-link-lines = { version = "0.1", optional = true }
8669

quiche/deps/boringssl

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

0 commit comments

Comments
 (0)