3 ms·
Personally, I found it educational that a vital piece of security infrastructure like OpenSSL is a tangled piece of sh... paghetti. When my coworkers and I wri
by dkarl 16y ago
Personally, I found it educational that a vital piece of security infrastructure like OpenSSL is a tangled piece of sh... paghetti. When my coworkers and I write something security-critical in our code (not that I've ever touched anything as important as OpenSSL; I suspect OpenSSL is more critical to our security than any of the code we've written ourselves) we make it as dumb and simple and clear as possible and document it very well. With OpenSSL I would have assumed (did assume) the whole project was implemented that way, bending over backwards for clarity to minimize the chances for a vulnerability, either in the code or due to misuse of the code. It's shocking and interesting to find out that it isn't.
- jrockway 16y agoI'm surprised that you're surprised. It's old code that nobody touches. It's written in C. Of course it's going to be bad. (Why? Because "good" changes every year or so, and if nobody has needed to touch the code for a year, it's going to be bad by definition.) Sure, it's good to clean up old code to minimize the number of unanticipated failures. But this takes time and money; there aren't magic fairies that do things "because they should" or "because it's a critical piece of infrastructure". If it's boring and there is no money to be made, then it's not going to get done. The author shows why; sometimes, it's just easier to hack around the problems than to fix them.
- dkarl 16y agoThe definition of good C code hasn't changed that much. API styles change and compiler capabilities change (gotta love C code with 7-character function names inherited from ancient Fortran code) but undocumented and disorganized is never good. I've used C APIs that were procedural with no OO influence at all, each function taking dozens of parameters, many of which weren't actually used because it was easier to pass the same thirty parameters to each function than to try to remember a unique parameter list for each function consisting of the seventeen parameters it actually needed. I've used APIs like that and groaned and cried and pulled my OO-educated hair out, but some of those APIs were still well-documented, logically arranged, and cleanly implemented, and they were a lot easier to use correctly than code written poorly in a modern style.
- gcv 16y agoIt's written in C. Of course it's going to be bad. You are being unfair. I did a little Samba hacking in recent memory, and found it quite easy to understand and follow. (Granted, I didn't delve into the low-level implementation of Microsoft protocols.) I'm sure other well-written C programs exist.
- neild 16y agoIt's old code that nobody touches. It's written in C. Of course it's going to be bad. Tcl/Tk is old code written in C. It's beautiful code; an absolute joy to work with. It was beautiful ten years ago, and it'll still be beautiful a hundred years from now when it is long forgotten by all but a handful of historians. OpenSSL is a miserable codebase, and always has been. Yes, bitching about other people's code is a popular hobby. Sometimes bitch because it's always easier to write something new than to understand the logic behind something old. And sometimes people bitch because the code is an absolute nightmare to work with. OpenSSL is the latter.