Skip to content

Commit f422b9d

Browse files
committed
Merge tag 'v5.0.0'
2 parents a721d89 + d47684d commit f422b9d

Some content is hidden

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

78 files changed

+5217
-8097
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.toml text eol=lf

.github/workflows/ci.yml

Lines changed: 122 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ on:
88
push:
99
branches:
1010
- main
11-
- v4.x
12-
env:
11+
12+
env:
1313
RUSTFLAGS: -Dwarnings
1414
RUST_BACKTRACE: 1
15+
CARGO_INCREMENTAL: 0
16+
CARGO_PROFILE_DEV_DEBUG: 0
1517

1618
jobs:
1719
rustfmt:
@@ -27,44 +29,41 @@ jobs:
2729
clippy:
2830
name: clippy
2931
runs-on: ubuntu-latest
32+
env:
33+
CARGO_HOME: ${{ github.workspace }}/.cache/cargo
3034
steps:
3135
- uses: actions/checkout@v4
3236
with:
3337
submodules: 'recursive'
3438
- name: Install Rust
35-
run: rustup update --no-self-update stable && rustup default stable && rustup component add clippy
39+
run: rustup toolchain add stable --no-self-update --component clippy && rustup default stable
3640
- name: Get rust version
3741
id: rust-version
42+
shell: bash
3843
run: |
3944
echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
4045
- name: Cache cargo index
4146
uses: actions/cache@v4
4247
with:
43-
path: ~/.cargo/registry/index
44-
key: index-${{ runner.os }}-${{ github.run_number }}
45-
restore-keys: |
46-
index-${{ runner.os }}-
47-
- name: Create lockfile
48-
run: cargo generate-lockfile
49-
- name: Cache cargo registry
50-
uses: actions/cache@v4
51-
with:
52-
path: ~/.cargo/registry/cache
53-
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
48+
path: |
49+
.cache/cargo/registry/index
50+
.cache/cargo/registry/cache
51+
key: index-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
52+
enableCrossOsArchive: true
5453
- name: Fetch dependencies
5554
run: cargo fetch
5655
- name: Cache target directory
5756
uses: actions/cache@v4
5857
with:
5958
path: target
60-
key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
59+
key: clippy-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
6160
- name: Run clippy
6261
run: cargo clippy --all --all-targets
6362
- name: Check docs
64-
run: cargo doc --no-deps -p boring -p boring-sys --features rpk,pq-experimental,underscore-wildcards
63+
run: cargo doc --no-deps -p boring -p boring-sys -p hyper-boring -p tokio-boring --features rpk,underscore-wildcards
6564
env:
6665
CARGO_BUILD_RUSTDOCFLAGS: "--cfg=docsrs"
67-
RUST_BOOTSTRAP: 1
66+
RUSTC_BOOTSTRAP: 1
6867
DOCS_RS: 1
6968
- name: Cargo.toml boring versions consistency
7069
shell: bash
@@ -82,6 +81,7 @@ jobs:
8281
matrix:
8382
thing:
8483
- stable
84+
- i686-mingw
8585
- arm-android
8686
- arm64-android
8787
- i686-android
@@ -121,6 +121,8 @@ jobs:
121121
rust: stable
122122
os: ubuntu-latest
123123
check_only: true
124+
custom_env:
125+
CXXFLAGS: -msse2
124126
- thing: x86_64-android
125127
target: x86_64-linux-android
126128
rust: stable
@@ -151,6 +153,8 @@ jobs:
151153
rust: stable
152154
os: ubuntu-latest
153155
apt_packages: gcc-multilib g++-multilib
156+
custom_env:
157+
CXXFLAGS: -msse2
154158
- thing: arm-linux
155159
target: arm-unknown-linux-gnueabi
156160
rust: stable
@@ -191,29 +195,64 @@ jobs:
191195
C_INCLUDE_PATH: "C:\\msys64\\usr\\include"
192196
CPLUS_INCLUDE_PATH: "C:\\msys64\\usr\\include"
193197
LIBRARY_PATH: "C:\\msys64\\usr\\lib"
198+
RUSTC_BOOTSTRAP: 1 # for -Z checksum-freshness
199+
# CI's Windows doesn't have required root certs
200+
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
201+
- thing: i686-mingw
202+
target: i686-pc-windows-gnu
203+
rust: stable
204+
os: windows-latest
205+
check_only: true
206+
custom_env:
207+
RUSTC_BOOTSTRAP: 1 # for -Z checksum-freshness
208+
CMAKE_GENERATOR: "MinGW Makefiles"
209+
COLLECT_GCC: null
194210
# CI's Windows doesn't have required root certs
195-
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring
211+
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
196212
- thing: i686-msvc
197213
target: i686-pc-windows-msvc
198214
rust: stable-x86_64-msvc
199215
os: windows-latest
216+
custom_env:
217+
RUSTC_BOOTSTRAP: 1 # for -Z checksum-freshness
218+
CXXFLAGS: -msse2
200219
# CI's Windows doesn't have required root certs
201-
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring
220+
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
202221
- thing: x86_64-msvc
203222
target: x86_64-pc-windows-msvc
204223
rust: stable-x86_64-msvc
205224
os: windows-latest
225+
custom_env:
226+
RUSTC_BOOTSTRAP: 1 # for -Z checksum-freshness
206227
# CI's Windows doesn't have required root certs
207-
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring
208-
228+
extra_test_args: --workspace --exclude tokio-boring --exclude hyper-boring -Z checksum-freshness
229+
env:
230+
CARGO_HOME: ${{ github.workspace }}/.cache/cargo
231+
CARGO_BUILD_BUILD_DIR: ${{ github.workspace }}/.cache/build-dir
209232
steps:
210233
- uses: actions/checkout@v4
211234
with:
212235
submodules: 'recursive'
213236
- name: Install Rust (rustup)
214-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
237+
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} && rustup target add ${{ matrix.target }}
215238
shell: bash
216-
- run: rustup target add ${{ matrix.target }}
239+
- name: Get rust version
240+
id: rust-version
241+
shell: bash
242+
run: |
243+
echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
244+
- name: Prepopulate cargo index
245+
uses: actions/cache/restore@v4
246+
with:
247+
path: |
248+
.cache/cargo/registry/index
249+
.cache/cargo/registry/cache
250+
key: index-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
251+
enableCrossOsArchive: true
252+
- name: Install golang
253+
uses: actions/setup-go@v5
254+
with:
255+
go-version: '>=1.22.0'
217256
- name: Install target-specific APT dependencies
218257
if: "matrix.apt_packages != ''"
219258
run: sudo apt update && sudo apt install -y ${{ matrix.apt_packages }}
@@ -222,6 +261,32 @@ jobs:
222261
if: startsWith(matrix.os, 'windows')
223262
run: choco install nasm
224263
shell: cmd
264+
- name: Setup 32-bit MSYS2
265+
if: matrix.thing == 'i686-mingw'
266+
uses: msys2/setup-msys2@v2
267+
id: msys2
268+
with:
269+
msystem: MINGW32
270+
path-type: inherit
271+
install: >-
272+
mingw-w64-i686-gcc
273+
mingw-w64-i686-cmake
274+
- name: Setup 32-bit MSYS2 Env vars
275+
if: matrix.thing == 'i686-mingw'
276+
shell: bash
277+
run: |
278+
MSYS_ROOT='${{ steps.msys2.outputs.msys2-location }}'
279+
test -d "$MSYS_ROOT\\mingw32\\bin"
280+
echo >> $GITHUB_PATH "$MSYS_ROOT\\mingw32\\bin"
281+
echo >> $GITHUB_PATH "$MSYS_ROOT\\usr\\bin"
282+
echo >> $GITHUB_ENV CC="$MSYS_ROOT\\mingw32\\bin\\gcc"
283+
echo >> $GITHUB_ENV CXX="$MSYS_ROOT\\mingw32\\bin\\g++"
284+
echo >> $GITHUB_ENV AR="$MSYS_ROOT\\mingw32\\bin\\ar"
285+
echo >> $GITHUB_ENV CFLAGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
286+
echo >> $GITHUB_ENV CXXFLAGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
287+
echo >> $GITHUB_ENV BINDGEN_EXTRA_CLANG_ARGS="-mlong-double-64 -I$MSYS_ROOT\\mingw32\\include"
288+
echo >> $GITHUB_ENV LIBRARY_PATH="$MSYS_ROOT\\mingw32\\lib"
289+
echo >> $GITHUB_ENV LDFLAGS="-L$MSYS_ROOT\\mingw32\\lib"
225290
- name: Install LLVM and Clang
226291
if: startsWith(matrix.os, 'windows')
227292
uses: KyleMayes/install-llvm-action@v1
@@ -234,12 +299,31 @@ jobs:
234299
- name: Set Android Linker path
235300
if: endsWith(matrix.thing, '-android')
236301
run: echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" >> "$GITHUB_ENV"
302+
- name: Fetch deps
303+
run: cargo fetch --target ${{ matrix.target }}
304+
shell: bash
305+
env: ${{ matrix.custom_env }}
306+
# Windows builds are the slowest
307+
- name: Cache deps in Windows tests
308+
if: startsWith(matrix.os, 'windows')
309+
uses: actions/cache/restore@v4
310+
id: test-cache-restore
311+
with:
312+
path: .cache/build-dir
313+
key: wintest-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
237314
- name: Build tests
238315
# We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets.
239-
run: cargo build --target ${{ matrix.target }} --tests ${{ matrix.extra_test_args }}
316+
run: cargo build -vv --target ${{ matrix.target }} --tests ${{ matrix.extra_test_args }}
240317
shell: bash
241318
env: ${{ matrix.custom_env }}
242-
- name: Run tests
319+
# By default it'd be saved after later cargo calls, which already invalidated the cache
320+
- name: Cache deps in Windows tests
321+
if: startsWith(matrix.os, 'windows')
322+
uses: actions/cache/save@v4
323+
with:
324+
path: .cache/build-dir
325+
key: ${{ steps.test-cache-restore.outputs.cache-primary-key }}
326+
- name: Run tests (skip=${{ matrix.check_only }})
243327
if: "!matrix.check_only"
244328
run: cargo test --target ${{ matrix.target }} ${{ matrix.extra_test_args }}
245329
shell: bash
@@ -255,7 +339,9 @@ jobs:
255339
#
256340
# Both of these may no longer be the case after updating the BoringSSL
257341
# submodules to a new revision, so it's important to test this on CI.
258-
run: cargo publish --dry-run -p boring-sys
342+
run: cargo publish --dry-run --target ${{ matrix.target }} -p boring-sys
343+
shell: bash
344+
env: ${{ matrix.custom_env }}
259345

260346
test-fips:
261347
name: Test FIPS integration
@@ -267,18 +353,10 @@ jobs:
267353
- name: Install Rust (rustup)
268354
run: rustup update stable --no-self-update && rustup default stable
269355
shell: bash
270-
- name: Install Clang-12
271-
uses: KyleMayes/install-llvm-action@v1
272-
with:
273-
version: "12.0.0"
274-
directory: ${{ runner.temp }}/llvm
275356
- name: Install golang
276357
uses: actions/setup-go@v5
277358
with:
278359
go-version: '>=1.22.0'
279-
- name: Add clang++-12 link
280-
working-directory: ${{ runner.temp }}/llvm/bin
281-
run: ln -s clang clang++-12
282360
- name: Run tests
283361
run: cargo test --features fips
284362
- name: Test boring-sys cargo publish (FIPS)
@@ -306,21 +384,30 @@ jobs:
306384
with:
307385
submodules: 'recursive'
308386
- name: Install Rust (rustup)
309-
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.target }}
387+
run: rustup toolchain install stable --no-self-update --profile minimal --target ${{ matrix.target }} && rustup default stable
310388
shell: bash
389+
- name: Install golang
390+
uses: actions/setup-go@v5
391+
with:
392+
go-version: '>=1.22.0'
311393
- name: Install ${{ matrix.target }} toolchain
312394
run: brew tap messense/macos-cross-toolchains && brew install ${{ matrix.target }}
313395
- name: Set BORING_BSSL_SYSROOT
314396
run: echo "BORING_BSSL_SYSROOT=$(brew --prefix ${{ matrix.target }})/toolchain/${{ matrix.target }}/sysroot" >> $GITHUB_ENV
315397
shell: bash
316398
- name: Set CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER
317399
run: echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=${{ matrix.target }}-gcc" >> $GITHUB_ENV
400+
shell: bash
401+
- name: Set CXXFLAGS
402+
run: echo "CXXFLAGS=-D__STDC_FORMAT_MACROS" >> $GITHUB_ENV
318403
- name: Build for ${{ matrix.target }}
319404
run: cargo build --target ${{ matrix.target }} --all-targets
320405

321406
test-features:
322407
name: Test features
323408
runs-on: ubuntu-latest
409+
env:
410+
CARGO_INCREMENTAL: 1
324411
steps:
325412
- uses: actions/checkout@v4
326413
with:
@@ -330,19 +417,7 @@ jobs:
330417
shell: bash
331418
- run: cargo test --features rpk
332419
name: Run `rpk` tests
333-
- run: cargo test --features pq-experimental
334-
name: Run `pq-experimental` tests
335420
- run: cargo test --features underscore-wildcards
336421
name: Run `underscore-wildcards` tests
337-
- run: cargo test --features pq-experimental,rpk
338-
name: Run `pq-experimental,rpk` tests
339-
- run: cargo test --features kx-safe-default,pq-experimental
340-
name: Run `kx-safe-default` tests
341-
- run: cargo test --features pq-experimental,underscore-wildcards
342-
name: Run `pq-experimental,underscore-wildcards` tests
343422
- run: cargo test --features rpk,underscore-wildcards
344423
name: Run `rpk,underscore-wildcards` tests
345-
- run: cargo test --features pq-experimental,rpk,underscore-wildcards
346-
name: Run `pq-experimental,rpk,underscore-wildcards` tests
347-
- run: cargo test -p hyper-boring --features hyper1
348-
name: Run hyper 1.0 tests for hyper-boring

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@
22
path = boring-sys/deps/boringssl
33
url = https://github.com/google/boringssl.git
44
ignore = dirty
5-
[submodule "boring-sys/deps/boringssl-fips"]
6-
path = boring-sys/deps/boringssl-fips
7-
url = https://github.com/google/boringssl.git

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ members = [
88
resolver = "2"
99

1010
[workspace.package]
11-
version = "4.21.1"
11+
version = "5.0.0"
12+
rust-version = "1.85"
1213
repository = "https://github.com/cloudflare/boring"
1314
edition = "2021"
1415

@@ -19,9 +20,9 @@ tag-prefix = ""
1920
publish = false
2021

2122
[workspace.dependencies]
22-
boring-sys = { version = "4.21.1", path = "./boring-sys" }
23-
boring = { version = "4.21.1", path = "./boring" }
24-
tokio-boring = { version = "4.21.1", path = "./tokio-boring" }
23+
boring-sys = { version = "5.0.0", path = "./boring-sys" }
24+
boring = { version = "5.0.0", path = "./boring" }
25+
tokio-boring = { version = "5.0.0", path = "./tokio-boring" }
2526

2627
bindgen = { version = "0.72.0", default-features = false, features = ["runtime"] }
2728
bitflags = "2.9"
@@ -40,10 +41,8 @@ anyhow = "1"
4041
antidote = "1.0.0"
4142
http = "1"
4243
http-body-util = "0.1.2"
43-
http_old = { package = "http", version = "0.2" }
4444
hyper = "1"
4545
hyper-util = "0.1.6"
46-
hyper_old = { package = "hyper", version = "0.14", default-features = false }
4746
linked_hash_set = "0.1"
4847
openssl-macros = "0.1.1"
4948
tower = "0.4"

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
[![crates.io](https://img.shields.io/crates/v/boring.svg)](https://crates.io/crates/boring)
44

5-
BoringSSL bindings for the Rust programming language and TLS adapters for [tokio](https://github.com/tokio-rs/tokio)
5+
[BoringSSL](https://boringssl.googlesource.com/boringssl) is Google's fork of OpenSSL for Chrome/Chromium and Android.
6+
7+
This crate provides safe bindings for the Rust programming language and TLS adapters for [tokio](https://github.com/tokio-rs/tokio)
68
and [hyper](https://github.com/hyperium/hyper) built on top of it.
79

810
## Documentation
@@ -11,6 +13,19 @@ and [hyper](https://github.com/hyperium/hyper) built on top of it.
1113
- hyper HTTPS connector: <https://docs.rs/hyper-boring>
1214
- FFI bindings: <https://docs.rs/boring-sys>
1315

16+
# Upgrading from `boring` v4
17+
18+
* First update to boring 4.21 and ensure it builds without any deprecation warnings.
19+
* `pq-experimental` Cargo feature is no longer needed. Post-quantum crypto is enabled by default.
20+
* `fips-precompiled` Cargo feature has been merged into `fips`. Set `BORING_BSSL_FIPS_PATH` env var to use a precompiled library.
21+
* `fips-compat` Cargo feature has been renamed to `legacy-compat-deprecated` (4cb7e260a85b7)
22+
* `SslCurve` and `SslCurveNid` have been removed. Curve names are more stable and portable identifiers. Use `curve_name()` and `set_curves_list()`.
23+
* `Ssl::new_from_ref` -> `Ssl::new()`.
24+
* `X509Builder::append_extension2` -> `X509Builder::append_extension`.
25+
* `X509Store` is now cheaply cloneable, but immutable. `SslContextBuilder.cert_store_mut()` can't be used after `.set_cert_store()`. If you need `.cert_store_mut()`, either don't overwrite the default store, or use `.set_cert_store_builder()`.
26+
* `X509StoreBuilder::add_cert` takes a reference.
27+
* `hyper` 0.x support has been removed. Use `hyper` 1.x.
28+
1429
## Contribution
1530

1631
Unless you explicitly state otherwise, any contribution intentionally

0 commit comments

Comments
 (0)