Comments

It is refreshing to see that a reputable software engineer has openly criticized OpenSSL. OpenSSL is a terrible piece of software. I started using it in 2001.

The API makes no sense at all. The functions that you call, the way they're called and the sequence the functions are called in cannot be determined from reading the documentation. You have to rely on examples and look at the source code of accompanying programs.

Function names are made up from macros. This means you cannot easily find them in the source code. These names can change from one release to the next.

Upgrading to a newer version of OpenSSL will almost always break application code that uses the API. I have concluded that only the authors of OpenSSL can know how to use it. The only portable and reliable way to use OpenSSL is to call the application program with the appropriate command line arguments.

Alex | Wed, 06 Aug 2014 02:44:12 UTC

Question:

1. What is the difference between the heartbleed bug and other major problems/bugs with openssl and those of proprietary SSL implementations?

If you flip to the back of the book, you'll find answers to all odd numbered questions:

1. The bug was found, reported, and corrected.

I find it humorous things like this are highlighted when these problems exist in ALL software, not just open source software, and certainly not just openssl. When is the last time any proprietary SSL implementation was audited by a third party? If never is your guess, you're probably right. What makes you think any of their code is any better? Do you just trust their code is more secure? I don't -- I'm only a weekend hacker (and I wouldn't even call myself that level) and I wouldn't say that ~50% of the professional devs I meet are some combination under-educated, under-skilled, and extremely lacking in critical thinking/problem solving skills, and there are a lot of people in the industry who would agree with me. Surely some of those people must be working on SSL implementations, or other security-centric software.

Something I learned long ago is that if one is to successfully program in some language, one must write idiomatic code in that language. Unfortunately, I think that one of the problems with writing C code is that there is a lack of idiom around things like parenthesizing expressions that can lead to surprising problems if one is not familiar with the precedence rules of the language.

Martin Leiser | Fri, 25 Apr 2014 21:19:11 UTC

hmmm... I think it is all about Architecture. Software has bug. Period. On the other side: We know for 50 years how a MMU works. Hardware has bugs too, but much less. Why is to web server, openssl, the private key in one adress space? Use stunnel with PKCS11 to off load the private key. And the web server in a different process.

Two simpl rules: Divide and conquer. Least privilege.

Add a third rule: CPUs are cheap.. switch off optimizations for security relevant code.

But all that is not the trend of today is multithreading, throwing 100.000.000 Lines of code in one application server.....

Dont blame the openssl programmers, it is their bug, but our fault.

Sebastiaan | Thu, 17 Apr 2014 22:45:53 UTC

Must be because English is not my native language, but in my book these commits don't fall in the category 'typo'...

A new go to fail in the making? I'm no C programmer, but these two commits removed curly brackets and subsequently converted a single line of code inside an 'if' statement to two lines... Sure this code is correct, but *visually* harder a lot harder to spot?

Great article, was referred here from the version2.dk debate: http://www.version2.dk/blog/det-skandaleramte-sikkerhedslag-og-hvad-goer-vi-nu-57357

> /* > * The aim of right-shifting md_size is so that the compiler > * doesn't figure out that it can remove div_spoiler as that > * would require it to prove that md_size is always even, > * which I hope is beyond it. > */ > div_spoiler = md_size >> 1; > div_spoiler rotate_offset = > (div_spoiler + mac_start - scan_start) % md_size; > > Be honest would you have considered a proven, correct, compiler improvement a security risk > before I showed you that? > > Of course you wouldn't! It was proven correct, wasn't it?

I do embedded development, and I sometimes experience that I have to qualify a variable volatile, to get the compiler to stop optimizing the code in ways that spoils the intended behavior. I would imagine the OpenSSL code could do the operation on a volatile-qualified variable and achieve the same effect without having to resort to nasty tricks ? From my K&R on the volatile qualifier: "The purpose of volatile is to force an implementation to suppress optimization that could otherwise occur."

Peter Kriens | Wed, 16 Apr 2014 14:39:18 UTC

Isn't this also a reason to not program this kind of code in C(++) instead of a managed language?

Kevin L | Wed, 16 Apr 2014 11:32:12 UTC

As an experienced engineer in both the process industries (MS in ChemE) and software (BS in CompSci), I think that data breaches at the SSL/TLS layer need to be treated in much the same way as pressure breaches in physical systems: you use multiple independent systems to verify each other **while online**, and if any one of those systems sees a problem you interrupt the flow (terminate the connection).

Applied to this case, that would be two or more SSL libraries executing in separate processes that would each perform the SSL/TLS protocol independently, with the HTTP process comparing their outputs and only sending bytes to the other side when the outputs fully agree. If they disagree, the HTTP daemon would log an error and terminate the connection. In this fashion each library would expose the bugs in the other, while protecting the users. Eventually both libraries would get better, only failing simultaneously for errors in the protocol design or the underlying crypto math. (This is also the approach used in aviation: 3 computers, 2 to check for hardware faults and a third in an independent implementation to check for logic faults.)

Outside of generating nonces and random numbers that would have to be passed between the libraries and the HTTP process, this doesn't seem like it would be too hard to do.

Javier | Wed, 16 Apr 2014 04:01:52 UTC

Very nice article

Aside from DANE, Convergence(http://convergence.io) is another alternative to CA. OpenBSD is cleaning OpenSSL(http://undeadly.org/cgi?action=article&sid=20140415093252)