Skip to content

Only build the ring crypto provider for rustls - #61

Merged
kavehtehrani merged 1 commit into
kavehtehrani:mainfrom
dave-atx:ring-only-tls
Nov 3, 2026
Merged

kavehtehrani merged 1 commit into
kavehtehrani:mainfrom
dave-atx:ring-only-tls

Conversation

@dave-atx

@dave-atx dave-atx commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

tokio-rustls = "0.26" comes with its default features, which turn on rustls' aws_lc_rs provider. The app installs ring as the process default (src/engine/tls.rs#L26) and reqwest's rustls-tls* features already use ring, so aws-lc-sys gets compiled on every build and never linked. The release binary is the same size to the byte with or without it.

This turns off the tokio-rustls defaults and asks for logging, tls12 and ring, which drops aws-lc-rs, aws-lc-sys, cmake, dunce, fs_extra and jobserver from Cargo.lock.

Where it bit me: cross-compiling for OpenWrt, aws-lc-sys' build script ran the host gcc with the target's CFLAGS and the build failed. With this change the OpenWrt package builds.

Checked with cargo fmt --check, clippy -D warnings on both --all-features and --no-default-features --features tui, and cargo test --all-features (114 passed). cargo tree -i aws-lc-sys comes back empty.

tokio-rustls is pulled in with its default features, which turn on
rustls' aws_lc_rs provider. The TLS code installs ring as the process
default (src/engine/tls.rs) and reqwest is already set up for ring, so
aws-lc-sys gets compiled on every build and then thrown away at link
time.

Turn off the tokio-rustls defaults and ask for ring explicitly. That
drops aws-lc-rs, aws-lc-sys, cmake, dunce, fs_extra and jobserver from
Cargo.lock. The release binary is the same size; there's just less to
build, and cross builds no longer have to compile aws-lc. That's what
broke the OpenWrt build: aws-lc-sys' build script ran the host gcc with
the target's CFLAGS.
@kavehtehrani
kavehtehrani merged commit c74e90e into kavehtehrani:main Nov 3, 2026
@kavehtehrani

Copy link
Copy Markdown
Owner

merged, tx dave.

dave-atx added a commit to dave-atx/packages that referenced this pull request Nov 3, 2026
cloudflare-speed-cli is a client for speed.cloudflare.com with a TUI and
plain text / JSON output. Besides throughput it measures loaded latency,
UDP packet loss and jitter, and can run a traceroute to the Cloudflare
edge, which makes it handy for checking bufferbloat from the router.

Two patches, both merged upstream after v1.0.11:
- split arboard (X11 clipboard) out of the tui feature, so the TUI is
  built without it
  kavehtehrani/cloudflare-speed-cli#60
- build only the ring crypto provider; tokio-rustls' defaults also pulled
  in aws-lc-sys, which fails to cross-compile with OpenWrt's CFLAGS
  kavehtehrani/cloudflare-speed-cli#61

Not available on 32-bit mips / powerpc / ARMv5, which lack the 64-bit
atomics the speed test uses, or on i386, where ring requires SSE2.

Tested on bcm27xx/bcm2712 (Raspberry Pi CM5).

I used Claude Code to help prepare this change.

Signed-off-by: Dave Marquard <dave@marquard.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants