Skip to content

Commit 26fcf2b

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

16 files changed

Lines changed: 72 additions & 1185 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: 22 additions & 25 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
@@ -92,12 +93,22 @@ jobs:
9293
# - name: Run cargo package
9394
# run: cargo package --verbose --workspace --exclude=quiche_apps --allow-dirty
9495

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

98-
- name: Run cargo clippy on examples
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+
104+
- name: Run cargo clippy on examples (boring)
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).

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ octets = { version = "0.3.5", path = "./octets" }
5656
parking_lot = { version = "0.12.1", default-features = false }
5757
pin-project = { version = "1.0.12" }
5858
qlog = { version = "0.17.0", path = "./qlog" }
59-
quiche = { version = "0.28.0", path = "./quiche" }
59+
# `default-features = false` so that workspace members can each pick the
60+
# TLS backend they want via their own feature flags. Members that want
61+
# the default backend (`boringssl-boring-crate`) opt back in by adding
62+
# `boringssl-boring-crate` to their feature list.
63+
quiche = { version = "0.28.0", path = "./quiche", default-features = false }
6064
regex = { version = "1.4.2" }
6165
ring = { version = "0.17.8" }
6266
rstest = { version = "0.26.1" }

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

apps/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ qlog = ["quiche/qlog"]
1919
# Use BoringSSL provided by the boring crate.
2020
boringssl-boring-crate = ["quiche/boringssl-boring-crate"]
2121

22+
# Use OpenSSL/quictls.
23+
openssl = ["quiche/openssl"]
24+
2225
# Enable sfv support.
2326
sfv = ["quiche/sfv"]
2427

25-
default = ["qlog", "sfv"]
28+
default = ["qlog", "sfv", "boringssl-boring-crate"]
2629

2730
[dependencies]
2831
docopt = "1"

h3i/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mio = { workspace = true, features = ["net", "os-poll"] }
2525
multimap = "0.10"
2626
octets = { workspace = true }
2727
qlog = { workspace = true }
28-
quiche = { features = ["internal", "qlog"], workspace = true }
28+
quiche = { features = ["boringssl-boring-crate", "internal", "qlog"], workspace = true }
2929
ring = { workspace = true }
3030
serde = { workspace = true }
3131
serde_json = { workspace = true }

0 commit comments

Comments
 (0)