Skip to content

Commit a721d89

Browse files
committed
Merge in upstream v4.21.1
2 parents 81d4aa1 + 395f578 commit a721d89

File tree

30 files changed

+490
-298
lines changed

30 files changed

+490
-298
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ on:
44
pull_request:
55
branches:
66
- main
7+
- v4.x
78
push:
89
branches:
910
- main
10-
11+
- v4.x
1112
env:
1213
RUSTFLAGS: -Dwarnings
1314
RUST_BACKTRACE: 1
@@ -18,8 +19,8 @@ jobs:
1819
runs-on: ubuntu-latest
1920
steps:
2021
- uses: actions/checkout@v4
21-
- name: Install Rust
22-
run: rustup update stable && rustup default stable
22+
- name: Install Rustfmt
23+
run: rustup default stable && rustup component add rustfmt
2324
- name: Check formatting
2425
run: cargo fmt --all -- --check
2526

@@ -31,10 +32,11 @@ jobs:
3132
with:
3233
submodules: 'recursive'
3334
- name: Install Rust
34-
run: rustup update stable && rustup default stable
35+
run: rustup update --no-self-update stable && rustup default stable && rustup component add clippy
3536
- name: Get rust version
3637
id: rust-version
37-
run: echo "::set-output name=version::$(rustc --version)"
38+
run: |
39+
echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
3840
- name: Cache cargo index
3941
uses: actions/cache@v4
4042
with:
@@ -58,6 +60,21 @@ jobs:
5860
key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
5961
- name: Run clippy
6062
run: cargo clippy --all --all-targets
63+
- name: Check docs
64+
run: cargo doc --no-deps -p boring -p boring-sys --features rpk,pq-experimental,underscore-wildcards
65+
env:
66+
CARGO_BUILD_RUSTDOCFLAGS: "--cfg=docsrs"
67+
RUST_BOOTSTRAP: 1
68+
DOCS_RS: 1
69+
- name: Cargo.toml boring versions consistency
70+
shell: bash
71+
run: |
72+
WORKSPACE_VERSION=$(grep -F '[workspace.package]' -A1 Cargo.toml | grep -F version | grep -Eo '".*"')
73+
if [[ -z "$WORKSPACE_VERSION" ]]; then echo 2>&1 "error: can't find boring version"; exit 1; fi
74+
if grep -E 'boring.* =' Cargo.toml | grep -vF "$WORKSPACE_VERSION"; then
75+
echo 2>&1 "error: boring dependencies must match workspace version $WORKSPACE_VERSION"
76+
exit 1
77+
fi
6178
test:
6279
name: Test
6380
runs-on: ${{ matrix.os }}
@@ -141,8 +158,8 @@ jobs:
141158
apt_packages: gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
142159
check_only: true
143160
custom_env:
144-
CC: arm-linux-gnueabi-gcc
145-
CXX: arm-linux-gnueabi-g++
161+
CC_arm-unknown-linux-gnueabi: arm-linux-gnueabi-gcc
162+
CXX_arm-unknown-linux-gnueabi: arm-linux-gnueabi-g++
146163
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER: arm-linux-gnueabi-g++
147164
- thing: aarch64-linux
148165
target: aarch64-unknown-linux-gnu
@@ -151,8 +168,8 @@ jobs:
151168
apt_packages: crossbuild-essential-arm64
152169
check_only: true
153170
custom_env:
154-
CC: aarch64-linux-gnu-gcc
155-
CXX: aarch64-linux-gnu-g++
171+
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
172+
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
156173
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++
157174
- thing: arm64-macos
158175
target: aarch64-apple-darwin
@@ -301,45 +318,6 @@ jobs:
301318
- name: Build for ${{ matrix.target }}
302319
run: cargo build --target ${{ matrix.target }} --all-targets
303320

304-
cross-build-fips:
305-
name: Cross build from macOS to Linux (FIPS)
306-
runs-on: macos-13 # Need an Intel (x86_64) runner for Clang 12.0.0
307-
strategy:
308-
matrix:
309-
include:
310-
- target: x86_64-unknown-linux-gnu
311-
steps:
312-
- uses: actions/checkout@v4
313-
with:
314-
submodules: 'recursive'
315-
- name: Install Rust (rustup)
316-
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.target }}
317-
shell: bash
318-
- name: Install golang
319-
uses: actions/setup-go@v5
320-
with:
321-
go-version: '>=1.22.0'
322-
- name: Install ${{ matrix.target }} toolchain
323-
run: brew tap messense/macos-cross-toolchains && brew install ${{ matrix.target }} && brew link x86_64-unknown-linux-gnu
324-
- name: Install Clang-12
325-
uses: KyleMayes/install-llvm-action@v1
326-
with:
327-
version: "12.0.0"
328-
directory: ${{ runner.temp }}/llvm
329-
- name: Add clang++-12 link
330-
working-directory: ${{ runner.temp }}/llvm/bin
331-
run: ln -s clang++ clang++-12
332-
- name: Set BORING_BSSL_FIPS_COMPILER_EXTERNAL_TOOLCHAIN
333-
run: echo "BORING_BSSL_FIPS_COMPILER_EXTERNAL_TOOLCHAIN=$(brew --prefix ${{ matrix.target }})/toolchain" >> $GITHUB_ENV
334-
shell: bash
335-
- name: Set BORING_BSSL_FIPS_SYSROOT
336-
run: echo "BORING_BSSL_FIPS_SYSROOT=$BORING_BSSL_FIPS_COMPILER_EXTERNAL_TOOLCHAIN/${{ matrix.target }}/sysroot" >> $GITHUB_ENV
337-
shell: bash
338-
- name: Set CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER
339-
run: echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=${{ matrix.target }}-gcc" >> $GITHUB_ENV
340-
- name: Build for ${{ matrix.target }}
341-
run: cargo build --target ${{ matrix.target }} --all-targets --features fips
342-
343321
test-features:
344322
name: Test features
345323
runs-on: ubuntu-latest

Cargo.toml

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

1010
[workspace.package]
11-
version = "4.18.0"
11+
version = "4.21.1"
1212
repository = "https://github.com/cloudflare/boring"
1313
edition = "2021"
1414

@@ -19,16 +19,17 @@ tag-prefix = ""
1919
publish = false
2020

2121
[workspace.dependencies]
22-
boring-sys = { version = "4.18.0", path = "./boring-sys" }
23-
boring = { version = "4.18.0", path = "./boring" }
24-
tokio-boring = { version = "4.18.0", path = "./tokio-boring" }
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" }
2525

2626
bindgen = { version = "0.72.0", default-features = false, features = ["runtime"] }
27+
bitflags = "2.9"
28+
brotli = "8.0"
2729
bytes = "1"
28-
cmake = "0.1.18"
30+
cmake = "0.1.54"
2931
fs_extra = "1.3.0"
3032
fslock = "0.2"
31-
bitflags = "2.4"
3233
foreign-types = "0.5"
3334
libc = "0.2"
3435
hex = "0.4"
@@ -48,5 +49,3 @@ openssl-macros = "0.1.1"
4849
tower = "0.4"
4950
tower-layer = "0.3"
5051
tower-service = "0.3"
51-
autocfg = "1.3.0"
52-
brotli = "6.0"

RELEASE_NOTES

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
4.21.0
2+
3+
- 2026-01-05 Warn about set_curves() removal
4+
- 2026-01-05 Deprecate set_ex_data()
5+
- 2026-01-05 Fix build with --no-default-features
6+
- 2026-01-05 Make set_curves_list always available
7+
- 2026-01-19 Use fips-build-compatible ERR_add_error_data
8+
9+
4.20.0
10+
- 2025-08-26 Support TARGET_CC and CC_{target}
11+
- 2025-08-26 Fix swapped host/target args
12+
- 2025-06-13 CStr UTF-8 improvements
13+
- 2025-09-26 Skip Rust version detection for bindgen
14+
- 2025-09-26 Upgrade deps
15+
- 2025-06-13 Ensure that ERR_LIB type can be named
16+
- 2025-06-13 Add more reliable library_reason()
17+
- 2025-09-30 pq: fix MSVC C4146 warning
18+
- 2025-10-14 Freebsd build
19+
- 2025-10-01 Fix string data conversion in ErrorStack::put()
20+
21+
4.19.0
22+
- 2025-09-03 Add binding for X509_check_ip_asc
23+
- 2025-06-13 Use ERR_clear_error
24+
- 2025-06-13 Error descriptions and docs
25+
- 2025-06-13 Boring doesn't use function codes
26+
- 2025-09-03 Fix patched docs.rs builds
27+
- 2025-09-03 Test docs.rs docs
28+
- 2025-09-03 Fix doc links
29+
130
4.18.0
231
- 2025-05-29 Add set_verify_param
332
- 2025-05-28 Add support for X509_STORE_CTX_get0_untrusted

boring-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build = "build/main.rs"
1313
readme = "README.md"
1414
categories = ["cryptography", "external-ffi-bindings"]
1515
edition = { workspace = true }
16+
rust-version = "1.77"
1617
include = [
1718
"/*.md",
1819
"/*.toml",
@@ -89,7 +90,6 @@ pq-experimental = []
8990
underscore-wildcards = []
9091

9192
[build-dependencies]
92-
autocfg = { workspace = true }
9393
bindgen = { workspace = true }
9494
cmake = { workspace = true }
9595
fs_extra = { workspace = true }

boring-sys/build/config.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ pub(crate) struct Env {
3636
pub(crate) android_ndk_home: Option<PathBuf>,
3737
pub(crate) cmake_toolchain_file: Option<PathBuf>,
3838
pub(crate) cpp_runtime_lib: Option<OsString>,
39+
/// C compiler (ignored if using FIPS)
40+
pub(crate) cc: Option<OsString>,
41+
pub(crate) cxx: Option<OsString>,
3942
pub(crate) docs_rs: bool,
4043
}
4144

@@ -51,10 +54,10 @@ impl Config {
5154
let features = Features::from_env();
5255
let env = Env::from_env(&host, &target, features.is_fips_like());
5356

54-
let mut is_bazel = false;
55-
if let Some(src_path) = &env.source_path {
56-
is_bazel = src_path.join("src").exists();
57-
}
57+
let is_bazel = env
58+
.source_path
59+
.as_ref()
60+
.is_some_and(|path| path.join("src").exists());
5861

5962
let config = Self {
6063
manifest_dir,
@@ -142,22 +145,19 @@ impl Features {
142145
}
143146

144147
impl Env {
145-
fn from_env(target: &str, host: &str, is_fips_like: bool) -> Self {
148+
fn from_env(host: &str, target: &str, is_fips_like: bool) -> Self {
146149
const NORMAL_PREFIX: &str = "BORING_BSSL";
147150
const FIPS_PREFIX: &str = "BORING_BSSL_FIPS";
148151

152+
let var_prefix = if host == target { "HOST" } else { "TARGET" };
149153
let target_with_underscores = target.replace('-', "_");
150154

151-
// Logic stolen from cmake-rs.
152-
let target_var = |name: &str| {
153-
let kind = if host == target { "HOST" } else { "TARGET" };
154-
155-
// TODO(rmehra): look for just `name` first, as most people just set that
155+
let target_only_var = |name: &str| {
156156
var(&format!("{name}_{target}"))
157157
.or_else(|| var(&format!("{name}_{target_with_underscores}")))
158-
.or_else(|| var(&format!("{kind}_{name}")))
159-
.or_else(|| var(name))
158+
.or_else(|| var(&format!("{var_prefix}_{name}")))
160159
};
160+
let target_var = |name: &str| target_only_var(name).or_else(|| var(name));
161161

162162
let boringssl_var = |name: &str| {
163163
// The passed name is the non-fips version of the environment variable,
@@ -186,6 +186,9 @@ impl Env {
186186
android_ndk_home: target_var("ANDROID_NDK_HOME").map(Into::into),
187187
cmake_toolchain_file: target_var("CMAKE_TOOLCHAIN_FILE").map(Into::into),
188188
cpp_runtime_lib: target_var("BORING_BSSL_RUST_CPPLIB"),
189+
// matches the `cc` crate
190+
cc: target_only_var("CC"),
191+
cxx: target_only_var("CXX"),
189192
docs_rs: var("DOCS_RS").is_some(),
190193
}
191194
}

0 commit comments

Comments
 (0)