News for hackers. Stuff that matters.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by mises on Friday July 19, 2019 @01:08PM (#20480484)
The implication here is that it does better because it's written in rust. I doubt that's the case. I think it's faster because it's new, smaller (i.e. doesn't have to deal w/backwards-compatibility with previous versions or old protocols). More importantly, it uses the ring library for crypto, which is over half asm according to its github. Clearly, there's a lot of optimization there.

Regardless of the reason why, I'm very excited to see a better alternative to openssl. More competition will hopefully make all the projects better, and I wish the rustls guys the best of luck.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by jerf on Friday July 19, 2019 @01:25PM (#20480661)
I've suspected for a long time that Rust would prove to be a faster language than C++ once it was done, but only as the code scales up. On a line-by-line basis, the two languages are comparable, so microbenchmarks will never show it, but Rust will tend to very, very strongly encourage better architectures that require you to do less copying just to be safe. It's really hard to measure "architectural affordances", though... heck, it's hard to even define them, let alone benchmark them.

OpenSSL has been optimized extensively, so I consider the fact that any hobbyist project with a fraction of the resources able to beat it by that much to be significant in a way that, say, beating "some guy's github json parser" isn't. If I were going to temper my excitement, though, what I'd want is to make sure the Rust implementation isn't unknowingly trading away important security considerations to get that speed, such as whatever constant-time operations may be necessary or guarantees about when the key will be destroyed or whatever. I have no concrete knowledge about that in this specific case, but in a security context it is something I'd want to check in general. OpenSSL has had its stumbles, and the architecture is... debateable, especially when binding to it in a non-C language... but it has also been reviewed a lot, and battle-tested, and a lot of other things this little library just hasn't been yet. (Not because of any deficiency of the library, author, or language, but just, something things can only come from time and scale.)

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by fbmac on Saturday July 20, 2019 @09:06AM (#20485510)
Rust already beat C in the benchmarks game

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by igouy on Saturday July 20, 2019 @12:55PM (#20486885)
That boxplot shows both the C and the C++ programs ahead of the Rust programs, so why do you say "Rust already beat C" ?
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by buu700 on Friday July 19, 2019 @02:01PM (#20480988)
That's not how I read the title. I think it's impressive that it's faster despite being written in Rust.

Maybe Rust also makes it easier to write fast code (I couldn't say one way or another), but it's great that you at least don't need to sacrifice performance on the altar of safety.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by vitriol83 on Friday July 19, 2019 @01:21PM (#20480626)
I’m generally positive on rewriting openssl in rust, but agree the comparisons aren’t completely scientific or necessarily more important than correctness. First you should compare performance using the same implementations of cryptographic primitives as these are relatively easily fungible. We also don’t know if for example OpenSSL optimised primitives were used. Secondly the rust language only excludes memory bugs, it doesn’t exclude errors in the implementation of the tls protocol or incorrect usage of cryptographic primitives which can be just as catastrophic for security. These have been prevalent in OpenSSL and are somewhat harder to prevent a priori. For all we know these issues are worse for rustls than OpenSSL. This is where formally verified implementations would be useful.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by staticassertion on Friday July 19, 2019 @01:35PM (#20480754)
> Secondly the rust language only excludes memory bugs, it doesn’t exclude errors in the implementation of the tls protocol or incorrect usage of cryptographic primitives which can be just as catastrophic for security.

I linked to a talk about the project elsewhere and it's worth noting that the author of rustls leverages a lot of rust techniques that ensure certain correctness attributes at a semantic level, not just memory safety.

In particular, TLS libraries have long suffered from dealing with the complex composite state machines required by the protocol[0]. Rust makes the expression of safe state machines pretty easy (the talk demonstrates how).

[0]https://www.mitls.org/pages/attacks/SMACK

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by gameswithgo on Friday July 19, 2019 @01:24PM (#20480647)
Crypto libraries is a domain where the advantages of Rust are very important. You need really good performance, and you need really good safety guarantees. Rust is relatively unique in being able to deliver both of those as well as it does.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by staticassertion on Friday July 19, 2019 @01:23PM (#20480641)
There are probably a lot of reasons why it's faster, and at least some of those are about rust, and some definitely aren't.

https://www.youtube.com/watch?v=aHMRFZkXq4Y

Here's a good talk about the project. Some of the patterns the author uses are sort of hard to do in other languages (such as pattern matching on composite states).

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by jeffdavis on Friday July 19, 2019 @01:17PM (#20480564)
People do good things with rust. Therefore rust is a good programming language.

Could someone have done this particular good thing in another language? Absolutely. But that's not very relevant.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by xiphias2 on Friday July 19, 2019 @01:21PM (#20480617)
> Could someone have done this particular good thing in another language? Absolutely

While this is true for many other tasks, I don't think there exists any other programming language that fits so well for safe and efficient protocol implementation (where experimentation speed is not that important)

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by zaphar on Friday July 19, 2019 @02:09PM (#20481056)
Given enough time and resources someone could do equivalent work in assembly. The point of Rust is that it should take you less time and resources to do so.