News for hackers. Stuff that matters.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by dwheeler on Friday July 19, 2019 @01:37PM (#20480778)
Very interesting!

Rust normally prevents a lot of memory safety problems, but those are not the only kind of security problem in a crypto system. Obviously the library has to correctly implement the spec (and expectations of users), which just using Rust doesn't guarantee. More importantly, a crypto library also has to avoid leaking crypto data through various side channels. Just using Rust doesn't help with that; "Crypto Coding" at https://github.com/veorq/cryptocoding lists some rules to help address that.

Anyone know if rustls has worked on those issues as well? I notice that rustls uses ring, which asserts on https://github.com/briansmith/ring that "Most of the C and assembly language code in ring comes from BoringSSL, and BoringSSL is derived from OpenSSL. ring merges changes from BoringSSL regularly."

It doesn't matter if it's fast if it doesn't do things correctly...!

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by gnode on Friday July 19, 2019 @02:10PM (#20481069)
Inevitably some crypto primatives must be written in assembly languages in order to ensure timing attacks and alike are not possible. As far as I know, there's no support in Rust or C for requiring such constraints from the code generation.

Still, ensuring the code around the primitives is safe in various ways is still valuable.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by PyroLagus on Friday July 19, 2019 @02:22PM (#20481169)
You could write those in Vale[0], but at that point, just use miTLS[1] to have a completely verified TLS implementation.

[0] https://github.com/project-everest/vale

[1] https://mitls.org/

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by pcwalton on Friday July 19, 2019 @02:33PM (#20481269)
Brian Smith is well-regarded as an expert in this field. He knows what he's doing.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by drenvuk on Friday July 19, 2019 @02:39PM (#20481330)
Just trusting a name and not the product has led to some bad outcomes before.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by bluejekyll on Friday July 19, 2019 @02:50PM (#20481435)
Having worked with Brian while integrating ring into Trust-DNS, I concur with the assessment from pcwalton.

But, yes, the name isn’t the only thing, but the discourse on the development of ring through the issue discussion on Github is high quality and very conservative in what is accepted. The library is high quality and has decent test coverage, with a diligent review process. All of that stems from Brian’s effort in maintaining an amazing project.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by tptacek on Friday July 19, 2019 @04:49PM (#20482329)
Can you provide an example of a name trusted among cryptographers, a specific library, and a bad outcome? I agree with Patrick Walton: Brian Smith is an extremely credible engineer in this particular domain.

I would venture, tentatively, the hypothesis that the exact opposite thing is true, and that trusting well-established subject matter experts has been a pretty good strategy in cryptographic security. There's a reason everyone uses Sodium/Nacl.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by tedunangst on Friday July 19, 2019 @09:08PM (#20483607)
I think the subject is somewhat ambiguous because for many users, they are more likely to recognize library author names than cryptographers. And imagine those authors are cryptographers in their own right.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by drenvuk on Thursday July 25, 2019 @11:51AM (#20526413)
Not a single one.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by m463 on Friday July 19, 2019 @07:43PM (#20483312)
I am unfamiliar with any of the code, so take my statement with a grain of salt.

Sometimes crypto code must be written in weird ways to fend off attacks.

For example, to prevent timing attacks, code must sometimes be written to take constant time. This basically means that some loops must not exit early (such as when a key is wrong). Instead they must note the failure, then continue looping and return failure afterwards.

This means some code has to be written to always take worst-case time.

But if worst-case time in one libraray is better than another library, there can definitely be improvements.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by ori_b on Friday July 19, 2019 @02:56PM (#20481483)
Yeah, but not surprising: OpenSSL is generally considered to be rather poorly written, from reinventing their own memory allocators, poorly, to layers upon layers of performance-sucking wrappers, to just bizzare and convoluted design decisons.

I'd be far more interested in seeing comparisons to, eg, BearSSL.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by tptacek on Friday July 19, 2019 @07:04PM (#20483156)
Note well: that was the prevailing (and probably correct) opinion a few years ago, but OpenSSL's quality has by most accounts improved dramatically over the last few years. I wouldn't talk someone out of using BearSSL, but if you're writing code that has to depend on a C-language TLS library, OpenSSL is a sane first choice.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by bluejekyll on Friday July 19, 2019 @11:01PM (#20483935)
I’ve reviewed OpenSSL code somewhat recently and agree that it’s vastly improved.

Though, if you want something based on Rustls with C bindings (I have no involvement in this project) there is: https://github.com/mesalock-linux/mesalink

That’s OpenSSL compatible bindings into Rustls.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by mschuster91 on Friday July 19, 2019 @06:00PM (#20482802)
The thing is openssl runs on so many platforms, which may or may not guarantee anything except a barely working malloc/free, so it makes sense to ship a custom allocator.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by ori_b on Friday July 19, 2019 @06:28PM (#20482959)
Which ones?
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by libeclipse on Friday July 19, 2019 @03:11PM (#20481594)
I wonder if the performance gains are due to BoringSSL being faster than OpenSSL?
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by steveklabnik on Friday July 19, 2019 @03:25PM (#20481698)
I linked to the in-depth explanations below; it has stuff like

> The difference between OpenSSL and rustls appears to be thanks to an extra copy in the main data-path in OpenSSL.

and

> It appears OpenSSL recalculates and then discards the local public key when processing the server’s key share extension. This likely explains the larger performance deficit in this test.

in it. So I doubt that it's the result of differences in the primitives.

Re:A Rust-based TLS library outperformed OpenSSL in almost e... by kevin_thibedeau on Friday July 19, 2019 @03:46PM (#20481844)
X.509 parsing has no allocations and call depth is significantly less than OpenSSL.
Re:A Rust-based TLS library outperformed OpenSSL in almost e... by steveklabnik on Friday July 19, 2019 @03:58PM (#20481929)
That’s very cool!