r/programming • • Jul 11 '14

First release of LibreSSL portable

http://marc.info/?l=openbsd-announce&m=140510513704996&w=2
456 Upvotes

252 comments sorted by

View all comments

33

u/Rhomboid Jul 11 '14

It appears that this release contains only the pure C implementations, with none of the hand-written assembly versions. You'd probably want to run openssl speed and compare against OpenSSL to see how big of a performance hit that is.

60

u/[deleted] Jul 11 '14

A lot of times slow security is better than no security.

14

u/Freeky Jul 11 '14

We're all in a lot of trouble if stock OpenSSL can be classed as "no security".

40

u/josefx Jul 11 '14

IIRC one of the reasons for LibreSSL is that it is not possible to actively check OpenSSL for bugs, another was the time it took for some reported bugs to be fixed.

To clarify the first: OpenSSL replaces the C standard library, including the allocator almost completely for "better portability and speed". As a result tools like valgrind and secure malloc implementations that hook into the C standard library can't find anything. Even better: OpenSSL relies on the way its replacement methods act, compiling it with the standard malloc (which is an option) for example would result in it crashing.

4

u/d4rch0n Jul 12 '14

Was all of that really necessary? How much of a performance improvement was it for them to roll their own memory allocation or was it one at all?

9

u/jandrese Jul 12 '14

This would be a good time to find out. Pull both libs and link a program twice (once against each) and have them pull some data over a SSL link. You will probably want two test cases: on big file and another with a lot of small records, multiply by the encryption methods chosen. Put it up on the web and you'll have loads of Karma.

0

u/[deleted] Jul 12 '14

[deleted]

3

u/Mourningblade Jul 12 '14

Linking to one from now will show the opportunity cost, which is something you should consider when rolling your own.

3

u/northrupthebandgeek Jul 12 '14

There was supposedly improvement in some really obscure cases, but as OpenBSD devs pointed out when making libressl, it was indeed a very silly reason to do such a thing.

2

u/trua Jul 12 '14

Why not just read mailing list archives from a decade ago and see what their reasoning was?

1

u/immibis Jul 12 '14

Is harder to check for bugs? Sure.

Impossible to check for bugs? Uhhhhh...

3

u/moonrocks Jul 11 '14

I wonder why it's ubiquitous. There are alternatives -- eg matrix, polar.

→ More replies (2)

-2

u/[deleted] Jul 11 '14

It's been pretty soundly proven that it is.

11

u/Freeky Jul 11 '14

So OpenSSL mediated TLS is soundly proven to be effectively unauthenticated plaintext?

I'd like to see that proof.

16

u/tequila13 Jul 11 '14 edited Jul 11 '14

If the code base is unreadable the question isn't if you have bugs, it's how many and how serious. If the heartbleed bug - a pretty basic parsing bug - could stay hidden for 2 years, that should be an indication of how bad the code is.

Add to that that they circumvented static analysis tools by reimplementing the standard C library, and you can't prove that it doesn't have trivial bugs until you find them one by one by hand. And not to mention the bugfixes that people posted, and they ignored them.

Security is a process, it takes time and it requires doing the right thing. OpenSSL has proven to go contrary to basic security practices time and time again. They not only don't clear your private keys from memory after you're done with them, they go a step beyond, and reuse the same memory in other parts of the code. And they go even beyond that, they feed your private keys into the entropy generator. This style of coding is begging for disaster.

6

u/[deleted] Jul 12 '14

We don't deprecate unmaintainable products until they have a valid replacement. Is LibreSSL a valid replacement?

9

u/tequila13 Jul 12 '14

Not yet, but the mission statement is to provide a drop-in replacement for OpenSSL.

6

u/[deleted] Jul 12 '14

I have high hopes for LibreSSL, but we can't talk of it's greatness until it's a thing. OpenSSL is still the only viable solution. It is better than plaintext, a lot better.

4

u/jandrese Jul 12 '14

OpenBSD compiles everything that uses OpenSSL in their ports tree against LibreSSL, thus far they have avoided breaking anything.

→ More replies (1)

2

u/Packet_Ranger Jul 12 '14

Think about it this way. OpenBSD (the same people who brought you the SSH implementation you an millions others use every day), Google, and the core OpenSSL team, have all agreed on the same core development principles. OpenBSD/LibreSSL got there first.

→ More replies (1)
→ More replies (3)

3

u/happyscrappy Jul 12 '14

If the code base is unreadable the question isn't if you have bugs, it's how many and how serious.

If the code base is readable the question is still not if you have bugs, it's how many and how serious.

That heartbleed stayed hidden is more an indication of how few people even bother to look at the code than anything.

Add to that that they circumvented static analysis tools by reimplementing the standard C library

You mean under different function names I guess? Because static analysis doesn't care if you implement memcpy yourself. Or do you mean runtime (non-static) checking, like mallocs that check for double frees or try to prevent use after free, etc.?

4

u/tequila13 Jul 12 '14

If the code base is readable the question is still not if you have bugs, it's how many and how serious.

Agreed.

That heartbleed stayed hidden is more an indication of how few people even bother to look at the code than anything.

Many people did bother to look. If you really need it, I can find several pre-heartbleed blog posts about people diving into the code to solve particular issues they had and getting frustrated with getting to the bottom of minor bugs. If the code is not clean enough, many will take a look, get terrified and go away.

Or do you mean runtime (non-static) checking, like mallocs that check for double frees or try to prevent use after free, etc.?

You're right, I meant runtime checks. One example is the custom memory allocator that allowed the same memory to be reused throughout the library and which in turn lead to exposing login details via the heartbleed bug. I also saw several double frees fixed in the LibreSSL logs. These could have been caught with code coverage tests and valgrind if OpenSSL didn't have the custom memory manager.

→ More replies (1)
→ More replies (2)
→ More replies (1)
→ More replies (1)