‘BearSSL’ strips crypto back to the bare metal
Into a world already crowded with big name alternatives to OpenSSL, an indy project could look like “yet another SSL implementation,” but Vulture South suspects there are good reasons to take a close look at the just-launched BearSSL.
One is that its author, Thomas Pornin, has ignored the kinds of legacy protocols that occupy too much of the OpenSSL developers’ time. Hence, TLS from version 1.0 onwards is supported, but Pornin doesn’t need to sweep out old SSL code, because there’s none in there.

Another is that he’s noticed the atrocious security problems that exist in the Internet of Things. Unlike LibreSSL or Google’s BoringSSL, this is a BearSSL of very little brain.
It’s been argued repeatedly that “things” aren’t going to get decent security in their own right, because they’re small and stupid.
BearSSL offers a counter-argument: while it’s early days, one of Pornin’s design targets is that the server implementation fits in 20 KB of compiled code and 25 KB of RAM. He particularly points to embedded systems and bootstrap code as suitable contexts for the implementation.
A much tougher ask for any software is that it be “secure by default”. Code-watchers will know how hard that is – Vulture South is still aware of only one “provably secure” micro-kernel, the seL4 project.
BearSSL isn’t trying to go that far, but as well as the no-SSL rule, it also ignores RC4, RSA, MD5, while TLS 1.0, 3DES and RSA/SHA-1 are put at the bottom of its preference order.
“A facet of “safe by default” is the use of constant-time cryptographic implementations,” Pornin writes.
That’s because a great many side-channel vulnerabilities in cryptography are down to timing attacks: measuring how long a processor takes to, for example, create a signature, and using that to make inferences about the algorithm.
Constant time implementations are needed all the way through the process, Pornin writes – hashing, symmetric encryption, asymmetric operations, CBC (cipher block chaining) and HMAC (keyed-hash message authentication code) handling.
Other key aspects of the version 0.1-level project are:

Static linking – “only algorithms that are actually used get pulled into the linked binary”, he writes;
A state-machine API – remember, this is designed for small-and-skinny environments, so BearSSL doesn’t need callback functions for I/O.

One of the most common angles for vulnerabilities is memory leaks – buffer overruns/underruns, for example.
Since BearSSL has to be small, Pornin has decided to ignore malloc() and dynamic allocation entirely: “the whole of BearSSL requires only memcpy(), memmove(), memcmp() and strlen()” from the underlying C library, Pornin says.
Mainly, though, he skipped malloc() for a much more prosaic reason: it makes the program a lot smaller and portable right down to bare metal with no operating system.
Oh, and did we mention there’s an OpenSSL patch coming Thursday, US time? That’s all the group has said so far. ®
Sponsored: Customer Identity and Access Management

Leave a Reply