I suspect the answer to 1.7 -> 0.1 is something altogether different
I think the numbers explain it without a special case. On a Cortex-M4, a client handshake spends nearly all its time in P-256: one ECDHE exchange, then verifying the server's signature and its certificate's signature. mbedTLS's own benchmark
example puts those at roughly 570 ms for the ECDHE and 590 ms per verify on an M4. That adds up to about 1.7 s.
Siwastaja said the EC math was swapped for an optimized assembly implementation. The best-known one is Emil Lenngren's P256-Cortex-M4 (MIT licence, constant time). It does key generation in 5.1 ms, the ECDH shared secret in 14.2 ms and a verify in
15.3 ms, at 64 MHz. The same three steps come to about 50 ms. So 0.1 s for the whole handshake is about what you'd expect.
https://github.com/Emill/P256-Cortex-M4 It also mostly answers your point about servers you don't control. RSA-2048 public-key operations (the verify side) were already fast in mbedTLS, around 30 to 40 ms on an M4. Elliptic curves were the slow part.
One trap: the p256-m driver bundled with mbedTLS 3.5 and later is not the speed answer. It was designed for small code size first. Its ECDSA verify takes 309 ms on an M4, slower than TinyCrypt.
Curious what TLS lib is even out there since wolf is GPL.
First, the scope of the announcement: only the TLS and X.509 layers are losing their maintainers. The same team keeps maintaining TF-PSA-Crypto, so the primitives stay supported. Worth knowing if you're on 4.1: it was announced as an LTS supported
"until at least March 2029", and for the TLS part that now depends on someone taking over. April 2027 is also right after 3.6 LTS ends.
https://lists.trustedfirmware.org/archives/list/[email protected]/thread/YPIGCB7WN6GCHOGEGKOJXUYAP7OK527W/ Options, depending on the target:
- Embedded Linux: rustls (Apache-2.0/MIT/ISC). I've been replacing an Appweb + mbedTLS web stack in some embedded Linux controllers with Rust and rustls. It also runs on no_std since 0.23, but you have to supply an allocator and a random number
generator.
- Bare-metal MCU in Rust: embedded-tls (Apache-2.0). It's a TLS 1.3 client with no allocator, now maintained under embassy-rs. It's still marked work in progress.
- BearSSL (MIT) is small and well designed, but it's TLS 1.2 only, calls itself beta, and has had no release since 2018. It has the same maintenance problem, only sooner.
- wolfSSL moved from GPLv2 to GPLv3 in 5.8.2, and the commercial licence is still available.
On AI and crypto: I'm a heavy Claude user, and what Siwastaja describes is the sensible version. Swapping in an existing, licensed, constant-time assembly library is not the same as having the AI invent elliptic-curve math. I'd draw the line there:
let it strip the config, remove dead code and write the glue, but keep the primitives vetted. A wrong answer is easy to see. A timing leak isn't.