feat(tls): add an aws-lc backend behind CAN_HUB_TLS_BACKEND - #176
Merged
Conversation
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add AWS-LC as a selectable TLS backend:
-DCAN_HUB_TLS_BACKEND=awslc. OpenSSL stays the default and is untouched.Why
Roadmap §4. OpenSSL is 90% of a release binary — 4.62 MB of the 5.11 MB of symbols in
can-hub-agent, measured by intersecting the binary's symbols with the archives'. That matters for the device-side agent.The roadmap picked wolfSSL. That recommendation was wrong and this PR does not implement it: it judged the licence against the AGPL arm only, and can-hub is dual-licensed (
README.md,LICENSE.commercial). wolfSSL is GPLv3, so a commercial licensee would need their own wolfSSL licence. GnuTLS falls the same way — LGPLv2.1+, and its mandatory GMP is LGPLv3/GPL-2+, which does not survive static linking into a proprietary product.AWS-LC is Apache-2.0 OR ISC, so it works in both arms.
Results
can-hub-agent, stripped#ifCMAKE_SIZEOF_VOID_PworkaroundMost of the size win is configuration, not the library:
-ffunction-sections+--gc-sections(which the tree only applied to its own sources, and only in the static profile) takes it to 3.61 MB, and AWS-LC'sOPENSSL_SMALLto 2.13 MB. That is wolfSSL territory (1.88 MB) without the licence.How
quic_tls_backend.habsorbs the shape difference between ngtcp2's two backends — the ossl one wraps each session in a context object and needs a global init, the boringssl one configures theSSL_CTXonce and uses theSSLas the native handle. Identity minting moves totls_identity_openssl.cbehindtls_identity_backend.h; AWS-LC reuses it unchanged.The one real incompatibility: BoringSSL forks leave ED25519 out of their default signature preferences, so two ED25519 identities fail with
NO_COMMON_SIGNATURE_ALGORITHMSbefore certificate verification ever runs. It is asked for explicitly on both sides. This cost a while to find because the symptom was a silentHANDSHAKE_FAILURE_ON_CLIENT_HELLOandopenssl s_clienthandshakes fine against the same server.Testing
make testgreen (412) on both backendsCAN_HUB_BIN_DIR=build/awslc-final)One e2e test,
Socketcand Write Burst, failed on the first AWS-LC run at 393/400. It is pre-existing flakiness, not a regression: OpenSSL fails it too (395/400 on one of two runs) while AWS-LC passed 400/400 twice. The final full run is 56/56.Notes
Not done here, and needed before AWS-LC could become the default: cross-compile arm64/armhf, the
CAN_HUB_STATICprofile, and the Windows build. Rather than leave those as silent surprises,CAN_HUB_TLS_BACKENDnow rejects an unknown value and refuses the two combinations that are not wired up, instead of quietly building OpenSSL becauseCAN_HUB_STATICis evaluated first.Under AWS-LC the verify preferences list ED25519 alone, so that build will not accept a peer certificate signed with anything else. Every identity this project mints is ED25519, so it is a tightening rather than a restriction — but it is an asymmetry with the OpenSSL build, which accepts the stack defaults.
Review of the first CI run caught a real regression this PR introduced:
TlsIdentity_FingerprintOfPeer, extracted to deduplicate the peer-fingerprint code, existed only in the linux tree whiletls_channel.cis shared with windows. The windows cross-build failed to link; it now has the same helper and builds.wolfSSL was built, ported and measured before the licence ruled it out; that work is not in this diff, only in the branch history.