<story><title>OpenSSL is written by monkeys (2009)</title><url>https://www.peereboom.us/assl/assl/html/openssl.html</url></story><parent_chain><item><author>betterunix</author><text>1. Other libraries do exist -- NSS, GnuTLS, etc.&lt;p&gt;2. Do you have time for a rewrite?  What makes you think anyone else would?&lt;p&gt;3. The (generally correct) mindset is &lt;i&gt;don&amp;#x27;t implement your own crypto&lt;/i&gt;.  This is particularly true of something like TLS, which is complicated and has subtle requirements that are easy to screw up.  Unfortunately, this means that even people who have time are discouraged from doing an OpenSSL rewrite.</text></item><item><author>mrtksn</author><text>O.K. This is probably a stupid question but if it was apparent to many that the code of OpenSSL was horrible why people kept using it and nobody tried to re-factor it? How it is possible that such a popular and critical piece of opensource software  survived the years without a complete face-lift and nobody wrote thorogh documentation?</text></item><item><author>agwa</author><text>I&amp;#x27;ve done quite a bit of programming with the OpenSSL library and this article is only scratching the surface of the awfulness.  Documentation is horrible to non-existent, you really do need to go spelunking into the source to figure out how things work, and the code really is that horrible.&lt;p&gt;The worst thing is that error reporting is not consistent - sometimes -1 means error, other times 0 means error, other times 0 means success, and sometimes it&amp;#x27;s a combination.  This is really, &lt;i&gt;really&lt;/i&gt; bad for a crypto library since properly detecting errors is usually critical to security.</text></item></parent_chain><comment><author>bad_user</author><text>&amp;gt; &lt;i&gt;The (generally correct) mindset is don&amp;#x27;t implement your own crypto&lt;/i&gt;&lt;p&gt;That sounds like bad advice. The huge impact of Heartbleed is precisely because of the monoculture in SSL&amp;#x2F;TLS implementations. Shit happens but this vulnerability is such a catastrophe because an estimated half a million of the &lt;i&gt;top&lt;/i&gt; Internet websites have been vulnerable since 2012, including popular services that everybody is using and the vulnerability once discovered, is easy to use and far reaching, allowing one to steal sessions, passwords, the domain&amp;#x27;s private keys and anything important.&lt;p&gt;It really can&amp;#x27;t get any worse than this. At the very least we found out about it, better late than never and we can discuss the source-code, but it does make one wonder ... if SSL&amp;#x2F;TLS is such an important piece of infrastructure and if we need a monoculture (because apparently it&amp;#x27;s bad advice to reimplement crypto), why aren&amp;#x27;t we using a library that&amp;#x27;s the reference and that&amp;#x27;s peer reviewed by a standards committee, instead of relying on a library for which commits don&amp;#x27;t necessarily trigger sounds?</text></comment>
<story><title>OpenSSL is written by monkeys (2009)</title><url>https://www.peereboom.us/assl/assl/html/openssl.html</url></story><parent_chain><item><author>betterunix</author><text>1. Other libraries do exist -- NSS, GnuTLS, etc.&lt;p&gt;2. Do you have time for a rewrite?  What makes you think anyone else would?&lt;p&gt;3. The (generally correct) mindset is &lt;i&gt;don&amp;#x27;t implement your own crypto&lt;/i&gt;.  This is particularly true of something like TLS, which is complicated and has subtle requirements that are easy to screw up.  Unfortunately, this means that even people who have time are discouraged from doing an OpenSSL rewrite.</text></item><item><author>mrtksn</author><text>O.K. This is probably a stupid question but if it was apparent to many that the code of OpenSSL was horrible why people kept using it and nobody tried to re-factor it? How it is possible that such a popular and critical piece of opensource software  survived the years without a complete face-lift and nobody wrote thorogh documentation?</text></item><item><author>agwa</author><text>I&amp;#x27;ve done quite a bit of programming with the OpenSSL library and this article is only scratching the surface of the awfulness.  Documentation is horrible to non-existent, you really do need to go spelunking into the source to figure out how things work, and the code really is that horrible.&lt;p&gt;The worst thing is that error reporting is not consistent - sometimes -1 means error, other times 0 means error, other times 0 means success, and sometimes it&amp;#x27;s a combination.  This is really, &lt;i&gt;really&lt;/i&gt; bad for a crypto library since properly detecting errors is usually critical to security.</text></item></parent_chain><comment><author>brohee</author><text>Historically  GnuTLS had even more security trouble than OpenSSL (like that bug where it was trusting a self signed root certificate even if not in the certificate store that went undetected for years).&lt;p&gt;And NSS is pretty light on the server code IIRC...&lt;p&gt;In my past as professional code auditor, I&amp;#x27;ve seen OpenSSL shipped with products quite a bit, and in 99% of the cases it was openssl the command line tool that was used to access the functionality because yes, the API is that bad and confusing that people would rather pipe to an executable that use library calls...</text></comment>