<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bob Wall on Medium]]></title>
        <description><![CDATA[Stories by Bob Wall on Medium]]></description>
        <link>https://medium.com/@bob.wall?source=rss-5cab53a897f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0am3tLA3Y0kVoYBVhzdq1g.jpeg</url>
            <title>Stories by Bob Wall on Medium</title>
            <link>https://medium.com/@bob.wall?source=rss-5cab53a897f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 21:54:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bob.wall/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Get your open source house in order]]></title>
            <link>https://blog.ironcorelabs.com/get-your-open-source-house-in-order-def610994ccc?source=rss-5cab53a897f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/def610994ccc</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[licensing]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Bob Wall]]></dc:creator>
            <pubDate>Tue, 14 Mar 2017 23:26:20 GMT</pubDate>
            <atom:updated>2017-03-14T23:38:43.953Z</atom:updated>
            <content:encoded><![CDATA[<h4>It’s never too early to implement good code hygiene</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pf0oM1iqjIWAo7ui8LePpg.jpeg" /><figcaption>Image courtesy of <a href="http://cliparts.co/clipart/3027388">cliparts.co</a></figcaption></figure><p>It’s a well accepted paradigm of software development that you should avoid rewriting the same code. <em>Don’t repeat yourself</em>, or DRY, when you are writing code — meaning that you should extract repeated patterns into methods that you can reuse. Not much controversy around that idea. On a larger scale, make use of code that is already written, tested, and working if it does what you need. If you find yourself thinking, “You know, I should write my own web server for this project,” chances are pretty good that you should reconsider your career choices.</p><p>There is an amazing array of software packages available for free out there on the Internet, and a lot of companies have built their businesses on top of FOSS (free and open source software). There are some things you need to consider if you choose to utilize an open source package, especially as a core part of your product. What happens if (maybe when) the people that created and are now maintaining the package move on? What happens before that if you urgently need some help with the package? Suppose you encounter a bug that is significantly impacting your operation? If you are using a binary version of a package, do you have a copy of the source, just in case? These are questions that a lot of companies have considered, and they’ve figured out how to resolve them. There are other aspects of using open source that often get less consideration but shouldn’t be ignored, like license terms.</p><h4>Licenses Matter</h4><p>If you spend any time looking at open source projects, you will find that most of them include some sort of LICENSE file that usually contains a copyright notice, some license terms, and maybe a list of contributors. If you think you might want to incorporate one of these packages into your product, you really, <strong>REALLY</strong> want to take a peek at the license and understand it. The file isn’t there just to make sure that the project’s GitHub repository uses enough storage space.</p><blockquote>There are other aspects of using open source that often get less consideration but shouldn’t be ignored, like license terms.</blockquote><p>One really important reason to be aware of license terms is the risk of a “viral infection”. Some licenses are written to stipulate that any software that is created using the licensed software must be covered by the same license. The most well known example is the Gnu General Public License, or GPL. If you compile a chunk of code covered by the GPL and link it into an executable with your code, you have created a <em>derived work</em>, and by the terms of the GPL, all of the derived work is covered by the same license. Well, not exactly. It does mean that the license for your part of the derived work must be <em>compatible </em>with the GPL. Your code has been “infected”!</p><p>One of the immediate consequences of this infection is that you have agreed to make all of the source code covered by the license available to anyone who asks. Yup … all your secret sauce and trade secrets that were in your code are now open source. To make things even better, you have also agreed that any time you distribute the compiled version of the derived work, you will distribute a written offer to provide the source code. Sure, this does mean you can store your project in a free GitHub repo now. That may be scant comfort.</p><blockquote>One really important reason to be aware of license terms is the risk of a “viral infection”.</blockquote><p>There is an alternative version of the GPL, the Lesser General Public License or LGPL, that relaxes some of these requirements. In particular, it allows your program to use a LGPL-licensed library without requiring the entire derived work to be licensed under the LGPL. (In fact, the license was originally called the <em>Library General Public License</em>.) You must still offer to make the source of the library available, but it does not affect your code. However, there are some nuances to the ways that you can access the library from your code; you need to study the requirements of the license and make sure you are using the library in such a way that you avoid unintended consequences.</p><blockquote>Sure, this does mean you can store your project in a free GitHub repo now. That may be scant comfort.</blockquote><p>There are a plethora of other open source licenses in use. You can find a load of information about them at <a href="https://opensource.org/">opensource.org</a>, but the following shows some of the more common ones:</p><p>Safe to use:</p><ul><li>Apache (the Apache License 2.0)</li><li>BSD 2-clause</li><li>BSD 3-clause</li><li>ISC : similar to MIT and BSD 2-clause licenses</li><li>MIT</li></ul><p>Use with caution</p><ul><li>BSD 4-clause (the original BSD license)</li><li>LGPL (the Gnu Lesser General Public License) versions 2.1, 3.0</li></ul><p>Use with extreme caution</p><ul><li>GPL (the Gnu General Public License) versions 2.0, 3.0</li><li>AGPL (the Gnu Affero General Public License) version 3.0</li></ul><p>The first group of licenses are all fairly safe choices that don’t risk making all your software open source. You should still understand any requirements they introduce, though. For instance, although the MIT license is very permissive, it does include this stipulation:</p><blockquote>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</blockquote><p>Old versions of the BSD license (the original <em>4-clause license</em>) included this requirement:</p><blockquote>3. All advertising materials mentioning features or use of this software<br> must display the following acknowledgement:<br> This product includes software developed by the &lt;organization&gt;.</blockquote><p>That clause was removed in newer versions, but this clause remains:</p><blockquote>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</blockquote><p>Just make sure you understand and comply with the terms of each of the licenses. The BSD license is not unique in requiring that you inform your customers that you are distributing the licensed package. Set aside some space in your online help (or printed documentation, if you still kick it old school) to list the open source packages you use. Aside from satisfying the requirement, I think it is worth some good karma to give a hat tip to someone that saves you significant development effort.</p><p>To help make sure you understand your open source situation and can comply with the license terms, I strongly advocate that you keep a list of all the third party software you are using. This might include packages you purchased; you are probably doing this anyway. Include the open source too. Keep track of package names, versions, license terms, and licensors (the copyright holders from whom you licensed the packages). If you have multiple versions of your software out in the wild, keeping this information for each of your versions can be useful. Tracking by version can be handy because once in a great while, a package will change its license.</p><p>To get you started, here is a Google sheet <a href="https://docs.google.com/spreadsheets/d/16UcEimyzX9qxq7Fu0nHc-go9C2A3anktgsvpa9r_fwY/edit?usp=sharing">template</a> you can copy. It’s got some of the most common licenses in a drop down list you can use to select the license, but if the one you need is not there, you can just type in your own. Here’s how I filled out that template for our <a href="https://docs.google.com/spreadsheets/d/1K-bc15bZcRC6-ct7ucnP-Knv4As5tIcouRBJKybBA1I/edit?usp=sharing">open source packages</a> at IronCore Labs.</p><blockquote>I think it is worth some good karma to give a hat tip to someone that saves you significant development effort.</blockquote><p>This doesn’t take much effort if you start the list early and make sure everyone understands the importance of keeping it up to date. You can use this to build a page for your documentation that acknowledges the people that helped make your product what it is, and to help your CTO sleep better at night (which I heartily endorse).</p><h4>Keep It All Updated</h4><p>Tracking the versions of the open source libraries in use in your product also facilitates another essential part of open source hygiene; make sure you keep your third party libraries updated to the latest versions! The maintainers of those libraries aren’t pumping out new versions to practice their typing skills. Some updates might consist only of new features, but usually there are bug fixes included. Pay particularly close attention to any updates that fix security vulnerabilities. Please don’t be one of those companies that is running an unpatched version of OpenSSL that still has the heartbleed bug. Running a business is hard enough without inviting the Internet to poke you in the eye with sharp sticks.</p><p>Monitoring all of your third party packages for version upgrades and determining which of those upgrades are essential to install into your product can be a time consuming task. That’s part of what you signed up for when you decided to use the packages. Console yourself with the fact that it is probably still a lot less effort than writing the whole thing from scratch, then finding and fixing all of those bugs yourself.</p><blockquote>Make sure you keep your third party libraries updated to the latest versions!</blockquote><h4>A Cautionary Tale</h4><p>If you are a startup, you can make your life a lot easier by getting into these habits and keeping good records ASAP. If you work hard, eat all your broccoli and brussel sprouts, and grow strong enough to attract the attention of someone that might want to purchase your company, failure to pay attention to this little detail might impact you in a lot of different ways, from making the due diligence process rough and rocky (and probably a lot longer than you were hoping) to possibly torpedoing the deal.</p><p>I had the “learning opportunity” to experience this first hand. A previous company for which I worked was pretty diligent about keeping track of the third party software it used, both purchased and open source. Quarterly, I was responsible for loading all of our source code into Black Duck Software’s Protex (a tool that scans source code for matches to known open source projects), to resolve any matches it found, and to keep our list of software licenses updated. I was surprised, occasionally amazed, and once in a while mightily annoyed by lapses in judgement by fellow developers who found some awesome package on the Web and slid it into the code base without doing any of the requisite bookkeeping. Luckily, Black Duck was good at finding those oversights and helping us to keep our license tracking on the up-and-up.</p><p>Eventually, we attracted the attention of a much larger company that made an offer to acquire us — a huge company with a huge legal team. As we entered due diligence, part of that huge legal team focused on … you guessed it … the licensing for any third party software we used. Even though we kept pretty good records, the process of assuring them of that fact and of resolving issues that they raised with our licenses was long, complicated, and painful. They were familiar with Black Duck, and in fact they used it to analyze the source code of companies when doing due diligence. This actually helped to get the review going quickly.</p><p>There were several reasons that things bogged down; most importantly, they did not completely agree on the list of acceptable licenses. For instance, if one of our developers found a chunk of code posted on a site like Stack Overflow and the author had not included any kind of license (which was usually the case), we assumed the code was placed in the public domain and therefore fair game for use in the product. (If the author didn’t intend it to be public domain, why would she publish it online?) Our acquirer considered anything without an explicit license as a problem that required remediation. (They eventually convinced me that this was probably a reasonable policy.) We had some fundamental (and quite heated) disagreements on the implications of forking and execing a GPLed utility from our software. (I eventually conceded on this point without agreeing.) We had a <strong>lot</strong> of code, with a lot of third party software, so there were a lot of things to scrutinize and resolve.</p><p>Before the exercise was complete, I was pretty sure that I would be joining the ranks of the unemployed rather than transitioning into the new company with my colleagues. There were some pretty tense meetings involving raised voices, a little banging on tables, and on a couple of occasions vocabulary that would make a sailor blush. We made it through to a successful acquisition with a list of problems to remediate, and I even managed to still have a job. I can’t imagine how the process would have unfolded if we went into it with no idea about our third party software usage. I am sure it would have been bad. Not “Ouch, I stubbed my toe” bad. Think more of scenes from “The Exorcist” or “Alien”.</p><h4>No Free Lunch</h4><p>I am frequently amazed by the variety and quality of open source available now. There are a lot of people out there doing great work for nothing or next to it. Taking advantage of their efforts can provide a significant boost to your development effort. But it’s not completely free; you do need to consider issues like support and code escrow. You need to commit to keeping the packages you use up to date with security patches and bug fixes. And you really should keep track of licenses. In the grand scheme of things, that’s a pretty small price to pay.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=def610994ccc" width="1" height="1" alt=""><hr><p><a href="https://blog.ironcorelabs.com/get-your-open-source-house-in-order-def610994ccc">Get your open source house in order</a> was originally published in <a href="https://blog.ironcorelabs.com/">The Salty Hash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[T Plus Three Weeks]]></title>
            <link>https://blog.ironcorelabs.com/t-plus-three-weeks-213274529840?source=rss-5cab53a897f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/213274529840</guid>
            <category><![CDATA[founders]]></category>
            <category><![CDATA[techstars]]></category>
            <category><![CDATA[accelerator]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <dc:creator><![CDATA[Bob Wall]]></dc:creator>
            <pubDate>Mon, 13 Feb 2017 05:14:52 GMT</pubDate>
            <atom:updated>2017-02-13T05:14:52.685Z</atom:updated>
            <content:encoded><![CDATA[<h4>A view of the Techstars accelerator from inside the capsule</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*BkqVqbZ8aIIi92zhhYujnA.jpeg" /><figcaption>Photo courtesy of <a href="https://images.nasa.gov/#/details-S69-39962.html">NASA</a></figcaption></figure><p>IronCore Labs has the amazing good fortune of being in the 2017 Techstars Boulder class. We just made it through the third week of the program. Yesterday, I was talking to David Mandell after he gave a killer workshop — he asked me how things were going and what I thought about the program so far. After I responded enthusiastically, he said “Tell people about it. Blog about it.” So here goes …</p><h3>How We Got Here</h3><p>A little over two years ago, a coworker of mine, Patrick Walsh, approached me with an idea that he thought might be worth spinning up a company to pursue. We kicked it around, twisted, hammered, and mashed on it, deformed it a little, and got more comfortable with the idea. We were careful about not really working on it, to avoid entanglements with the company where we worked, but enthusiasm grew. Then we started thinking about how and when to get serious. We got the idea that we should take a stab at Techstars. Unfortunately, we got that idea about a month before the application deadline. In for a penny, in for a pound — the next Monday, we both turned in our two weeks’ notice. Two Mondays later, we were all in, working on the application and getting the company formed.</p><p>To say that our plan was a little raw would be very generous. The Techstars application was a long shot, and we weren’t surprised when we weren’t accepted. We went to work, refining the idea, fleshing out IP, talking to customers. In the summer of 2016, we had conversations with Julie Penner and Natty Zola, managing directors of the Boulder program, and they encouraged us to apply again. I feel pretty sheepish admitting it now, but we debated quite a bit about whether we should do it. Would we get enough out of it to justify the equity and, more importantly, to offset the hit to product development while we were immersed in the program?</p><p>We decided to go for it. We also decided that we needed to get a dev team on board so that we could keep building product. Submitting the application served as a forcing function to raise money. The two things got intertwined; as we moved through the review process and made it through gates toward getting accepted, investors got more interested. We ended up securing funding not long after we got the notification that we were invited to join the 2017 Boulder program. I am not sure we would have raised the money at that time without the anticipation that we could get into the program, and I am not sure we would have accepted the invitation if we couldn’t raise the money.</p><p>We immediately hired two full time software engineers from my neck of the woods (Bozeman, MT) and a half-time mathematician in Boulder, just in the nick of time. I loaded up the car and drove from Bozeman to Boulder the day before the program started, and the two engineers from Bozeman got here that night. Their first day with the company was the first day of the program, and we were all in Boulder for the first week. They went back to Bozeman to build cool stuff, and I am in Boulder for the duration.</p><h3>Climb onto the rocket, light the fuse</h3><p>The first three weeks of the program have been <strong>INTENSE</strong>. Not intense. Not <em>intense</em>. I’m talking “Holy frying brains, Batman, this is <strong>INTENSE</strong>!” They told us it would be like this. I was thinking, “Yeah, sure. We’ll be busy. I’ve been busy before. How bad can it be?” But this wasn’t just busy. It wasn’t just a lot of learning, like cramming a semester-long calculus class into three weeks. It was those things, to be sure, but it was a lot more.</p><p>The first week, after we got through the orientation and level setting, the program had a lot of top notch workshops covering techniques to organize our business, focus, plan, etc. On top of that, we were scrambling to make sure that everyone on our team understood what we were working on and when. We got through the week feeling pretty good about that. It was busy, we learned a lot, we drank a few beers, and life was good.</p><blockquote>I’m talking “Holy frying brains, Batman, this is INTENSE!”</blockquote><p>Then we descended into “mentor madness”. A key focus of the Techstars program is assembling a group of people with a ton of entrepeneurial experience and helping to connect young startups with those mentors. I knew this, and I thought I had a fair idea of what that meant. Boy, was I wrong!</p><p>The second week of the program was focused on meeting most of the mentors and trying to identify where there was some mutual interest and some interpersonal chemistry. In a series of 20-minute “speed dates” with one or two people at a time, spread over three days, we met more than 60 potential mentors. Just interacting with 60 people at a level considerably deeper than “hi, what brings you to town” in three days would be a decent effort. But these weren’t random people — I was floored by both the quantity and the quality of the talent that had volunteered to fling themselves into this maelstrom! The mentors had a wealth of experience, and they covered a lot of core competencies— technology, product, sales, marketing, operations, building teams, and so many more. There were no meetings that I wished would end sooner, and we ended up with valuable insights and advice from almost all of them.</p><blockquote>I was floored by both the quantity and the quality of the talent that had volunteered to fling themselves into this maelstrom!</blockquote><p>I was still upright at the end of the week, but man, was I exhausted. Not like I had been digging post holes all week, but like my brain had been stretched. (Turns out, that can be just as exhausting. Although my back didn’t hurt as much!) We had gotten so many new things to consider, so many challenges to assumptions we had made.</p><p>Based on feedback we and the mentors submitted, the Techstars team evaluated matches where there was mutual interest and set up a series of “deep dive” meetings for week three. My hat is off to Julie, Natty, and the rest of the team — they did this matching exercise for thirteen companies and over 60 mentors. Not something you could bang out over a beer while watching reruns of Bonanza.</p><p>Week three was almost as daunting as week two. This time, the people we were meeting already knew who we were and what we were doing, and they wanted to know how they could help. We got a truckload of invaluable advice and suggestions; not one of those little Toyota pickups, not a Ford F350. We’re talking a serious cargo hauler full of great ideas, with a couple of pup trailers full of questions tagging along. I am confident that the search for answers to those questions will help us find the road to success for the company.</p><p>Going forward, several of the people we met this past week will be mentors that we will engage on a regular basis as we work through the program. They have committed to providing us that regular interaction, with no expectation of anything in return. We hope to work with others on a little less regular cadence, but I am sure we are going to learn a lot from them. We didn’t meet with anyone this past week that didn’t give us some great help. Getting to this point in the evolution of the company, I’ve met people that helped me, with no expectation of compensation. They just did it because they are giving people. Getting connected to such a big pool of people that didn’t know us from Adam who are all so giving and altruistic has truly been a revelation.</p><blockquote>We got a truckload of invaluable advice and suggestions; not one of those little Toyota pickups, not a Ford F350.</blockquote><p>And it’s not just the mentors in Boulder. I had also heard about the “Techstars network” before arriving here, and I had similar thoughts. “Oh, that sounds nice, but how much of a benefit will it really be?” After only three weeks, I am realizing just how naïve I was. Turns out there are people around the globe that are just as willing to help out as the mentors we met here in Boulder. A <strong>lot</strong> of them. BAM! Mind blown.</p><p>It has truly been a pleasure getting to know the other companies that are in our class, too. I am glad to see that there isn’t an atmosphere of competition; it’s very much a feeling of cooperation and collaboration. I expect that we will get help and insights from the other members of the class over the duration of the program, and I hope I can give some help back to them.</p><blockquote>Getting connected to such a big pool of people that didn’t know us from Adam who are all so giving and altruistic has truly been a revelation.</blockquote><h3>Pouring on the Gas</h3><p>Now we are through working out our mentors, and it’s time to really dig in on the company, the market, the product, and so many other things. Time to try to get the most out of the wealth of data we were handed in the last three weeks. Time to take advantage of the generosity of this community. The first three weeks of the Techstars program totally kicked my ass, in the best way imaginable. It’s inevitable that something like getting into an accelerator will push you to kick it up a notch. But I am convinced that this is really a much more fundamental boost. Now we just need to take advantage of it.</p><p>I know that personally, I will never forget this experience. It is humbling to benefit from the generosity. I don’t know if I can be as helpful to some up-and-coming entrepeneur in the future as all the people I met in the last three weeks have been to me, but I will sure try.</p><blockquote>The first three weeks of the Techstars program totally kicked my ass, in the best way imaginable.</blockquote><p><em>Thanks, </em><a href="https://medium.com/u/5e8bcd6f9c98"><em>David Mandell</em></a><em>, for the prompt to put pen to paper. And for the great workshop. And for contributing so much to this community.<br>Thanks to everyone at Techstars, and especially to </em><a href="https://medium.com/u/cf95daebbb5e"><em>Julie Penner</em></a><em> and </em><a href="https://medium.com/u/7077319ef9f5"><em>Natty Zola</em></a><em>, for giving us the push to get here, and for making the program incredible.<br>And thanks to everyone that is involved as a mentor or in some way helps the Techstars program and the broader entrepeneurial community. May all the good karma serve you well.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=213274529840" width="1" height="1" alt=""><hr><p><a href="https://blog.ironcorelabs.com/t-plus-three-weeks-213274529840">T Plus Three Weeks</a> was originally published in <a href="https://blog.ironcorelabs.com/">The Salty Hash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crypto Lions and Tigers and Bears … Oh My!]]></title>
            <link>https://blog.ironcorelabs.com/crypto-lions-and-tigers-and-bears-oh-my-db3076e1b52c?source=rss-5cab53a897f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/db3076e1b52c</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Bob Wall]]></dc:creator>
            <pubDate>Thu, 08 Sep 2016 22:34:08 GMT</pubDate>
            <atom:updated>2016-09-09T21:26:08.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKNNxQgLemtn6u5O67ImVg.jpeg" /><figcaption>Photo: Noah’s Arc Animal Sanctuary</figcaption></figure><h4>In which the author adventures through the wilderness of cryptography libraries</h4><p>I recently had occasion to plumb the depths of the OpenSSH, OpenSSL, and GPG libraries in a fair amount of detail (that “stepping through the source code in <em>gdb</em> as it runs” kind of detail), as I endeavored to create an alternative version of the <em>sftp </em>utility that provides end-to-end encryption of files and secure sharing of those files with other users. Along the way, my colleague and I decided to make our key data and encrypted files compatible with GPG, as I describe here:</p><p><a href="https://blog.ironcorelabs.com/how-wise-is-the-conventional-wisdom-on-cryptography-14d106ba287a">How Wise Is the Conventional Wisdom on Cryptography?</a></p><p>That necessitated a pretty deep dive into the <a href="https://www.gnupg.org/">GnuPG</a> code, which was rough. Sure, there’s a spec out there — <a href="https://tools.ietf.org/html/rfc4880">RFC 4880, OpenPGP Message Format</a>. That should make it pretty simple, right? Well, not so much. The spec has some ambiguity, which is less than ideal for a spec. Try to figure out what the signature for a data packet should look like and contrast that to what a signature for a public key should look like, for example. On top of that, GPG introduces some idiosyncracies of its own. To top it off, we need a “modern” version of GPG that supports the elliptic curve algorithms. These modern versions have started using constructs that aren’t part of the OpenPGP spec for things like storing the private key files. There wasn’t any choice but to dig through the source. And, since I wanted to avoid linking any of the <em>gpg/libgcryp</em>t code into OpenSSH, I had to spend some time figuring out how to do the same things using the OpenSSL crypto libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*TKbJd8YdnnKxW8KuamoLpQ.jpeg" /><figcaption>Photo via <a href="https://pixabay.com/en/tiger-animal-wild-wildlife-nature-484097/">pixabay</a></figcaption></figure><p>So there I was, <em>libgcrypt</em> S-expressions on one side, OpenSSL <strong>bignums</strong> on the other, me stuck in the middle. It was the coding equivalent of refereeing a face-off between a rabid saber toothed tiger hopped up on energy drinks and a hung over grizzly bear with anger management issues. OK, that’s maybe just a <em>little</em> hyperbolic. But it felt very daunting some days.</p><blockquote>It was the coding equivalent of refereeing a face-off between a rabid saber toothed tiger hopped up on energy drinks and a hung over grizzly bear with anger management issues.</blockquote><p>Here are a couple of examples from a long sequence of head-scratching puzzles. First up, one of those little GPG idiosyncracies. The OpenPGP message format starts with a <em>tag </em>byte, followed by the message length (which can by one or more bytes, depending on the value it stores), followed by the message body. One of the messages stored in a key file is a <em>User Identification</em> message, or UID. The UID is just text, usually something like “Gumby &lt;rubber.man@nowhere.com&gt;”, that is associated with a key as an identifier. Unless you have a <strong>really</strong> long name or email address, this is likely to fit into 256 bytes. This means that the message header would be two bytes long. And in fact, that’s the way GPG writes it when generating a new key. But … when you are hashing the public key and corresponding UID messages to generate a signature, GPG does this:</p><pre>static void<br>hash_uid (gcry_md_hd_t md, int sigversion, const PKT_user_id *uid)<br>{<br>  byte buf[5];<br>  (void)sigversion;<br>  buf[0] = 0xb4;                   /* Indicates a userid packet.  */<br>  buf[1] = uid-&gt;len &gt;&gt; 24;         /* Always use 4 length bytes.  */<br>  buf[2] = uid-&gt;len &gt;&gt; 16;<br>  buf[3] = uid-&gt;len &gt;&gt;  8;<br>  buf[4] = uid-&gt;len;<br>  gcry_md_write( md, buf, 5 );<br>  gcry_md_write (md, uid-&gt;name, uid-&gt;len );<br>}</pre><p>For starters, I don’t even know what “(void)sigversion;” does. I’ve never seen that before in C code. Then, I don’t know why you would force the length of the message to be four bytes. For that matter, I am not sure why you would hash the fields that make up the message in one place and serialize the message in another. GPG does that frequently. I much prefer our implementation inside <a href="https://github.com/IronCoreLabs/ironssh">IronSSH</a>:</p><pre>  gpg_packet * pubkey_pkt = serialize_pubkey(...);<br>  gpg_packet * uid_pkt = serialize_uid(...);<br>  hash_packet(md, pubkey_pkt);<br>  hash_packet(md, uid_pkt);</pre><p>As a side benefit, if someone is validating the hash, she doesn’t need to deserialize the data and recompute the hash one field at a time. That’s a nice thing to do.</p><p>In gpg-compatible data, large numbers are stored as “multi-precision integers” (MPIs) — the data consists of a two-byte length in bits, followed by enough bytes to hold that many bits. Well, unless the most significant bit is a 1. Then, since in crypto pretty much all the values are unsigned, and gcrypt MPIs support signed numbers as well, it is necessary to add a byte of zeroes in front. OK, no problem. Except when you are generating the “keygrip” for an elliptic curve public key. (In GPG, a keygrip is a string representing a public key. It’s similar to, but not the same as, the key fingerprint. Why have two different shorthand names for a public key? That’s something you will need to ask the GPG developers.) Then, for some reason, you do not add the zero byte, even if the high bit is set. What the …?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*YWMH_LDvi8EmeCZ5ghjsiQ.jpeg" /><figcaption>Photo via <a href="https://pixabay.com/en/leo-animal-savannah-lioness-safari-350690/">pixabay</a></figcaption></figure><p>Similarly, <em>gpg</em> uses a prefix byte on elliptic curve points (like a curve25519 public key) to indicate that the value is just the point’s X coordinate, not both the X and Y coordinates. This is true most places you run across one of these point values. Unless you are still struggling to compute the keygrip for an elliptic curve public key, after you figured out that zero byte padding thing. Then, you don’t add the prefix. <strong>ARGH! </strong>Figuring out these two things was a fun little exercise with <em>gdb</em>, because the data that was generated was run through a hash, so it wasn’t obvious looking at the output why things didn’t match up between my calculations and <em>gpg</em>’s.</p><p>Throwing <em>libsodium</em> into the mix complicated things even further. I didn’t dig through the <em>libsodium</em> source too much, but I did look at some of it. It’s newer and has less historical entanglements, but there are still some oddities. For instance, elliptic curve key pairs consist of a public key that is a point on the curve and a secret key that is a multiplier for that point. In curve25519, the variant of ECC that <em>libsodium</em> implements, the private key is “clamped” — its highest bit and lowest three bits are set to zero, and the next to highest bit is set to one. I had read about this, but after looking for it in the key generation code and not finding it, I had to surrender, join a mailing list, and plead for a hint. It was revealed that the private key doesn’t get clamped when it is generated — instead, the clamping operation is wired into the function that multiplies a point by a scalar. Huh?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*wO3GEGmXmLWr3tTFRwah5g.jpeg" /><figcaption>Photo by <a href="http://tumblr.unsplash.com/post/95144456119/download-by-thomas-lefebvre">Thomas Lefebvre</a></figcaption></figure><p>Figuring out the interop between <em>libsodium</em> and <em>gpg / libgcrypt</em> was interesting. For instance, after generating a curve25519 key pair, I store it in a GPG-compatible key file. In the process, I discovered (the hard way) that <em>libsodium</em> generates the private key in a little endian format, so the first byte in the array holds the least significant bits of the value. <em>libgcrypt</em> expects the bytes in the opposite order. OK — after some more code scrutiny to figure this out, reverse the key before writing the file. And of course, you would reverse the public key (the X coordinate of a point on the curve), right? Nope! To this day, I don’t understand why <em>libsodium</em> manipulates the two values differently. I am sure it has something to do with efficiency when computing the product on a little-endian processor or something, but that’s just a guess.</p><p>Lest you think that OpenSSL is just the plucky sidekick in this horror story, contemplate for a second this function:</p><pre>int RSA_memory_lock(RSA *r)<br>{<br>  int i, j, k, off;<br>  char *p;<br>  BIGNUM *bn, **t[6], *b;<br>  BN_ULONG *ul;</pre><pre>  if (r-&gt;d == NULL)<br>    return (1);<br>  t[0] = &amp;r-&gt;d;<br>  t[1] = &amp;r-&gt;p;<br>  t[2] = &amp;r-&gt;q;<br>  t[3] = &amp;r-&gt;dmp1;<br>  t[4] = &amp;r-&gt;dmq1;<br>  t[5] = &amp;r-&gt;iqmp;<br>  k = sizeof(BIGNUM) * 6;<br>  off = k / sizeof(BN_ULONG) + 1;<br>  j = 1;<br>  for (i = 0; i &lt; 6; i++)<br>    j += (*t[i])-&gt;top;<br>  if ((p = OPENSSL_malloc_locked((off + j) * sizeof(BN_ULONG))) == NULL) {<br>    RSAerr(RSA_F_RSA_MEMORY_LOCK, ERR_R_MALLOC_FAILURE);<br>    return (0);<br>  }<br>  bn = (BIGNUM *)p;<br>  ul = (BN_ULONG *)&amp;(p[off]);<br>  for (i = 0; i &lt; 6; i++) {<br>    b = *(t[i]);<br>    *(t[i]) = &amp;(bn[i]);<br>    memcpy((char *)&amp;(bn[i]), (char *)b, sizeof(BIGNUM));<br>    bn[i].flags = BN_FLG_STATIC_DATA;<br>    bn[i].d = ul;<br>    memcpy((char *)ul, b-&gt;d, sizeof(BN_ULONG) * b-&gt;top);<br>    ul += b-&gt;top;<br>    BN_clear_free(b);<br>  }</pre><pre>  /* I should fix this so it can still be done */<br>  r-&gt;flags &amp;= ~(RSA_FLAG_CACHE_PRIVATE | RSA_FLAG_CACHE_PUBLIC);</pre><pre>  r-&gt;bignum_data = p;<br>  return (1);<br>}</pre><p>Yes, the only comment in the whole thing is some cryptic TODO note that may no longer have meaning to even the original author!</p><p>I am an unapologetic C jockey, so I like my pointer arithmetic as well as the next nerd. But seriously?!? Even armed with the following knowledge:</p><ul><li>those fields <em>d, p, q, dmp1, dmq1,</em> and <em>iqmp</em> are the parameters for an RSA private key</li><li>each of them is a pointer to a BIGNUM</li><li>the <em>d</em> field in a BIGNUM is a pointer to an array of BN_ULONGs that hold the data</li><li>the <em>top</em> field in a BIGNUM holds the number of unsigned longs that have been used in <em>d</em></li></ul><p>it’s a bit of a stretch to figure out what’s happening here. Seems like there would be a more understandable way to copy the contents of a set of parameters into some locked memory. How confident would you be that this code correctly “locked” the memory storing that RSA key? Maybe you are a proponent of test-driven development, and you prefer to let your tests do the explaining. Lots of luck finding a test for this code anywhere.</p><p>These are just a few things I ran across while combing through the GPG and OpenSSL code, and trying to match them up with LibSodium. I didn’t need to dig too deeply into the bowels of the crypto code. Given the things I did find, I think it would be appropriate to post</p><blockquote>Here there be dragons.</blockquote><p>across the source and try to avoid as much as possible! If you find that you can’t avoid the code, here are some observations:</p><p><strong>GPG/libgcrypt:</strong> Less comment-free than the others. A lot of code is supporting old algorithms and formats. The message formats are from a time when people worried about every bit of every byte (which might be great for 14kbps modems, but is not great for people trying to decipher the data). Some of the data structures are annoyingly obtuse (for example, there are at least three different representations for their ubiquitous <em>S-expressions</em>). Code organization could be quite a bit better. <strong>Grade: D+.</strong></p><p><strong>OpenSSL:</strong> Comments are rare and exotic. Code is organized in a fairly understandable way. There is plenty of code supporting old algorithms, and there are cryptic acronyms galore. <strong>Grade: C-.</strong></p><p><strong>OpenSSH: </strong>Comments are few and far between. Most of the crypto code is deferred to OpenSSL; there is a small core of code that will allow you to build a crippled version without OpenSSL, and that code is very cryptic. The project is saddled with a little backward compatibility with the SSHv1 protocol. <strong>Grade: C+.</strong></p><p><strong>LibSodium:</strong> Pretty simple API. There are a lot of layers to the implementation onion, though. Code is fairly well organized and benefits from being pretty new. <strong>Grade: B.</strong></p><p>There is a lot of room for improvement in all of the older projects, particularly if they could be freed of the requirement to support every version they released since the dawn of time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db3076e1b52c" width="1" height="1" alt=""><hr><p><a href="https://blog.ironcorelabs.com/crypto-lions-and-tigers-and-bears-oh-my-db3076e1b52c">Crypto Lions and Tigers and Bears … Oh My!</a> was originally published in <a href="https://blog.ironcorelabs.com/">The Salty Hash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Wise Is the Conventional Wisdom on Cryptography?]]></title>
            <link>https://blog.ironcorelabs.com/how-wise-is-the-conventional-wisdom-on-cryptography-14d106ba287a?source=rss-5cab53a897f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/14d106ba287a</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Bob Wall]]></dc:creator>
            <pubDate>Thu, 08 Sep 2016 22:33:46 GMT</pubDate>
            <atom:updated>2016-09-09T01:40:17.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1chR5mHfoqvyJ-1sQsO5Hg.jpeg" /><figcaption>Original photo credit <a href="https://unsplash.com/collections/206106/ruins?photo=cjOWoz4iq7k">David Brooks</a> with modifications by IronCore Labs.</figcaption></figure><p>My company, <a href="https://ironcorelabs.com/">IronCore Labs</a>, is building end-to-end encrypted data sharing solutions. We are thus very sensitive to expectations about how crytographic functionality is implemented and used. We want users and experts to agree that we did the job correctly.</p><p>The conventional wisdom on crypto libraries goes something like this: “<strong>DO NOT</strong>, under any circumstances, attempt to implement your own cryptography code. You <strong><em>will</em></strong> mess it up. Use libraries that have been out there and have been scrutinized for years. They get it right.”</p><p>I’m in 100% agreement … up until that last statement, “<em>They get it right.</em>” As anyone who has played with crypto knows, getting it right is hard. There are a lot of ways to mess up, even if you aren’t implementing your own hot new version of the best cryptographic technique ever, <em>rot13</em>. (Oldsters will get that. Youngsters, let me <a href="https://www.google.com/#q=rot13">Google it for you</a>.) You can string together accepted primitives in ways that introduce security vulnerabilities — really twisted, non-obvious, almost inscrutable vulnerabilities. You can create opportunities for nasty side channel attacks that are hard to predict. But if they are there, some devious genius will be through your crypto and pwning your data in no time. So yes, you should use libraries that implement algorithms that have been proven secure, assembled correctly, and audited for vulnerabilities.</p><blockquote>Use libraries that have been out there and have been scrutinized for years.</blockquote><p>But how good are those libraries? Another part of the conventional wisdom holds that open source code is better, because there have been a lot more eyes on it. That is probably true. However, “better” is not necessarily “good”. Serious OpenSSL vulnerabilities are still being found regularly. 17+ years of people tromping through that code haven’t managed to squash all the bugs out of it. On the contrary, those 17 years of tromping people are a big part of the problem.</p><p>I recently had the “opportunity” to dig through the <a href="http://www.openssh.com/">OpenSSH</a>, <a href="https://www.openssl.org/">OpenSSL</a>, and <a href="https://www.gnupg.org/">GPG</a> libraries in a fair amount of detail. It was an extremely painful experience. We at IronCore Labs decided to<a href="https://blog.ironcorelabs.com/introducing-ironsftp-908523a388f#.wt2k5suu2"> add end-to-end encryption to the ubiquitous <em>sftp</em> utility</a> as a quick little project to make it easy for anyone to reap the benefits of better security and simple, secure file sharing. Seemed like a great plan. I grabbed the <a href="https://github.com/openssh/openssh-portable"><em>openssh-portable</em> project</a> and started looking through it. Hmm — all C code, but that wasn’t too bad. I’ve been hacking C code for longer than I care to admit, and it didn’t look like the changes would be too extensive.</p><blockquote>On the contrary, those 17 years of tromping people are a big part of the problem.</blockquote><p>We decided to use elliptic curve cryptography for our public key encryption. It’s got some big advantages over RSA and the other older public key algorithms. OpenSSH relies on the <a href="https://github.com/openssl/openssl">OpenSSL library</a> for its crypto routines, but the elliptic curve support in OpenSSL is still in flux, so I grabbed the <a href="https://www.gitbook.com/book/jedisct1/libsodium/details">Sodium crypto library</a> (libsodium). Really simple interface, great performance — what wasn’t to like? I didn’t really need to go digging in the OpenSSL code much, which was frankly quite a relief, after I did initial reconnaissance. That code is older and more crufty than the OpenSSH code. Partly to be expected — that’s where all the complicated crypto lives. In any event, I didn’t mind passing on the opportunity to dive in there. I put together a quick proof of concept with libsodium and the OpenSSH sftp client. Things were looking good.</p><p>Then my colleague <a href="https://medium.com/u/e5530e03d517">Patrick Walsh</a> said “Hey, wouldn’t it be a good idea to use a standard file format for the encrypted files? We could make everything compatible with PGP.” “Sure, ” I said. “That sounds like a great plan. Using a standard format is never a bad move, and people could use <em>gpg</em> to decrypt our files if they wanted.” Such an innocent conversation. Little did I know …</p><p>The process of adding GPG compatibility to our new <em>ironsftp </em>utility was long and arduous. For the morbidly geeky, I wrote a separate missive detailing some of the trials and tribulations along the way:</p><p><a href="https://blog.ironcorelabs.com/crypto-lions-and-tigers-and-bears-oh-my-db3076e1b52c">Crypto Lions and Tigers and Bears … Oh My!</a></p><p>Suffice it to say, it was a painful process unraveling the warts and rats’ nests in libraries of nearly comment-free C code, some of it more than 15 years old, that have been hacked repeatedly over the years. (I should admit that at times I used language that would make a sailor blush.) No wonder bugs lurk undiscovered for years. <strong>The code is just not conducive to understanding.</strong> I am not the only one that finds aspects of these packages as appealing as juggling rotten eggs wrapped in razor wire! I found this exchange in <a href="https://news.ycombinator.com/item?id=9593916">a security discussion</a>:</p><blockquote>&gt; Could you make a recommendation for or against using GPG, since that’s by far the most common approach for asymmetric signatures?<br>Avoid if possible. The code was written by a colony of drunk monkeys, in an era before anyone understood the basics of modern cryptography; I’m really not sure which is worse between gnupg and OpenSSL. Of course, GPG is the standard for encrypted email, just like SSL/TLS is the standard for web sites, so you may have no choice…</blockquote><p>Lest I sound too harsh, I understand that there are reasons for a lot of this. C is not the ideal language for writing concise error-free code, but in the late 90s, what were you going to use for crypto implementations? And any code base is going to acquire some bit rot over the years, particularly as new functionality is added. It’s inevitable. And anyone who’s worked on software knows that once you release something into the wild, you are stuck with it forever. I honestly empathize with the maintainers of these libraries; maintaining backward compatibility can be a heavy burden. They are saddled with the existence of data that might have been encrypted or signed in 1998 using algorithms that are no longer relevant. It’s great to have a program around that can still get at that data, but this baggage has serious consequences to the maintainability and security of code that we really, <strong>really</strong> want to be rock solid.</p><p>Maybe it’s time to freeze the old code, rename it “legacy”, and make a clean start. Use the new hotness to hash, sign, and encrypt new data. Use modern languages and paradigms that can provide good performance without being prone to self-destruction. Document the code while we’re at it. You know, do our future selves a favor.</p><blockquote>It’s great to have a program around that can still get at that data, but this baggage has serious consequences to the maintainability and security of code that we really, <strong>really</strong> want to be rock solid.</blockquote><p>Others are taking steps in this direction. The <a href="http://www.libressl.org/">LibreSSL</a> and <a href="https://boringssl.googlesource.com/boringssl/">BoringSSL</a> projects are both stripping old code from OpenSSL. They have dropped support for old platforms, so they can take advantage of modern OS, library, and compiler features to improve security. Kudos — I hope we see good adoption of these libraries!</p><p>The moral of this story? There are probably several. First, a short-term self preservation one: if someone at work says “Hey, let’s make our data format GPG compatible!”, run screaming. Really. Scream loudly, so your colleague knows you are serious. A deeper, more philosophical thought: conventional wisdom worth its salt is based on valid ideas. However, we should always be willing to reexamine our baseline and reevaluate our assumptions. We’ve stretched our trust in these old crypto libraries past the breaking point. The wisdom of sticking with the tried and true must be measured against the risk of those mountains of technical debt.</p><blockquote>Maybe it’s time to freeze the old code, rename it “legacy”, and make a clean start.</blockquote><p>Has the time come to replace our old crypto tools with shiny new ones? Given my recent coding adventures, I’m leaning pretty hard toward “Most definitely!” As a friend suggested, “Nuke it all from orbit. It’s the only way to be sure.” Or as another friend aptly observed:</p><blockquote>While we as an industry respect and value the contributions of our OSS crypto forefathers, we must demand a fresh start to progress toward more secure communication.</blockquote><p>I couldn’t agree more. At IronCore Labs, we’re working on fresh starts and better security. Please check out <a href="https://ironcorelabs.com/products/ironsftp/">our open-source <em>ironsftp </em>utility’s home page</a>, or <a href="https://github.com/IronCoreLabs/ironssh">the source code that we’ve published on GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14d106ba287a" width="1" height="1" alt=""><hr><p><a href="https://blog.ironcorelabs.com/how-wise-is-the-conventional-wisdom-on-cryptography-14d106ba287a">How Wise Is the Conventional Wisdom on Cryptography?</a> was originally published in <a href="https://blog.ironcorelabs.com/">The Salty Hash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>