One week of OpenSSL cleanup
undeadly.org
undeadly.org
http://anoncvs.estpak.ee/cgi-bin/cgit/openbsd-src/log/lib/li...
[1] http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style
[2] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libssl/src/cry...
[3] http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libssl/src/cry...
edit: formatting
Normally I try to avoid getting into arguments about style and such, it's just bikeshedding. But if the OpenBSD people are going to clean up, review, audit, fix, improve and maintain this code, it makes all the sense to switch to a style they are used to and comfortable with. It also makes sense to nuke all the junk that gets in the way and which they will not and cannot test because it is not at all relevant to the platform.
Besides, the OpenSSL code is a fucking mess.
I spent a couple hours with the OpenSSL source last week, and agree that a major cleanup is necessary. This means
- Rip out unused stuff - Rip out stuff that obviously doesn't work - Make big cleanups
I've done this in the past with token-level tools to ensure that I wasn't breaking things.
OpenSSL desperately needed to have a bunch of garbage removed. It needs good tests, it needs to be slimmed down and made clean so that the code is readable and maintainable.
Frankly I wouldn't trust fixes to the old version anyway, given its state.
In software development it's often the case that the first claim is true, but the second isn't.
> Frankly I wouldn't trust fixes to the old version anyway, given its state.
It will be interesting to see if this get organized and properly funded, given this library's importance to international commerce.
> Frankly I wouldn't trust fixes to the old version anyway, given its state.
Clean slate! An admirable goal, and clearly the best solution. Let's see if this actually happens.
They are transforming a local copy of openssl that tracks upstream changes to their own fork, that probably won't reunite with the upstream version anytime soon.
In the process, they are obviously likely to find some bugs (and they already have fixed one or two harmless ones), but I think they are more interested in building a clean fork for themselves than in fixing the upstream openssl.
1. Let's remove OPENSSL_cleanse: http://anoncvs.estpak.ee/cgi-bin/cgit/openbsd-src/commit/lib...
2. Crap. Let's put it back again: http://anoncvs.estpak.ee/cgi-bin/cgit/openbsd-src/commit/lib...
That plus the 'tone' of the commits makes me wary of these changes.
I'm getting tired of all the people who complain about the humour, tone or style in the commit messages. If you have serious concerns, why not read the diffs and comment on the actual changes? This is how real problems get noticed and corrected.
But some things were in fact removed and put back again, because it turns out some ports depended on it. Sometimes you just don't notice what a few thousand other applications depend on before you remove some code.
It already does what OpenSSL_cleanse is meant to do, so using it makes sense.
"regardless of the practical value of creating single solutions that work everywhere"
Since these are the same folks who do OpenSSH, I would imagine after the initial work is done, it will probably evolve to be as portable as OpenSSH and the other OpenBSD projects.
Also, they are doing many bug fixes as shown on http://opensslrampage.org
This isn't about confirming to their personal style, this is about cleaning the code up so that auditing it is possible.
Regardless, I have mixed feeling about this, one month ago a lot of people lauded openssl for not being vulnerable to the goto fail saga while criticizing Apple for not using openssl and now everyone is ready to ditch openssl in a heartbeat for a flaw not related to crypto, not committed by core developers. I'm not defending openssl, I would love a concerted effort by big industry players for implementing a new SSL/TLS stack from scratch, maybe in a safer language, but I also don't think it is a reason for taking quick, disruptive decisions like this. It is also likely they had this move in mind before this episode and this flaw was the last straw but they should have exposed their plan, it would have been a bit better for us to understand their reasoning.
But if you look at the code, you might come to the conclusion that the upstream is not so focused code quality (security!) as one might hope. There is such a jungle of code that can only be justified by the desire for more features, more portability (to crazy ancient platforms too), more speed, more flexibility... it's all more knobs and code where real security bugs can lurk. And code paths that do not get tested properly. You can also find many outright dangerous idioms used throughout. Does that mean the upstream is ignorant, or that they do not care, or that they do not have the man power to fix their aging code? Either way, it's bad.
The OpenBSD developers have different priorities, and they believe they can do better. As such, not being able to blindly pull changes and updates from the upstream developers they do not trust does not look like a significant loss. If new features are to be merged in, it has to be properly reviewed and adapted. Yes, it's more work that way. But the end result is likely better code.
They use that old equip to find bugs
Also, the $20k was for the power bill. Yes, there are some older systems among the powered ones. But there's more, there's really a rack full of hardware running the infrastructure that makes OpenBSD available to us. There's networking gear, there's AC...
Dobbsbob makes a good point too. The weird hardware OpenBSD runs on helps find bugs; the untested code paths in OpenSSL add bugs.
The thing about crypto is that almost any bug in a crypto library is related to crypto. It can't be easily isolated, and if you try, you have to actually analyze the isolation to make sure that it's really isolated.
"...disruptive decisions..."
Who is it disrupting?
OpenBSD is trying to provide value to their users. If you want slow, steady, incremental, reactive improvements to OpenSSL, every other OS will give you that. OpenBSD apparently believes its users would benefit from a proactive approach to security.
Although if they're going to embark on such an endeavour, maybe it would be best to also rewrite it completely in a memory safe language like Rust (but in a year or two, after Rust becomes more mature).
In fairness it's always been my impression that a BSD distribution is intended to be much more than a mere packager of software, but instead an integrator of those libraries into a sane, coherent overall operating system.
This is the reason OpenSSH has their native version for OpenBSD and then a "portable" version for the rest of the POSIX world.
> They're choosing to switch from a simple packager role to a maintainer role.
This is hardly a leap of faith for the OpenBSD developers. The dev team has always placed an emphasis on security even if the added security meant significant additional work. OpenBSD has a history of creating new software products to replace products that they deemed unacceptable from a security standpoint (including forking netbsd). I imagine that in addition to OpenBSD you are familiar with at least one of these projects:OpenBGPD http://www.openbgpd.org
OpenNTPD http://www.openntpd.org
OpenSMTPD http://www.opensmtpd.org
OpenSSH http://www.openssh.org
-/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */
-#ifndef BIT_FIELD_LIMITS
memcpy(&server.sin_addr.s_addr, ip, 4);
-#else
- memcpy(&server.sin_addr, ip, 4);
-#endif
[^1]: http://freshbsd.org/search?project=openbsd&q=project%3Aopenb...[^2]: http://opensslrampage.org/
[^3]: http://freshbsd.org/commit/openbsd/01f41ed5b37037b963c0de2c2...