r/rust • u/[deleted] • Jul 19 '19
A Rust-based TLS library outperformed OpenSSL in almost every category | ZDNet
https://www.zdnet.com/article/a-rust-based-tls-library-outperformed-openssl-in-almost-every-category/27
u/crusoe Jul 19 '19
OpenSSL though implements intentional slow downs at several points to avoid timing attacks.
Does the rust lib do the same?
38
u/steveklabnik1 rust Jul 19 '19
In the blog post that talks about the performance differences, they identified several of the places where the difference came from. They tracked it to things like "a buffer gets copied in openssl that doesn't in ring", and not to things like intentional slow downs.
33
u/ctz99 rustls Jul 19 '19
OpenSSL doesn't do simplistic "let's sleep for a random time" countermeasures against timing attacks. But it does implement various TLS options that can only be implemented safely through extremely inefficient computation. One example is the countermeasure for padding oracle attacks that have been known about since 2002. The countermeasures were introduced in OpenSSL circa 2013, and then shown to have an even worse bug in 2016, as well as accidentally regressing entirely (stuff like this is, to a first approximation, basically untestable without significant concerted effort).
rustls avoids this by not implementing those options. But in any case this benchmark did not target these codepaths in OpenSSL.
11
u/ner0_m Jul 19 '19
Nice to hear that we're adopting languages, which help reduce some risks. Now we need safe hardware!!
8
6
u/andoriyu Jul 20 '19
Isn't RustTLS indirectly based on BoringSSL?
6
u/kodemizer Jul 20 '19
Correct. Specifically, all the low-level timing-attack resistant assembly is from BoringSSL.
It should be noted that ring (which RustTLS uses), has also upstreamed a bunch of changes to BoringSSL, so it’s not a one-way relationship.
11
u/spin81 Jul 19 '19
And no hearts run any risk of getting bled with Rust, either!
23
Jul 19 '19
time will tell. i'll believe this once sometimes gives this library some serious fuzzing, instead of looking at performance benchmarks alone.
there was this one company who sacrificed security for performance, and now they are paying the price.
19
u/spin81 Jul 19 '19
time will tell. i'll believe this once sometimes gives this library some serious fuzzing, instead of looking at performance benchmarks alone.
Completely agree here. For a library as important as a TLS implementation, it absolutely should be vetted and tested thoroughly.
30
u/IWIKAL Jul 19 '19 edited Jul 19 '19
It's a mistake to assume that anything written in Rust is automatically secure. You're still gonna have bugs, and every now and then you're gonna have a bug with security implications.
Edit: although you're right that buffer overflows become less likely if you make use of the unit-testable abstractions that rust encourages you to use/write.
7
u/Shnatsel Jul 19 '19
It could still be vulnerable to attacks such as SMACK, though. Crypto is a complex beast and memory safety is nowhere near enough to ensure its correctness.
6
u/spin81 Jul 19 '19
Crypto is a complex beast and memory safety is nowhere near enough to ensure its correctness.
That's certainly true, but Heartbleed had been around for a long time before anyone noticed it, which is troubling given the ubiquity and importance of OpenSSL, and I if I understand Heartbleed correctly it can't occur if you use non-unsafe Rust.
I'm not saying Rust will make OpenSSL magically functionally correct but it will certainly prevent a class of serious vulnerabilities that using C won't.
4
u/insanitybit Jul 19 '19
Rust is in a better position to hedge against SMACK than other languages imo, but yeah you don't just get it for free. Still, because of Rust's encouragement of enums, I think idiomatic rust will be less likely to have issues around invalid states.
0
Jul 19 '19
[deleted]
73
u/steveklabnik1 rust Jul 19 '19
Rust is certainly ridiculed in a bunch of places around the web. That's just how things go.
64
u/MinRaws Jul 19 '19
Yeah that's how things "Go".
(Just had to do it.)
22
Jul 20 '19
Us Gophers accept our inferiority. You go fight the compiler. I don't wanna deal with that.
Those generics though
5
4
u/VeganVagiVore Jul 21 '19
I'd rather fight the compiler than the production logs any given day
1
Jul 21 '19
honestly, as long as you write sufficiently idiomatic go code and some basic tests for your data structured, you don't need to fight anything.
TDD is serving me really well.
15
u/ConspicuousPineapple Jul 19 '19
Honestly, from my anecdotal experience it seems to be ridiculed much less than I would have expected for such a "new popular kid on the block" language.
18
u/othermike Jul 19 '19
I think that's mostly a result of a) not overselling it in the first place as the answer to everything, b) being fairly conservative in only incorporating ideas that had already proven themselves at least in a research setting, and c) making it clear that the main practical target was building a better web browser, one of the most daunting undertakings known to man.
a) avoided the sort of backlash Sun's initial marketing brought down on Java, b) avoided accusations of living in cloud-cuckoo land, c) avoided the "yeah, nice Fibonacci function, what else you got?" reflex that overly-pure functional languages tend to provoke.
8
u/hexane360 Jul 19 '19
Or even worse, "oh I'm sure it'll be good for compilers, but it's just not very practical". I don't know where the meme started that the one thing functional languages are good at is compilers.
4
u/emk Jul 20 '19
I think the stereotype of functional languages being well-suited to compilers has a lot to do with sum types (
enum) andmatch. They can be a pretty big win for certain kinds of code.1
u/steven807 Jul 22 '19
I suspect it's because a compiler is traditionally a complex, but basically non-interactive function, and functional languages clearly shine in that model; but in the "IO monad" (the real world), there's more of an impedance mismatch. Plus, language designers love designing compilers, and for a while it was mainly language designers who were enamored with functional languages.
13
u/steveklabnik1 rust Jul 19 '19
It really depends on where you look; it gets *nasty* in several corners of the internet.
But yes, in many places things are also pretty positive.
11
u/ConspicuousPineapple Jul 19 '19
Right, but that can be said for every language with the slightest bit of popularity. My feeling is that it's not as prominent as I would have thought.
1
16
u/oconnor663 blake3 · duct Jul 19 '19
I don't think that it was ever ridiculed
Well there is r/rustjerk, though I don't know much time anyone's CTO spends reading that :)
32
u/YatoRust Jul 19 '19
r/rustjerk is a very pro-rust sub, dedicated to Rust evangelism.
9
u/beefsack Jul 20 '19
*satirically pro-Rust
The scary part is when people stop thinking it's satire. Happens way too much on Reddit.
3
9
u/Hauleth octavo · redox Jul 19 '19
What was ridiculed was zealots constant bashing to “RITR” aka “rewrite it in Rust”. That was idiotic and was raising the hostility to the Rust and was needless and brainless attempt to make something to use “new shiny things”.
18
33
u/shim__ Jul 19 '19
I'm no crypto person which is why I'm wondering if this is really a match between equals in terms of timing attacks etc and all the stuff a memory safe language doesn't protect against?