<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DE4DRXYzfSp7ImA9WhVSE08.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649</id><updated>2012-03-09T13:02:54.885-08:00</updated><category term="dictionary attacks" /><category term="passwords" /><category term="CAPTCHAs" /><title>A Few Thoughts on Cryptographic Engineering</title><subtitle type="html">Some random thoughts about crypto.  Notes from a course I teach.  Pictures of my dachshunds.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.cryptographyengineering.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>56</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AFewThoughtsOnCryptographicEngineering" /><feedburner:info uri="afewthoughtsoncryptographicengineering" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DE4DRXYyfSp7ImA9WhVSE08.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-8855755118504305921</id><published>2012-03-09T12:33:00.000-08:00</published><updated>2012-03-09T13:02:54.895-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-03-09T13:02:54.895-08:00</app:edited><title>Surviving a bad RNG</title><content type="html">&lt;a href="http://factspy.net/wp-content/uploads/2011/11/airplane01.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="159" src="http://factspy.net/wp-content/uploads/2011/11/airplane01.jpg" width="200" /&gt;&lt;/a&gt;A couple of weeks ago I wrote a long post about &lt;a href="http://blog.cryptographyengineering.com/2012/02/random-number-generation-illustrated.html"&gt;random number generation&lt;/a&gt;, which I find to be one of the most fascinating subjects in cryptography -- mostly because of how &lt;i&gt;terrible&lt;/i&gt;&amp;nbsp;things get when people screw it up.&lt;br /&gt;
&lt;br /&gt;
And oh boy, do people screw it up. Back in 2008 it was Debian, with their 'custom' OpenSSL implementation that could only produce 32,768 possible TLS keys (do you really need more?) In 2012 it's&amp;nbsp;&lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;25,000 factorable TLS public keys&lt;/a&gt;, all of which appear to have been generated by embedded devices with crappy RNGs.&lt;br /&gt;
&lt;br /&gt;
When this happens, people get nervous. They start to wonder: am I at risk? And if so, what can I do to protect myself?&lt;br /&gt;
&lt;br /&gt;
Answering this question is easy. Answering it in detail is hard. The easy answer is that if you really believe there's a problem with your RNG, stop reading and go &lt;i&gt;fix it!&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The detailed answer is that (assuming you've done your best for the RNG), there are many areas where you're vulnerable if it breaks down, and some are harder to deal with than others.&lt;br /&gt;
&lt;br /&gt;
In the rest of this post I'm going to talk about this and maybe give a few examples. I want to make clear that the motivation for this post is intellectual&amp;nbsp;curiosity&amp;nbsp;&lt;i&gt;only.&lt;/i&gt;&amp;nbsp;Please &lt;i&gt;do not&lt;/i&gt; re-engineer OpenSSL around any of the 'advice' I give herein (I'm looking at you, Dan Kaminsky), and if you &lt;i&gt;do &lt;/i&gt;follow any of my advice, please understand the following:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;When it all goes terribly wrong, I'll quietly take down this post and deny all knowledge. You're on your own.&lt;/i&gt;&lt;/blockquote&gt;
First, some background.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;RNGs and PRGs&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before we get started, it's important to understand what we mean by a 'bad RNG'. The vast majority of cryptographic systems actually have two components for random number generation. The first ('RNG') collects entropy from various sources, such as hardware or unpredictable system events. The second (PRG) is a pseudo-random generator that &lt;i&gt;seeds&lt;/i&gt;&amp;nbsp;off of the gathered entropy. This is typically based on a hash function or a block cipher.&lt;br /&gt;
&lt;br /&gt;
Although things can go wrong at any point in this chain, the most common failures are entropy-related. And these can easily be 'masked' by the PRG. In fact, with a good PRG, your seed entropy can be something ridiculous like "0x000000000000000000000001", and yet the PRG outputs will&amp;nbsp;pass most randomness tests.&lt;br /&gt;
&lt;br /&gt;
This configuration is a blessing and a curse.&amp;nbsp;The curse is that it can&amp;nbsp;&lt;i&gt;hide&lt;/i&gt;&amp;nbsp;problems. Since most people only see the output of their PRG (rather than the seed material), it's easy to believe that your RNG is doing a great job, when it's actually quite sick.* (Along these lines, FIPS 140 mandates self-tests on&amp;nbsp;&lt;i&gt;PRG&lt;/i&gt;&amp;nbsp;output, which makes me wonder what NIST is smoking. But I wonder that a lot.)&lt;br /&gt;
&lt;br /&gt;
The blessing of a PRG is that it will typically give you nice, statistically-uniform output even when you use highly non-uniform seed entropy. This rules out attacks (like &lt;a href="http://ering-a-private-key-with-only-a-fraction-of-the-bits/"&gt;this one&lt;/a&gt;) which rely on the presence of obvious biases in your nonces/keys/IVs. More to the point, it turns failure into an all-or-nothing deal. Either:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Your attacker will &lt;i&gt;exactly&lt;/i&gt;&amp;nbsp;guess the seed you used, in which case she can obtain&amp;nbsp;&lt;i&gt;every single output of the PRG &lt;/i&gt;(until the next reseed), or&lt;/li&gt;
&lt;li&gt;She won't guess your seed, and you're mostly in the clear.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Obviously (1) is quite possible and (2) is debatable, but my point is that there's very little middle ground. On a well-designed modern system, you'll typically get beautiful, uniform-looking (P)RNG output. You just might get it over and over again, or your buddies might get it too.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Key generation&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
When it comes to generating keys with a bad (P)RNG, the only winning move is not to play.&amp;nbsp;This is fundamental to key generation, meaning that it doesn't really depend on which algorithm you're using. If an attacker can predict your 'randomness', they can generate the same key themselves. Game over.&lt;br /&gt;
&lt;br /&gt;
If you think this is a problem for your implementation, then either&amp;nbsp;&lt;i&gt;(a)&amp;nbsp;&lt;/i&gt;generate your keys on a reliable device, or &lt;i&gt;(b) &lt;/i&gt;get yourself a better RNG. If neither option is available (for some reason), then for god's sake, collect some entropy from the user. Ask them to tap a ditty on a button, or (if a keyboard is available), get a strong, unpredictable passphrase and hash it through &lt;a href="http://en.wikipedia.org/wiki/PBKDF2"&gt;PBKDF2&lt;/a&gt;. This might not save you, but it probably won't hurt.&lt;br /&gt;
&lt;br /&gt;
What's fascinating is that some cryptosystems are more vulnerable to bad, or shared randomness than others. The recent batch of &lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;factorable RSA keys&lt;/a&gt;, for example, appears to result from poor entropy on embedded devices. But it wasn't due to someone &lt;i&gt;guessing&lt;/i&gt;&amp;nbsp;the entropy that was used.&amp;nbsp;Rather,&amp;nbsp;the mere fact that &lt;i&gt;two different devices shared entropy&lt;/i&gt;&amp;nbsp;makes both of their keys factorable&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
According to Nadia Heninger, this is an&amp;nbsp;&lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;artifact of the way that RSA keys are typically generated&lt;/a&gt;. Every RSA public modulus is the product of two primes. Some devices generate one prime, then reseed their RNG&lt;i&gt;&amp;nbsp;before&lt;/i&gt;&amp;nbsp;generating the second. The result is that one, not both, primes are shared.&amp;nbsp;Unfortunately, this is a worst case: anyone in possession of these moduli can factor them both by computing the GCD.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ironically, in this case it's at least&lt;i&gt;&amp;nbsp;arguable&lt;/i&gt;&amp;nbsp;that you're safer if two devices generate the &lt;i&gt;same&lt;/i&gt;&amp;nbsp;modulus, rather than simply sharing one prime. &lt;a href="http://dl.acm.org/citation.cfm?id=716581"&gt;Lenstra&lt;/a&gt;&amp;nbsp;proposes one solution, which is to calculate&amp;nbsp;&lt;i&gt;q&lt;/i&gt;&amp;nbsp;deterministically based on &lt;i&gt;p.&lt;/i&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;Alternatively, you can just make sure your implementation &lt;i&gt;doesn't&lt;/i&gt;&amp;nbsp;reseed, which is probably much simpler.&lt;br /&gt;
&lt;br /&gt;
Neither of these solutions will really help you, by the way. You're still whistling past the graveyard. But you might get to whistle a bit longer.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Digital signatures and MACs&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
There's a general misconception that digital signatures &lt;i&gt;must&lt;/i&gt;&amp;nbsp;in some way be randomized. This probably stems from the popularity of &lt;i&gt;probabilistic&lt;/i&gt; signing algorithms like&amp;nbsp;DSA/ECDSA and RSA-PSS. While it's true that these algorithms have a random component, that's more an accident of history than a statement on signature schemes in general.&lt;br /&gt;
&lt;br /&gt;
I'm going to quicky run through a few of the most popular MAC and signature schemes. In this discussion, I'm going to assume that all &lt;i&gt;keys&lt;/i&gt;&amp;nbsp;have been generated properly (see the previous section). The focus is on the randomness needed for signing.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-style: italic;"&gt;MACs. &lt;/b&gt;The good news is that virtually every practical MAC in use today is deterministic. This includes HMAC, CMAC, etc. There do exist probabilistic MACs, but fortunately nobody uses them. So while your bad RNG might be a problem for some things, it shouldn't have any impact on your symmetric-key authentication.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Signatures.&lt;/b&gt;&amp;nbsp;&lt;/i&gt;The situation with signatures&amp;nbsp;is a bit more complicated. I can't cover all signatures, but I can at least talk about the most popular ones. For reasons that nobody's ever really explained to me, these are (in no particular order): ECDSA, DSA, RSA-PKCS#1v1.5 and RSA-PSS. Of these four signatures, you'll notice that &lt;i&gt;three&lt;/i&gt; are (potentially) randomized.&lt;br /&gt;
&lt;br /&gt;
The major exception is&amp;nbsp;&lt;a href="http://www.rsa.com/rsalabs/node.asp?id=2125"&gt;PKCS#1v1.5&lt;/a&gt;&amp;nbsp;signature padding, which has no random fields at all. While this means you can give your RNG a rest, it doesn't mean that v1.5 padding is &lt;i&gt;good. &lt;/i&gt;It's probably much more accurate to say that&amp;nbsp;the 'heuristically-secure' v1.5 padding scheme is&amp;nbsp;&lt;i&gt;equally bad&lt;/i&gt;&amp;nbsp;whether you have a working RNG or not.&lt;br /&gt;
&lt;br /&gt;
Much better is &lt;a href="http://www.rsa.com/rsalabs/node.asp?id=2005"&gt;RSA-PSS&lt;/a&gt;, which actually has a&lt;i&gt;&amp;nbsp;&lt;/i&gt;reduction&amp;nbsp;to the hardness of the &lt;a href="http://en.wikipedia.org/wiki/RSA_problem"&gt;RSA problem&lt;/a&gt;. So far so good, but wait a second: doesn't the P in PSS stand for &lt;i&gt;Probabilistic?&lt;/i&gt;&amp;nbsp;And indeed, a close look at the PSS description (below) reveals the presence of random salt in every signature.&lt;br /&gt;
&lt;br /&gt;
Fortunately, this is no big thing, since the salt is&amp;nbsp;&lt;i&gt;optional&lt;/i&gt;. PSS remains&amp;nbsp;(provably) secure even if you repeat your salt, or just hardcode it to zero.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://rsa.com/rsalabs/technotes/images/rsa-pss.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="179" src="http://rsa.com/rsalabs/technotes/images/rsa-pss.gif" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The &lt;a href="http://www.rsa.com/rsalabs/node.asp?id=2005"&gt;PSS&lt;/a&gt; signing algorithm. MGF is constructed from a hash function.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Having dispensed with RSA, we can get down to serious business: &lt;a href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm"&gt;DSA&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Elliptic_Curve_DSA"&gt;ECDSA&lt;/a&gt;. I have no proof, but my guess is that these two algorithms are far more common than RSA-PSS. Hence it should be no surprise that they're the worst offenders by far&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The problem in a nutshell is that every (EC)DSA signature includes a random &lt;i&gt;nonce&lt;/i&gt;&amp;nbsp;value, which must never be repeated. If you ever forget this warning -- &lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;create&amp;nbsp;two signatures (on different messages) using the same nonce -- then &lt;i&gt;anyone&lt;/i&gt;&amp;nbsp;can &lt;a href="http://rdist.root.org/2010/11/19/dsa-requirements-for-random-k-value/"&gt;recover your secret key&lt;/a&gt;. The math behind this isn't even that complicated; you could safely&amp;nbsp;outsource it to a bright eighth-grader. (Or even a dumb one, if that's all you've got.)&lt;br /&gt;
&lt;br /&gt;
Usually when DSA/ECDSA go wrong, it's because someone simply forgot to use a random nonce in the first place. This appears to be what &lt;a href="http://arstechnica.com/gaming/news/2010/12/ps3-hacked-through-poor-implementation-of-cryptography.ars"&gt;Sony did with the Playstation 3&lt;/a&gt;. Obviously, this is stupid and you shouldn't do it. But no matter how careful your implementation, you're still vulnerable to a bad RNG. If it starts spitting out repeated values, you need to throw away your key and generate a new one.&lt;br /&gt;
&lt;br /&gt;
There are basically two ways to protect yourself:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Best:&lt;/b&gt;&amp;nbsp;don't&amp;nbsp;to use (EC)DSA in the first place. It's a stupid algorithm with no reasonable security proof, and as a special bonus it goes completely pear-shaped in the presence of a bad RNG. Unfortunately, it's also a standard, used in TLS and elsewhere, so you're stuck with it.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Second best:&lt;/b&gt;&amp;nbsp;Derive your nonces deterministically&amp;nbsp;&lt;i&gt;from the message&lt;/i&gt; and some secret data&lt;i&gt;.&lt;/i&gt;&amp;nbsp;If done correctly (big if!), this reduces the possibility that two messages will be signed using the same nonce. In the extreme case, this approach can completely eliminate the need for randomness in (EC)DSA signatures.&lt;br /&gt;&lt;br /&gt;There are two published proposals that take this approach. The best is Dan Bernstein's (somewhat complex)&amp;nbsp;&lt;a href="http://ed25519.cr.yp.to/ed25519-20110926.pdf"&gt;EdDSA&lt;/a&gt;&amp;nbsp;proposal, which looks like a great replacement for ECDSA. Unfortunately it's a replacement, not a patch, since EdDSA uses different elliptic curves and is therefore &lt;i&gt;not&lt;/i&gt;&amp;nbsp;cross-compatible with existing ECDSA implementations.&lt;br /&gt;&lt;br /&gt;Alternatively, Thomas Pornin &lt;a href="http://tools.ietf.org/html/draft-pornin-deterministic-dsa-00"&gt;has a proposal&lt;/a&gt;&amp;nbsp;up that simply modifies (EC)DSA into a deterministic scheme by using HMAC to derive the nonces. The best part about Thomas's proposal is that it doesn't break&amp;nbsp;compatibility with existing (EC)DSA implementations. While Thomas's work &lt;i&gt;looks&lt;/i&gt;&amp;nbsp;reasonable, his proposal is just a draft (and an expired one to boot). Proceed at your own risk.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Encryption&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are various consequences to using a bad RNG for encryption, most of which depend on the scheme you're using.&lt;i&gt;&amp;nbsp;&lt;/i&gt;Once again we'll assume that the &lt;i&gt;keys&lt;/i&gt;&amp;nbsp;themselves are properly-generated. What's at stake is the encryption itself.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Symmetric encryption.&lt;/b&gt;&lt;/i&gt;&amp;nbsp;The good news is that &lt;i&gt;symmetric&lt;/i&gt; encryption can be done securely with no randomness at all,&amp;nbsp;provided that you have a strong encryption key and the ability to keep state between messages.&lt;br /&gt;
&lt;br /&gt;
The easiest example is CTR mode encryption. Since CTR mode IVs needn't be unpredictable, you can set your initial IV to zero, then simply make sure that you always hang onto the last counter value between messages.&amp;nbsp;Provided that you &lt;i&gt;never ever&lt;/i&gt; re-use a counter value with a given key (even across system restarts) you'll be fine.**&lt;br /&gt;
&lt;br /&gt;
Please don't try this with CBC mode, since that actually &lt;i&gt;does&lt;/i&gt;&amp;nbsp;require an unpredictable IV at the head of each chain. You can probably hack around this requirement in some dangerous way, but nothing good will come of it.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Public-key encryption.&lt;/b&gt; &lt;/i&gt;Unfortunately, public-key encryption is much more difficult to get right without a good RNG, mostly because the attacker has your public key.&lt;br /&gt;
&lt;br /&gt;
Here's the fundamental problem: if an attacker knows the randomness you used to produce a ciphertext, then (in the worst case) she can simply encrypt 'guess' messages until she obtains the same ciphertext as you. At that point she knows what you encrypted.&lt;br /&gt;
&lt;br /&gt;
Obviously this attack only works if the attacker can guess the message you encrypted. Hence it's possible that &lt;i&gt;high-entropy&lt;/i&gt;&amp;nbsp;messages (symmetric keys, for example) might remain secure even without good randomness.&amp;nbsp;But there's no guarantee of this.&amp;nbsp;&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/ElGamal_encryption"&gt;Elgamal&lt;/a&gt;, for example, can fail catastrophically when you encrypt two messages with the same randomness.****&lt;br /&gt;
&lt;br /&gt;
Although I'm not going to endorse any specific public-key encryption scheme, it seems likely that some schemes will hold up better than others.&amp;nbsp;For example, while predictably-randomized&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding"&gt;RSA-OAEP&lt;/a&gt; and &lt;a href="http://www.shoup.net/papers/iso-2_1.pdf"&gt;RSA-OAEP+&lt;/a&gt; will both be vulnerable to guessing attacks, there's &lt;i&gt;some&lt;/i&gt;&amp;nbsp;(intuitive)&amp;nbsp;reason to believe that they'll remain secure for high-entropy messages like keys. I can't prove this, but it seems like a better bet than using Elgamal (clearly broken) or older padding schemes like RSA-PKCS#1v1.5.&lt;br /&gt;
&lt;br /&gt;
If my intuition isn't satisfying to you, quite a lot of research is still being done in this area. See for example, recent works on&amp;nbsp;&lt;a href="http://cseweb.ucsd.edu/~tristenp/papers/detenc-rel.pdf"&gt;&lt;i&gt;deterministic &lt;/i&gt;public-key encryption&lt;/a&gt;, or &lt;a href="http://www.stanford.edu/~zvika/localpapers/HedgedPKE.pdf"&gt;&lt;i&gt;hedged&lt;/i&gt;&amp;nbsp;public-key encryption&lt;/a&gt;. Note that all of this work makes on the assumption that you're encrypting high-entropy messages.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you take nothing else from this post, I hope it's this: using a broken RNG is just a bad idea. If you think there's &lt;i&gt;any&lt;/i&gt;&amp;nbsp;chance your generator will stop working, then for god's sake, &lt;i&gt;fix it! &lt;/i&gt;Don't waste your time doing any of the stuff I mention above.&lt;br /&gt;
&lt;br /&gt;
That said, there legitimately are cases where your RNG can go wrong, and sometimes it makes sense to be aware of those cases, and the consequences for your system. Model it. Think about it. Then spend your time on better things.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;*&amp;nbsp;&lt;/i&gt;&amp;nbsp;The classic example is Debian's 2008 OpenSSL release, which used a 15-bit process ID as the only seed for its PRG. This didn't lead to any &lt;i&gt;obvious&lt;/i&gt;&amp;nbsp;problems during testing, since the 32,768 possible RNG streams all &lt;i&gt;looked&lt;/i&gt;&amp;nbsp;pretty random. It was only after the public release that people started that many devices were sharing keys.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;i&gt;** &lt;/i&gt;If you're going to do this, you should also be sure to use a MAC on your ciphertext, including the initial counter value for each message.&lt;br /&gt;
&lt;br /&gt;
*** A great example is unpadded, textbook RSA. If &lt;i&gt;m&lt;/i&gt;&amp;nbsp;is random, then it's quite difficult to recover&amp;nbsp;m given &lt;i&gt;m^e mod N&lt;/i&gt;. If, however, you have a few good&lt;i&gt;&amp;nbsp;&lt;/i&gt;guesses for &lt;i&gt;m &lt;/i&gt;and you know the public key (&lt;i&gt;N, e&lt;/i&gt;),&lt;i&gt;&amp;nbsp;&lt;/i&gt;you can easily try each of your guesses and compare the results.&lt;br /&gt;
&lt;br /&gt;
**** Given two Elgamal ciphertexts on the same key and randomness (g^r, y^r*M1), (g^r, y^r*M2) you can easily compute M1/M2. A similar thing happens with hash Elgamal. This may or may not be useful to you, depending on how much you know about the content of the various messages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-8855755118504305921?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/lnsbWDQy0rM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/8855755118504305921/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/03/surviving-bad-rng.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8855755118504305921?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8855755118504305921?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/lnsbWDQy0rM/surviving-bad-rng.html" title="Surviving a bad RNG" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/03/surviving-bad-rng.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cNQXg4eSp7ImA9WhVTFk8.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-3492505773161367637</id><published>2012-03-01T07:03:00.002-08:00</published><updated>2012-03-01T08:58:10.631-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-03-01T08:58:10.631-08:00</app:edited><title>A brief update</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm5.staticflickr.com/4145/5001774315_a930820bcf_m.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="150" src="http://farm5.staticflickr.com/4145/5001774315_a930820bcf_m.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://www.flickr.com/photos/mgwilkins/"&gt;misconmike&lt;/a&gt;/CC)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
My early-week post on the &lt;a href="http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html"&gt;MITM certificate mess&lt;/a&gt;&amp;nbsp;seems to have struck a nerve with readers. (Or perhaps I just picked the right time to complain!) Since folks seem interested in this subject, I wanted to follow up with a few quick updates:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The EFF has released a new version of &lt;a href="https://www.eff.org/https-everywhere/"&gt;HTTPS Everywhere&lt;/a&gt;, which includes a nifty 'Decentralized SSL Observatory' feature. This scans for unusual certificates (&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;MITM certs, certs with weak keys)&amp;nbsp;and reports them back to EFF for logging. A very nice step towards a better 'net.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.stalkr.net/2011/08/hsts-preloading-public-key-pinning-and.html"&gt;StalkR&lt;/a&gt;&amp;nbsp;reminds me that Chrome 18 includes support for &lt;a href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-01"&gt;Public-key Pinning&lt;/a&gt;. This is an HTTP extension that allows a site operator to 'pin' their site to one (or more) pre-specified public keys for a given period of time. A pinned browser will reject any alternative keys that show up -- even if they're embedded in a valid certificate.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A couple of readers point out that popular sites (&lt;i&gt;e.g.,&lt;/i&gt; Google and Facebook) change their certificates quite frequently -- possibly due to the use of load balancers -- which poses a problem for "carry a list of legitimate certs with you" solutions. I recognize this. The best I can say is that &lt;i&gt;we're&lt;/i&gt; &lt;i&gt;all&lt;/i&gt; &lt;i&gt;better off&lt;/i&gt; if bogus certs are easy to detect. Hopefully site operators will find a compromise that makes this easy for us.&lt;/li&gt;
&lt;/ul&gt;
Appearances to the contrary, this blog is&amp;nbsp;&lt;i&gt;not&lt;/i&gt;&amp;nbsp;going to become a forum for complaining about CAs. I'll be back in a few days with more wonky crypto posts, including some ideas for dealing with bad randomness, some thoughts on &lt;i&gt;patented&lt;/i&gt; modes of operation, and an update on the progress that researchers are making with Fully-Homomorphic Encryption.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-3492505773161367637?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/7Q273v4uiWA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/3492505773161367637/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/03/ca-nonsense-brief-update.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3492505773161367637?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/3492505773161367637?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/7Q273v4uiWA/ca-nonsense-brief-update.html" title="A brief update" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/03/ca-nonsense-brief-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYNRng5fip7ImA9WhVTFEk.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-1197246907250858412</id><published>2012-02-27T20:43:00.000-08:00</published><updated>2012-02-28T07:49:57.626-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-28T07:49:57.626-08:00</app:edited><title>The Internet is broken: could we please fix it?</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://static.guim.co.uk/sys-images/Observer/Pix/pictures/2010/11/26/1290795551447/cyber-radicals-003.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="168" src="http://static.guim.co.uk/sys-images/Observer/Pix/pictures/2010/11/26/1290795551447/cyber-radicals-003.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Ok, this is a little embarrassing, and I hate having to admit it publicly. But I can't hold it in any longer: I think I'm becoming an Internet activist.&lt;br /&gt;
&lt;br /&gt;
This is upsetting to me, since active is the &lt;i&gt;last&lt;/i&gt;&amp;nbsp;thing I ever thought I'd be. I have&amp;nbsp;&lt;a href="https://twitter.com/#!/csoghoian"&gt;friends&lt;/a&gt; who live to make trouble for big corporations on the Internet, and while I admire their chutzpah (and results!), they've always made me a little&amp;nbsp;embarrassed. Even when I &lt;i&gt;agree&lt;/i&gt;&amp;nbsp;with their cause, I still have an&amp;nbsp;urge to follow along, cleaning up the mess and apologizing on behalf of all the 'reasonable' folks on the Internet.&lt;br /&gt;
&lt;br /&gt;
But every man has a breaking point, and the proximate cause of mine is &lt;a href="http://blog.cryptographyengineering.com/2012/02/trustwave-announces-name-change.html"&gt;Trustwave&lt;/a&gt;. Or rather, the news that Trustwave -- an important CA and pillar of the Internet -- took it upon themselves to sell a subordinate root cert to some (still unknown) client, for the purposes of&amp;nbsp;&lt;strike&gt;undermining the trust assumptions that make the Internet secure&lt;/strike&gt;&amp;nbsp;eavesdropping on TLS connections&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
This kind of behavior is absolutely, unquestionably out of bounds for a trusted CA, and certainly deserves a response -- a stronger one than it's gotten. But the really frightening news is twofold:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;There's reason to believe that &lt;i&gt;other &lt;/i&gt;(possibly bigger) CAs are engaged in the same practice.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;To the best of my knowledge, only &lt;i&gt;one&lt;/i&gt;&amp;nbsp;browser vendor has taken a public stand on this issue, and that vendor isn't gaining market share.&lt;/li&gt;
&lt;/ol&gt;
The good news is that the MITM revelation is exactly the sort of kick we've needed to improve the CA system. And even better, some very bright people are already thinking about it. The rest of this post will review the problem and talk about some of the potential solutions.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Certificates 101&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For those of you who know the TLS protocol (and how certificates work), the following explanation is completely gratuitous. Feel free to skip it. If you &lt;i&gt;don't&lt;/i&gt;&amp;nbsp;know -- or don't understand the problem -- I'm going to take a minute to give some quick background.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt; (formerly SSL) is probably the best-known security protocol on the Internet. Most people are familiar with TLS for its use in &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;https&lt;/span&gt; -- secure web --&amp;nbsp;but it's also used to protect email in transit, software updates, and a whole mess of other stuff you don't even think about.&lt;br /&gt;
&lt;br /&gt;
TLS protects your traffic by encrypting it with a strong symmetric key algorithm like AES or RC4. Unfortunately, this type of cryptography only works when the communicating parties share a key. Since you probably &lt;i&gt;don't &lt;/i&gt;share keys with most of the web servers on the Internet, TLS provides you with a wonderful means to do so: a public-key &lt;a href="http://en.wikipedia.org/wiki/Key-agreement_protocol"&gt;key agreement protocol&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I could spend a lot of time talking about this, but for our purposes, all you need to understand is this: when I visit&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;https://gmail.com&lt;/span&gt;, Google's server will send me a public key. If this key really belongs to Google, then everything is great: we can both derive a secure communication key, &lt;i&gt;even if&lt;/i&gt; our attacker Mallory is eavesdropping on the whole conversation.&lt;br /&gt;
&lt;br /&gt;
If, on the other hand, Mallory can &lt;i&gt;intercept&lt;/i&gt;&amp;nbsp;and &lt;i&gt;modify&lt;/i&gt;&amp;nbsp;our communications, the game is very different. In this case, she can&lt;i&gt;&amp;nbsp;&lt;/i&gt;overwrite Gmail's key with&amp;nbsp;her&amp;nbsp;own public key. The result: I end up sharing a symmetric key with &lt;i&gt;her&lt;/i&gt;!&amp;nbsp;The worst part is that I probably won't know this has happened: clever Mallory can make her own connection to Gmail and silently pass my traffic through -- while reading every word. This scenario is called a Man in the Middle (MITM) Attack.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/e/e7/Man_in_the_middle_attack.svg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="141" src="http://upload.wikimedia.org/wikipedia/commons/e/e7/Man_in_the_middle_attack.svg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;MITM attack. Alice is your grandmother, Bob is BankofAmerica.com, and Mallory establishes connections with both. (&lt;a href="http://en.wikipedia.org/wiki/File:Man_in_the_middle_attack.svg"&gt;Wikipedia&lt;/a&gt;/CC license)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
MITM attacks are older than the hills. Fortunately TLS has built-in protections to thwart them. Instead of transmitting a naked public key, the Gmail server wraps its key in a &lt;i&gt;certificate&lt;/i&gt;; this is a simple file that embeds both the&amp;nbsp;key &lt;i&gt;and&lt;/i&gt;&amp;nbsp;some identifying information, like "gmail.com". The certificate is&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Digital_signature"&gt;digitally signed&lt;/a&gt; by someone very trustworthy: one of a few dozen&amp;nbsp;Certificate Authorities (CA) that your browser knows and trusts. These include companies like Verisign, and (yes) Trustwave.&lt;br /&gt;
&lt;br /&gt;
TLS clients (&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;web browsers) carry the verification keys for a huge number of CAs. When a certificate comes in, they can verify its signature to ensure that it's&amp;nbsp;legit.&amp;nbsp;This approach works very well, under one very important assumption: namely, Mallory &lt;i&gt;won't&lt;/i&gt;&amp;nbsp;be able to get a signed certificate on a domain she doesn't own.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What's wrong with the CA model?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The real problem with the CA model is that &lt;i&gt;every&lt;/i&gt; root CA has the power to sign any domain, which completely unravels the security of TLS.&amp;nbsp;So far the industry has policed itself using the &lt;a href="http://www.foodchannel.com/articles/article/honor-system-wine/"&gt;Macaroni Grill&lt;/a&gt;&amp;nbsp;model: If a CA screws up too badly, they face&amp;nbsp;being removed from the 'trusted' list of major TLS clients. In principle this should keep people in line, since it's the nuclear option for a CA -- essentially shutting down their business.&lt;br /&gt;
&lt;br /&gt;
Unfortunately while this&amp;nbsp;&lt;i&gt;sounds&lt;/i&gt;&amp;nbsp;good it's tricky to implement in practice. That's because:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;It assumes that browser vendors &lt;i&gt;are willing &lt;/i&gt;to&amp;nbsp;go nuclear on their colleagues at the CAs.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It assumes that browser vendors &lt;i&gt;can&lt;/i&gt;&amp;nbsp;go nuclear on a major CA, knowing that the blowback might very well hurt &lt;i&gt;their &lt;/i&gt;product. (Imagine that your browser unilaterally stopped accepting&amp;nbsp;Verisign certs. What would you do?)&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It assumes that someone will &lt;i&gt;catch&lt;/i&gt;&amp;nbsp;misbehaving CAs in the first place.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
What's fascinating about the Trustwave&amp;nbsp;brouhaha&amp;nbsp;is that it's finally giving us some visibility into how well these assumptions play out in the real world.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;So what happened with Trustwave?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In late January of this year, Trustwave made a cryptic update to their&amp;nbsp;&lt;a href="https://ssl.trustwave.com/CA/"&gt;CA policy.&lt;/a&gt; When people started asking about it, they responded with a carefully-worded &lt;a href="http://blog.spiderlabs.com/2012/02/clarifying-the-trustwave-ca-policy-update.html"&gt;post&lt;/a&gt; on the company blog. When you cut through the business-speak, here's what it says:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;We sold the right to generate certificates -- on any&amp;nbsp;domain name, regardless of whether it belongs to one of our clients or not -- and packed this magical capability into a box. We rented this box to a corporate client for the express purpose of running Man-in-the-Middle attacks to eavesdrop on their employees' TLS-secured connections. At no point did we stop to consider how damaging this kind of practice was, nor did we worry unduly about its potential impact on our business -- since quite frankly, we didn't believe it would have any.&lt;/i&gt;&lt;/blockquote&gt;
I don't know which part is worse. That a company whose entire&amp;nbsp;business&amp;nbsp;is based on trust -- on the idea that people will &lt;i&gt;believe&lt;/i&gt;&amp;nbsp;them when they say a certificate is legit -- would think they could get away with&amp;nbsp;selling&amp;nbsp;a tool to make&amp;nbsp;&lt;i&gt;fraudulent&lt;/i&gt;&amp;nbsp;certificates.&amp;nbsp;Or that they're probably right.&lt;br /&gt;
&lt;br /&gt;
But this isn't the worst of it. There's reason to believe that Trustwave isn't alone in this practice. In fact, if we're to believe the rumors, Trustwave is only noteworthy in that they &lt;i&gt;stopped&lt;/i&gt;. Other CAs may still be up to their ears.&lt;br /&gt;
&lt;br /&gt;
And so this finally brings us to the important part of this post: what's being done, and what can &lt;i&gt;we&lt;/i&gt; do to make sure that it never happens again?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 1: Rely on the browser vendors&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
What's particularly disturbing about the Trustwave fiasco is the response it's gotten from the various browser manufacturers.&lt;br /&gt;
&lt;br /&gt;
So far exactly&amp;nbsp;&lt;i&gt;one&lt;/i&gt;&amp;nbsp;organization has taken a strong stand against&amp;nbsp;this practice. The Mozilla foundation (makers of Firefox) recently sent a &lt;a href="http://blog.cryptographyengineering.com/2012/02/quick-hit-ssl-mitm-update.html"&gt;strongly-worded letter&lt;/a&gt; to all of their root CAs -- demanding that they disclose whether such MITM certificates exist, and that they shut them down forthwith. With about 20% browser share (depending on who's counting), Mozilla has the means to enforce this. &lt;i&gt;Assuming&lt;/i&gt;&amp;nbsp;the vendors are honest, and &lt;i&gt;assuming &lt;/i&gt;Mozilla carries through on its promise. And assuming that Mozilla browser-share doesn't fall any further.&lt;br /&gt;
&lt;br /&gt;
That's the good news. Less cheerful is the deafening silence from Apple, Microsoft and Google. These vendors control most of the remaining browser market, and to the best of my knowledge they've said nothing at all about the practice. Publicly, anyway. It's possible that they're working the issue privately; if so, more power to them. But in the absence of &lt;i&gt;some&lt;/i&gt;&amp;nbsp;evidence, I find it hard to take this on faith.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 2: Sunshine is the best&amp;nbsp;disinfectant&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The Trustwave fiasco exposes two basic problems with the CA model: &lt;i&gt;(1)&lt;/i&gt; any CA can claim ownership of &lt;i&gt;any&lt;/i&gt;&amp;nbsp;domain, and &lt;i&gt;(2)&lt;/i&gt; there's no easy way to know which domains a CA has put its stamp on.&lt;br /&gt;
&lt;br /&gt;
This last is very much by CA preference: CAs don't &lt;i&gt;want&lt;/i&gt; to reveal their doings, on the theory that it would harm their business.&amp;nbsp;I can see where they're coming from (especially if their business includes selling MITM certs!) Unfortunately, allowing CAs to operate without oversight is one of those quaint practices (like clicking on links sent by strangers)&amp;nbsp;that made sense in a more innocent time, but no longer has much of a place in our world.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/9/95/Hash_Tree.svg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="177" src="http://upload.wikimedia.org/wikipedia/commons/9/95/Hash_Tree.svg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Merkle tree (&lt;a href="http://en.wikipedia.org/wiki/File:Hash_Tree.svg"&gt;Wikipedia&lt;/a&gt;/CC)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Ben Laurie and Adam Langley feel the same way, and they've developed a &lt;a href="http://www.links.org/files/CertificateAuthorityTransparencyandAuditability.pdf"&gt;plan to do something&lt;/a&gt; about it. The basic idea is this:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Every new certificate should be published in a &lt;i&gt;public audit log.&lt;/i&gt;&amp;nbsp;This log will be open to the world, which means that everyone can scan for illegal entries (&lt;i&gt;i.e., &lt;/i&gt;their own domain appearing in somebody else's certificate.)&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Anytime a web server hands out a certificate, it must prove that the certificate is contained in the list.&lt;/li&gt;
&lt;/ol&gt;
The beautiful thing is that this proof can be conducted relatively efficiently using a &lt;a href="http://en.wikipedia.org/wiki/Hash_tree"&gt;Merkle hash tree&lt;/a&gt;. The resulting proofs are quite short (log(N) hashes, where N is the total number of certificates). Browsers will need to obtain the current tree root, which requires either &lt;i&gt;(a) &lt;/i&gt;periodic scanning of the tree, or some degree of trust in an authority, who will periodically distribute signed root nodes.&lt;br /&gt;
&lt;br /&gt;
Along the same lines, the &lt;a href="https://www.eff.org/"&gt;EFF&lt;/a&gt; has a similar proposal called the &lt;a href="https://www.eff.org/sovereign-keys"&gt;Sovereign Keys Project&lt;/a&gt;. SKP&amp;nbsp;also proposes a public log, but places stronger requirements on what it takes to &lt;i&gt;get&lt;/i&gt;&amp;nbsp;into the log. It's quite likely that in the long run these projects will merge, or give birth to something even better.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 3: Eternal vigilance&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The problem with SKP and the Laurie/Langley proposal is that both require changes to the CA infrastructure. Someone will need to construct these audit logs; servers will have to start shipping hash proofs. Both can be incrementally deployed, but will only be &lt;i&gt;effective&lt;/i&gt;&amp;nbsp;once deployment reaches a certain level.&lt;br /&gt;
&lt;br /&gt;
Another option is to dispense with this machinery altogether, and deal with rogue CAs &lt;i&gt;today&amp;nbsp;&lt;/i&gt;by subjecting them to contant, unwavering surveillance&lt;i&gt;.&lt;/i&gt;&amp;nbsp;This is the approach taken by CMU's &lt;a href="http://perspectives-project.org/"&gt;Perspectives&lt;/a&gt;&amp;nbsp;plugin and by&amp;nbsp;Moxie Marlinspike's &lt;a href="http://www.convergence.io/"&gt;Convergence&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The core idea behind both of these systems is to use 'network perspectives' to determine whether the certificate&amp;nbsp;&lt;i&gt;you're&lt;/i&gt;&amp;nbsp;receiving is the same certificate that everyone else is. This helps to avoid MITMs, since presumably the attacker can only be in the 'middle' of so many network paths. To accomplish this, both systems deploy servers called Notaries -- run on a volunteer basis -- which you can call up whenever you receive an unknown certificate. They'll compare your version of the cert to what they see from the same server, and help you ring the alarm if there's a mismatch.&lt;br /&gt;
&lt;br /&gt;
A limitation of this approach is &lt;i&gt;privacy&lt;/i&gt;; these Notary servers obviously learn quite a bit about the sites you visit. Convergence extends the Perspectives plugin to address some of these issues, but fundamentally there's no free lunch here. If you're querying some external party, you're leaking information.&lt;br /&gt;
&lt;br /&gt;
One solution to this problem is to dispense with online notary queries altogether, and just ask people to carry a list of legitimate certificates with them. If we assume that there are 4 million active certificates in the world, we could easily fit them into a &amp;lt; 40MB &lt;a href="http://en.wikipedia.org/wiki/Bloom_filter"&gt;Bloom filter&lt;/a&gt;. This would allow us to determine whether a cert is 'on the list' without making an online query. Of course, this requires someone to compile and maintain such a list. Fortunately there are folks already&amp;nbsp;&lt;a href="https://www.eff.org/observatory"&gt;doing this&lt;/a&gt;, including the EFF's SSL Observatory project.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 4: The hypothetical&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The existence of these proposals is definitely heartening. It means that people are taking this seriously, and there's an active technical discussion on how to make things better.&lt;br /&gt;
&lt;br /&gt;
Since we're in this mode, let me mention a few other things that could make a big difference in&amp;nbsp;detecting&amp;nbsp;exploits. For one thing, it would be awfully nice if web servers had a way to see things through their &lt;i&gt;clients'&lt;/i&gt;&amp;nbsp;eyes.&amp;nbsp;One obvious way to do this is through script: use Javascript to view the current server certificate, and report the details back to the server.&lt;br /&gt;
&lt;br /&gt;
Of course this isn't perfect -- a clever MITM could strip the Javascript or tamper with it. Still, obfuscation is a heck of a lot easier then de-obfuscation, and it's unlikely that a single attacker is going to win an arms race against a variety of sites.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, this idea has to be relegated to the 'could be, should be' dustbin, mostly because Javascript doesn't &lt;i&gt;have&lt;/i&gt;&amp;nbsp;access to the current certificate info. I don't really see the reason for this, and I sure hope that it changes in the future.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 5: The long arm of the law&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I suppose the last option -- perhaps the least popular -- is just to treat CAs the same way that you'd treat any important, trustworthy organization in the real world. That means: you cheat, you pay the penalty. Just as we shouldn't tolerate Bank of America knowingly opening a credit line in the name of a non-customer, we shouldn't tolerate a CA doing the same.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Option 6: Vigilante justice&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ok, I'm only kidding about this one, cowboy. You can shut down that &lt;a href="http://en.wikipedia.org/wiki/LOIC"&gt;LOIC&lt;/a&gt; download &lt;i&gt;right now&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I don't know that there's a magical vaccine that will make the the CA system secure, but I've come to believe that the current approach is not working. It's not just examples like Trustwave, which (some might argue) is a relatively limited type of abuse. It's that the Trustwave revelation comes &lt;i&gt;in addition&lt;/i&gt;&amp;nbsp;to a steady drumbeat of news about stolen keys, &lt;a href="http://www.f-secure.com/weblog/archives/00002228.html"&gt;illegitimately-obtained&lt;/a&gt; certificates, and various other abuses.&lt;br /&gt;
&lt;br /&gt;
While dealing with these problems might not be easy, what's shocking is how easy it would be to at least &lt;i&gt;detect&lt;/i&gt;&amp;nbsp;and &lt;i&gt;expose&lt;/i&gt;&amp;nbsp;the abuses at the core of it -- if various people agreed that this was a worthy goal. I do hope that people start taking this stuff seriously, mostly because&amp;nbsp;being a radical is &lt;i&gt;hard, hard&lt;/i&gt; work. I'm just not cut out for it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-1197246907250858412?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/rpkt56Gc8Hc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/1197246907250858412/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html#comment-form" title="12 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1197246907250858412?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1197246907250858412?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/rpkt56Gc8Hc/how-to-fix-internet.html" title="The Internet is broken: could we please fix it?" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>12</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/how-to-fix-internet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkECSXw-cCp7ImA9WhVTEEw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-24911521365159855</id><published>2012-02-21T13:42:00.000-08:00</published><updated>2012-02-23T08:31:08.258-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-23T08:31:08.258-08:00</app:edited><title>Random number generation: An illustrated primer</title><content type="html">&lt;div class="" style="clear: both; text-align: left;"&gt;
&lt;a href="http://3.bp.blogspot.com/-PwBfH8toUkk/T0P_HeTJuyI/AAAAAAAAAIw/vI22cmuzPSQ/s1600/dice.jpeg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="183" src="http://3.bp.blogspot.com/-PwBfH8toUkk/T0P_HeTJuyI/AAAAAAAAAIw/vI22cmuzPSQ/s200/dice.jpeg" width="200" /&gt;&lt;/a&gt;Last week we learned (from two &lt;a href="http://eprint.iacr.org/2012/064"&gt;different&lt;/a&gt; &lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;sources&lt;/a&gt;!) that certain RSA implementations don't properly seed their random number generators before generating keys. One practical upshot is that a non-trivial fraction of RSA moduli share a prime factor. Given two such moduli, you can easily factor both.&lt;br /&gt;
&lt;br /&gt;
This key generation kerfuffle is just the tip of the iceberg: a &lt;i&gt;lot&lt;/i&gt; of bad things can happen when you use a weak, or improperly-seeded RNG. To name a few:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Re-using randomness with &lt;a href="http://en.wikipedia.org/wiki/Elliptic_Curve_DSA"&gt;(EC)DSA&lt;/a&gt;&amp;nbsp;can lead to &lt;a href="http://groups.google.com/group/sci.crypt/browse_thread/thread/de2b09976f1296bc"&gt;key recovery&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Re-using randomness with &lt;a href="http://en.wikipedia.org/wiki/ElGamal_encryption"&gt;Elgamal&lt;/a&gt; can lead to plaintext recovery and other ugliness.&lt;/li&gt;
&lt;li&gt;Using predictable IVs in &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29"&gt;CTR&lt;/a&gt; mode encryption can lead to plaintext recovery.&lt;/li&gt;
&lt;li&gt;When protocols use predictable&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Cryptographic_nonce"&gt;nonces&lt;/a&gt; they may become vulnerable to&amp;nbsp;&lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;replay attacks.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
In the rest of this post I'm going to talk about the various ways that random number generators work, the difference between RNGs and PRGs, and some of the funny problems with both. Since the post has gotten horrifically long, I've decided to present it in a (fun!) question/answer style that makes it easy to read in any order you want. Please feel free to skip around.&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;What's the difference between Randomness, Pseudo-Randomness and Entropy?&lt;/b&gt;&lt;/blockquote&gt;
&lt;div&gt;
Before we get started, we have to define a few of our terms. The fact is, there are many, many definitions of randomness. Since for our purposes we're basically interested in random &lt;i&gt;bit&lt;/i&gt;&amp;nbsp;generators, I'm going to give a workaday definition: with a truly random bit generator, nobody&lt;i&gt;&amp;nbsp;&lt;/i&gt;(regardless of what information or computing power they have)&amp;nbsp;can predict the next output bit with probability greater than 1/2.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
If we lived in an orderly universe,&amp;nbsp;it would be hard to build generators that meet this standard. Fortunately, the universe we&amp;nbsp;live in seems to be anything &lt;i&gt;but&lt;/i&gt;&amp;nbsp;orderly. Physicists tell us that at the quantum level certain events have measurable probabilities, but otherwise cannot be predicted in advance.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://www55.ssldomain.com/comscire/Merchant2/graphics/00000001/ProductQNG.gif" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="155" src="https://www55.ssldomain.com/comscire/Merchant2/graphics/00000001/ProductQNG.gif" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A hardware RNG.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The most expensive hardware RNGs take advantage of this, measuring such phenomena as radioactive decay or &lt;a href="http://en.wikipedia.org/wiki/Shot_noise"&gt;shot noise&lt;/a&gt;. Most consumer-grade RNGs don't have radioactive particles lying around, so they instead measure macroscopic, but chaotic phenomena -- typically highly-amplified electrical noise.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
These devices are great if you've got 'em; unfortunately not everyone does. For the rest of us, the solution is to collect&amp;nbsp;&lt;i&gt;unpredictable &lt;/i&gt;values from the computer we're working on. While this gunk may not be truly random, we hope that it has sufficient &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Entropy_(information_theory)"&gt;entropy&lt;/a&gt; &lt;/i&gt;-- essentially a measure of unpredictability -- that our attacker won't know the difference.&lt;br /&gt;
&lt;br /&gt;
If you're using a standard PC,&amp;nbsp;your system is probably filling its entropy pool right now: from unpredictable values such as drive seek or inter-keystroke timings. Taken individually none of these events provide enough entropy to do much; but by 'stirring' many such measurements together you can obtain enough to do useful cryptography.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;i&gt;Random vs. Pseudorandom.&amp;nbsp;&lt;/i&gt;&lt;/b&gt;The big problem with RNGs is that they're usually pretty inefficient. Hardware RNGs can only collect so many bits per second, and the standard OS entropy measurement techniques are even slower. For this reason, many security systems don't actually use this entropy directly. Instead, they use it to seed a fast cryptographically-secure&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_number_generator"&gt;&lt;i&gt;pseudo-random&lt;/i&gt;&amp;nbsp;generator&lt;/a&gt;, sometimes called a CSPRNG or (to cryptographers) just a PRG.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
PRGs don't generate random numbers at all. Rather, they're&amp;nbsp;algorithms&amp;nbsp;that take in a short random string ('seed'), and &lt;i&gt;stretch&lt;/i&gt; it into a long sequence of &lt;i&gt;random-looking&lt;/i&gt; bits. Since PRGs are deterministic and computational in nature, they obviously don't satisfy our definition of randomness (a sufficiently powerful&amp;nbsp;attacker can simply brute-force her way through the seed-space.) But if our attackers are normal (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;computationally limited) it's possible to build unpredictable PRGs from&amp;nbsp;fairly &lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_generator_theorem"&gt;standard assumptions&lt;/a&gt;.*&lt;/div&gt;
&lt;div&gt;
&lt;div class="separator" style="clear: both; text-align: -webkit-auto;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;i&gt;Combining RNGs and PRGs.&amp;nbsp;&lt;/i&gt;&lt;/b&gt;As I said, most systems combine an RNG with a PRG, using the former to generate a seed for the latter. Some standards actually&amp;nbsp;&lt;i&gt;mandate&lt;/i&gt;&amp;nbsp;this combination -- not just because it's faster, but because the additional layer of PRG is believed to offer some resilience in the event that the RNG contains a hardware flaw.&lt;br /&gt;
&lt;br /&gt;
You can argue about whether this is a good idea, but the upshot is as follows:&amp;nbsp;if you want to understand where 'random' numbers come from, you really need to understand both technologies and how they interoperate on your machine.&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Where does my entropy come from?&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
Unless you're running a server and have a fancy &lt;a href="http://en.wikipedia.org/wiki/Hardware_security_module"&gt;Hardware Security Module&lt;/a&gt;&amp;nbsp;installed, chances are that your system is collecting entropy from the world around it. Most OSes do this at the kernel level, using a variety of entropy sources which are then 'stirred' together. These include:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Drive seek timings&lt;/b&gt;. Modern hard drives (of the spinning variety) are a wonderful source of chaotic events. In 1994&amp;nbsp;&lt;a href="http://world.std.com/~dtd/random/forward.PDF"&gt;Davis, Ihaka and Fenstermacher&lt;/a&gt; argued that drive seek times are affected by air turbulence within the drive's enclosure, which makes them an excellent candidate for cryptographic entropy sampling. It's not clear how this technique holds up against &lt;i&gt;solid-state drives&lt;/i&gt;; probably not well.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Mouse and keyboard interaction. &lt;/b&gt;People are unpredictable. Fortunately for us, that's a good thing. Many RNGs collect entropy by measuring the time between a user's keystrokes or mouse movements, then gathering a couple of low-order bits and adding them to the pool.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Network events. &lt;/b&gt;Although network events (packet timings, for example) &lt;i&gt;seem&lt;/i&gt;&amp;nbsp;pretty unpredictable, most systems won't use this data unless you explicitly tell them to. That's because the network is generally assumed to be under the adversary's control (he may be the one sending you those 'unpredictable' packets!) You disable these protections at your own risk.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Uninitialized memory.&lt;/b&gt;&amp;nbsp;Ever forget to initialize a variable? Then you know that RAM is full of junk. While this stuff may not be random, certain systems use it on the theory that&amp;nbsp;&lt;i&gt;it probably&amp;nbsp;can't hurt.&lt;/i&gt;&amp;nbsp;Occasionally it can -- though not necessarily in the way you'd think. The classic example is this&amp;nbsp;&lt;a href="http://digitaloffense.net/tools/debian-openssl/"&gt;Debian OpenSSL bug&lt;/a&gt;, which (via a comedy of errors) meant that the PRG had only 32,768 possible seed values.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Goofy stuff. &lt;/b&gt;Some systems will try to collect entropy by conducting unpredictable calculations. One example is to start many threads counting towards infinity, then stop one with a hardware interrupt. I've done this once before and evaluated the output. I assure you that YMMV. Significantly.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Trusted Platform Module. &lt;/b&gt;Many desktop machines these days include a TPM chip on the motherboard. The &lt;i&gt;good&lt;/i&gt; news about this is that every TPM contains an internal hardware RNG, which your OS can access if it has the right drivers. It ain't fast, and the design hasn't been publicly audited. Still, folding some of this into your entropy pool is probably a good idea.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;New processor RNGs. &lt;/b&gt;To save us all this trouble, the next generation of Intel processors will contain a &lt;a href="http://software.intel.com/en-us/articles/download-the-latest-bull-mountain-software-implementation-guide/"&gt;built-in hardware RNG/PRG&lt;/a&gt;, which&amp;nbsp;goes by the codename 'Bull Mountain'. Perhaps this will be the solution to all of our problems. (h/t David Johnston in comments.)&lt;/li&gt;
&lt;/ul&gt;
The upshot of all of this is that &lt;i&gt;on a typical machine&lt;/i&gt; there's usually enough 'unpredictable' stuff going on to seed a decent entropy pool. The real problems come up in systems that &lt;i&gt;aren't&lt;/i&gt; typical.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;What about VMs and embedded&amp;nbsp;devices?&lt;/b&gt;&lt;/blockquote&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://media.tumblr.com/tumblr_lw17g4GdHF1r3i0q9.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="150" src="http://media.tumblr.com/tumblr_lw17g4GdHF1r3i0q9.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Life inside an embedded device.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The problem with classical entropy gathering is that it assumes that unpredictable things will actually&amp;nbsp;&lt;i&gt;happen&lt;/i&gt;&amp;nbsp;on the system. Unfortunately,&amp;nbsp;VMs and embedded devices defy this expectation, mostly by being very, very boring.&lt;br /&gt;
&lt;br /&gt;
Imagine the following scenario: you have a VM instance running on a server. It has no access to keyboard or mouse input, and only mediated access to hardware, which it shares with eight other VM instances.&lt;br /&gt;
&lt;br /&gt;
Worse yet, your VM may be a clone. Perhaps you just burped up fifty instances of that particular image from a 'frozen' state. Each of these VMs may have loads of entropy in its pool, but&amp;nbsp;&lt;i&gt;it's all the same entropy, &lt;/i&gt;across every clone sibling. Whether this is a problem depends on what the VM does next. If it has enough time to replenish its entropy pool, the state of the VMs will gradually diverge. But if it decides to generate a key: not good at all.&lt;br /&gt;
&lt;br /&gt;
Embedded devices present their own class of problems. Unfortunately (like every other problem in the embedded arena) there's no general solution. Some people obtain entropy from user keypad timings -- if there is a user and a keypad. Some use the low-order bits of the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Analog-to-digital_converter"&gt;ADC&lt;/a&gt;&amp;nbsp;output. Still&amp;nbsp;others forgo this entirely and ship their devices with an externally-generated PRG seed, usually stored in NVRAM.&lt;br /&gt;
&lt;br /&gt;
I don't claim that any of these are good answers, but they're better than the alternative -- which is to &lt;i&gt;pretend&lt;/i&gt;&amp;nbsp;that you have entropy when you don't.&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;How do &lt;i&gt;pseudo&lt;/i&gt;-random number generators work?&lt;/b&gt;&lt;/blockquote&gt;
You've read the books. You've seen the movies. But when it comes down to it you &lt;i&gt;still&lt;/i&gt;&amp;nbsp;don't understand the inner workings of the typical pseudo-random number generator. I can't possibly make up for this in a single blog post, but hopefully I can hit a few of the high points.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Block cipher-based PRGs.&lt;/b&gt;&lt;/i&gt;&amp;nbsp;One common approach to PRG construction uses a &lt;a href="http://en.wikipedia.org/wiki/Block_cipher"&gt;block cipher&lt;/a&gt; to generate unpredictable bits. This seems like a reasonable choice, since modern block ciphers are judged for their quality as&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_permutation"&gt;pseudo-random permutations&lt;/a&gt;,&amp;nbsp;and because most crypto libraries already have one lying around somewhere.&lt;br /&gt;
&lt;div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-tareWutk2hw/T0EThsrW5gI/AAAAAAAAAIY/6voBawX1c38/s1600/ansix9prg.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="141" src="http://2.bp.blogspot.com/-tareWutk2hw/T0EThsrW5gI/AAAAAAAAAIY/6voBawX1c38/s200/ansix9prg.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;ANSI X9.31 PRNG implemented with AES (&lt;a href="http://www.aacsla.com/specifications/AACS_Spec_Common_Final_0952.pdf"&gt;source&lt;/a&gt;).&amp;nbsp;At each iteration, the PRNG takes in a predictable 'date-time vector' (DTi) and updated state value (Si). It outputs a block of random bits Ri. The generator is seeded with a cipher key (k) and an initial state S0.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
One inexplicably popular design comes from&amp;nbsp;&lt;a href="http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf"&gt;ANSI X9.31&lt;/a&gt;. This PRG is blessed by both ANSI and FIPS, and gets used in a lot of commercial products (OpenSSL also uses it in FIPS mode).&amp;nbsp;It takes in two seeds,&amp;nbsp;&lt;i&gt;k&lt;/i&gt;&amp;nbsp;and S0 and does pretty much what you'd expect, on two conditions: you seed both values,&amp;nbsp;and you&lt;i&gt;&amp;nbsp;never, ever reveal&lt;/i&gt;&amp;nbsp;&lt;i&gt;k&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, if k&amp;nbsp;&lt;i&gt;does&lt;/i&gt; leak out things can get ugly. With knowledge of&amp;nbsp;&lt;i&gt;k&lt;/i&gt;&amp;nbsp;your attacker can&amp;nbsp;&lt;a href="http://www.comms.engg.susx.ac.uk/fft/crypto/pseudorandom_number.pdf"&gt;calculate every previous and future PRG output&lt;/a&gt;&amp;nbsp;from&lt;i&gt;&amp;nbsp;one single block&lt;/i&gt; of output!** This is totally gratuitous, and makes you wonder why this particular design was ever chosen -- much less promoted.&lt;br /&gt;
&lt;br /&gt;
Before you dismiss this as a theoretical concern: people routinely make stupid mistakes with X9.31. For example, an early draft of the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Advanced_Access_Content_System"&gt;AACS&lt;/a&gt;&amp;nbsp;standard proposed to share one&amp;nbsp;&lt;i&gt;k&lt;/i&gt;&amp;nbsp;across many different devices! Moreover keys do get stolen, and when this happens to your RNG you risk compromising every previous transaction on the system -- even supposedly 'forward-secure' ones like ephemeral&amp;nbsp;&lt;a href="http://rfc-ref.org/RFC-TEXTS/4492/kw-ecdh.html"&gt;ECDH&lt;/a&gt;&amp;nbsp;key exchanges.&amp;nbsp;You can mitigate this by reseeding &lt;i&gt;k&lt;/i&gt;&amp;nbsp;periodically.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;b&gt;Hash-based PRGs.&lt;/b&gt;&amp;nbsp;&lt;/i&gt;Many PRGs do something similar, but using hash functions instead of ciphers. There are some good arguments for this: hash&amp;nbsp;functions are very fast, plus they're &lt;i&gt;hard to invert&lt;/i&gt;&amp;nbsp;-- which&amp;nbsp;can help to prevent rewinding attacks on PRG state.&amp;nbsp;Since there are zillions of hash-based PRGs I'll restrict this discussion to a few of the most common ones:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://www.itl.nist.gov/fipspubs/fip186.htm"&gt;FIPS 186-2&lt;/a&gt;&amp;nbsp;(Appendix 3) defines a SHA-based generator that seems to be all the rage, despite the fact that it was nominally defined only for DSA signing. Windows uses this as its default PRG.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Linux uses a hash-based PRG based on two variants of SHA.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The non-FIPS OpenSSL &lt;a href="http://www.openssl.org/docs/crypto/rand.html"&gt;PRG&lt;/a&gt; also uses a hash-based design. Like everything else in OpenSSL, it's clearly documented and follows standard, well-articulated design principles.&lt;/li&gt;
&lt;/ol&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-4tD0RdYNBMk/T0GEBjACaOI/AAAAAAAAAIo/OJSclikGBxQ/s1600/twoprgs.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="151" src="http://1.bp.blogspot.com/-4tD0RdYNBMk/T0GEBjACaOI/AAAAAAAAAIo/OJSclikGBxQ/s400/twoprgs.gif" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Left: the Linux PRG (circa 2006). Right: the non-FIPS OpenSSL PRG.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;b style="font-style: italic;"&gt;Number-theoretic PRGs.&lt;/b&gt;&amp;nbsp;The problem with basing a PRG on, say, a hash function is it makes you&amp;nbsp;dependent on the security of that primitive. If a the hash&amp;nbsp;turns out to be vulnerable, then your PRG could be as well.*** (Admittedly, if this happens to a standard hash function, the security of your PRG may be the &lt;i&gt;least&lt;/i&gt;&amp;nbsp;of your concerns.)&lt;br /&gt;
&lt;br /&gt;
One alternative is to use&lt;i&gt;&amp;nbsp;&lt;/i&gt;a&lt;i&gt;&amp;nbsp;&lt;/i&gt;PRG that relies on well-studied&amp;nbsp;&lt;i&gt;mathematical&lt;/i&gt; assumptions for its security. Usually, you pay a heavy cost for this hypothetical benefit -- these generators can be 2-3 orders of magnitude slower than their hash-based cousins.&amp;nbsp;Still, if you're down for this you have various choices. An oldie (but goodie) is&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Blum_Blum_Shub"&gt;Blum-Blum-Shub,&lt;/a&gt; which is provably secure under the &lt;a href="http://en.wikipedia.org/wiki/Integer_factorization"&gt;factoring assumption&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
If you like standards, NIST also has a proposal&amp;nbsp;called&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Dual_EC_DRBG"&gt;Dual-EC-DRBG&lt;/a&gt;.&amp;nbsp;Dual-EC is particularly fascinating, for the following three reasons. First, it's built into Windows, which&amp;nbsp;probably makes it the most widely deployed number-theoretic PRG in existence. Second, it's slightly biased, due to a 'mistake' in the way that&amp;nbsp;NIST converted EC points into bits.**** Also, it&amp;nbsp;&lt;a href="http://rump2007.cr.yp.to/15-shumow.pdf"&gt;might contain a backdoor&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
This last was pointed out by&amp;nbsp;&lt;a href="http://rump2007.cr.yp.to/15-shumow.pdf"&gt;Shumow and Ferguson&lt;/a&gt;&amp;nbsp;at the Crypto 2007 rump session.&amp;nbsp;They noticed that the standard parameters given with Dual-EC could easily hide a trapdoor. Anyone who knew this value would be able to calculate all future outputs of the PRG after seeing only a 32-byte chunk of its output! Although there's probably no conspiracy here, NSA's complicity in designing the thing doesn't make anyone feel better about it.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://me-lrt.de/img/kry-43f-shrinking-generator-linear-pseudozufallsbit.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="48" src="http://me-lrt.de/img/kry-43f-shrinking-generator-linear-pseudozufallsbit.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Shrinking generator.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;b style="font-style: italic;"&gt;The rest. &lt;/b&gt;There are many dedicated PRG constructions that don't fit into the categories above. These include stream ciphers like&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;RC4&lt;/a&gt;, not to mention a host of crazy&amp;nbsp;LFSR-based things.&amp;nbsp;All I can say is: if you're going to use something nonstandard, please make sure you have a good reason.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;How much entropy do I need?&lt;/b&gt;&lt;/blockquote&gt;
The general recommendation is that you need to seed your PRG with at least as much entropy as the security level of your algorithms. If you're generating 1024-bit RSA keys, the naive theory tells you that you need at least 80 bits of entropy, since this is the level of security provided by RSA at that key size.&lt;br /&gt;
&lt;br /&gt;
In practice you need more, possibly as much as twice the security level, depending on your PRG. The problem is that many PRNGs have an upper bound on the seed size, which means they &lt;i&gt;can't&lt;/i&gt;&amp;nbsp;practically achieve levels higher than, say, 256 bits. This is important to recognize, but it's probably not of any immediate practical consequence.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;I don't care about any of this, just tell me how to get good random numbers on my Linux/Windows/BSD system!&lt;/b&gt;&lt;/blockquote&gt;
The good news for you is that modern operating systems and (non-embedded) hardware provide most of what you need, meaning that you're free to remain blissfully ignorant.&lt;br /&gt;
&lt;br /&gt;
On most Unix systems you can get decent random numbers by reading from /dev/random and /dev/urandom devices. The former draws entropy from a variety of system sources and hashes it together, while the latter is essentially a PRG that seeds itself from the system's entropy pool. Windows can provide you with essentially the same thing via the CryptoAPI (CAPI)'s CryptGenRandom call.&lt;br /&gt;
&lt;br /&gt;
Care must be taken in each of these cases, particularly as your application is now dependent on something you don't control. Many cryptographic libraries (e.g., OpenSSL) will run their own internal PRG, which they seed from sources like the above.&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;I've designed my own PRG&lt;/b&gt;&lt;i&gt;&lt;insert crazy="" here="" thing=""&gt;. &lt;/insert&gt;&lt;/i&gt;&lt;b&gt;Is this a good idea?&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
Maybe. But to be completely honest, it probably isn't.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;If I seed my PRG properly, is it safe to use RSA again?&lt;/b&gt;&lt;/blockquote&gt;
Yes. Despite the title of the recent &lt;a href="http://eprint.iacr.org/2012/064"&gt;Lenstra &lt;i&gt;et al.&lt;/i&gt;&amp;nbsp;paper&lt;/a&gt;, there's nothing wrong with RSA. What &lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;seems to have happened&lt;/a&gt; is that some &lt;i&gt;embedded&lt;/i&gt;&amp;nbsp;systems didn't properly seed their (P)RNGs before generating keys.&lt;br /&gt;
&lt;br /&gt;
I'm sure there's more to it than that, but at a high level: if you make sure to properly seed your PRG, the&amp;nbsp;probability that you'll repeat a prime is negligibly small. In other words, don't sweat it.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
*&amp;nbsp;The security definition for a PRG is simple: no (computationally limited) adversary should be able to distinguish the output of a PRG from a sequence of 'true' random numbers, except with a negligible probability. An equivalent definition is the 'next bit test', which holds that no adversary can predict the next &lt;i&gt;bit&lt;/i&gt; output by a PRG with probability substantially different from 1/2.&lt;br /&gt;
&lt;br /&gt;
** Decrypting Ri gives you (Si XOR Ii), and decrypting DTi gives you Ii. You can now calculate Si by XORing the results. If you know DT{i-1} you can now compute R{i-1} and start the process over again. This was first noted by Kelsey, Schneier, Wagner and Hall in the context of an early version (X9.17). It works even if you only have a rough guess for the timestamp values -- a pretty reasonable assumption, since some implementations specify a counter for the DT values.&lt;br /&gt;
&lt;br /&gt;
*** It's also important to be clear what security properties you're relying on with a hash-based PRG. Most of the high-profile attacks on hash functions (e.g., MD5) focus on finding &lt;a href="http://en.wikipedia.org/wiki/Collision_attack"&gt;collisions&lt;/a&gt;; they're not attacks on&amp;nbsp;the pseudo-random nature of the outputs. In practice, this means you usually get lots of warning before a hash function becomes unsuitable for use in a PRG. Or maybe you won't! Fun stuff.&lt;br /&gt;
&lt;br /&gt;
**** Dual-EC is another fun example of NIST developing provably-secure &lt;i&gt;looking&lt;/i&gt;&amp;nbsp;protocols, but not actually including a security proof. This is particularly bizarre, because the only conceivable reason to use something as slow as Dual-EC is to gain this level of provable security. The generator is divided into two parts: the first generates pseudo-random EC points (this part &lt;i&gt;is&lt;/i&gt;&amp;nbsp;provable under the DDH assumption). The other part turns these points into bits. It's the latter part that has the biasing flaw. Amusingly, the potential 'backdoor' wouldn't be possible if the designers had built this part differently.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-24911521365159855?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/64jpC_UahPY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/24911521365159855/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/random-number-generation-illustrated.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/24911521365159855?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/24911521365159855?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/64jpC_UahPY/random-number-generation-illustrated.html" title="Random number generation: An illustrated primer" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-PwBfH8toUkk/T0P_HeTJuyI/AAAAAAAAAIw/vI22cmuzPSQ/s72-c/dice.jpeg" height="72" width="72" /><thr:total>10</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/random-number-generation-illustrated.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQNQn07fip7ImA9WhRaFE0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2317314041917150828</id><published>2012-02-15T08:40:00.000-08:00</published><updated>2012-02-16T06:43:13.306-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-16T06:43:13.306-08:00</app:edited><title>RSA keys: no insight whatsoever</title><content type="html">&lt;a href="http://support.3d3.com/kb/admin/attachments/pgpkey.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="147" src="http://support.3d3.com/kb/admin/attachments/pgpkey.JPG" width="200" /&gt;&lt;/a&gt;I have a deadline coming up so (substantial) posting will be light this week.&lt;br /&gt;
&lt;br /&gt;
For those of you who don't read the&amp;nbsp;&lt;a href="http://www.nytimes.com/2012/02/15/technology/researchers-find-flaw-in-an-online-encryption-method.html?_r=1"&gt;New York Times&lt;/a&gt;, the big story of the week is this&amp;nbsp;&lt;a href="http://eprint.iacr.org/2012/064"&gt;paper&lt;/a&gt; by Lenstra, Hughes, Augier, Bos, Kleinjung and Wachterlet:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;&lt;a href="http://eprint.iacr.org/2012/064"&gt;Ron was wrong, Whit is right&lt;/a&gt;&lt;/b&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
We performed a sanity check of public keys collected on the web. Our main goal was to test the validity of the assumption that different random choices are made each time keys are generated. We found that the vast majority of public keys work as intended. A more disconcerting finding is that two out of every one thousand RSA moduli that we collected offer no security. Our conclusion is that the validity of the assumption is questionable and that generating keys in the real world for ``multiple-secrets'' cryptosystems such as RSA is significantly riskier than for ``single-secret'' ones such as ElGamal or (EC)DSA which are based on Diffie-Hellman.&lt;/blockquote&gt;
Lots of people have written insightfully on this topic. See Dan Kaminsky's post &lt;a href="http://dankaminsky.com/2012/02/14/ronwhit/"&gt;here&lt;/a&gt;, for example, or Thomas Ptacek's excellent multi-part &lt;a href="https://twitter.com/#!/tqbf"&gt;Twitter musing&lt;/a&gt;. &lt;b&gt;(Update:&lt;/b&gt;&lt;i&gt;&amp;nbsp;much better, see Nadia Heninger's explanation at the end of this post&lt;/i&gt;.)&lt;br /&gt;
&lt;br /&gt;
There must be something wrong with me, because I find it almost impossible to draw any deep insight&amp;nbsp;&lt;i&gt;at all&amp;nbsp;&lt;/i&gt;from this work.&amp;nbsp;Don't get me wrong: the paper itself is a fantastic piece of research; it sets a new standard for data analysis on public keys and certs. I hope we see more like it.&lt;br /&gt;
&lt;br /&gt;
But what's the takeaway? That two-key systems are insecure? That intelligence agencies have known this for years? Maybe. Whatever. The takeaway &lt;i&gt;to me&lt;/i&gt;&amp;nbsp;is that one (or more) RSA keygen implementations had a crappy RNG, or didn't properly seed its &lt;a href="http://en.wikipedia.org/wiki/Pseudorandom_generator"&gt;PRG&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
That's really good to know about, but it isn't the&amp;nbsp;&lt;i&gt;big &lt;/i&gt;news that the paper's title would imply. It doesn't have any implications for the use of RSA or any other cryptosystem. I'd sure like to solve the mystery of &lt;i&gt;which&lt;/i&gt;&amp;nbsp;implementations we need to look out for, and how to make sure this doesn't happen again, but that's literally the only thing I take away from this -- so far.&lt;br /&gt;
&lt;br /&gt;
I don't mean to sound like a curmudgeon. Really, I want&amp;nbsp;to believe. Please help me!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update: &lt;/b&gt;Mystery solved!&amp;nbsp;Nadia Heninger &lt;a href="https://freedom-to-tinker.com/blog/nadiah/new-research-theres-no-need-panic-over-factorable-keys-just-mind-your-ps-and-qs"&gt;has a post&lt;/a&gt;&amp;nbsp;at Freedom to Tinker explaining that most of these keys were generated by embedded devices, and that -- through a parallel research effort -- they actually know&amp;nbsp;&lt;i&gt;which &lt;/i&gt;devices. Once again extremely nice work. Even nicer than Lenstra et al., since it's actually &lt;i&gt;useful. &lt;/i&gt;(I can only imagine how Nadia and her team have been feeling the past two days, seeing 'their' result all over the New York Times. That's responsible disclosure for you.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-2317314041917150828?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/S2IQWEizfHU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2317314041917150828/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/rsa-keys-no-insight-whatsoever.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2317314041917150828?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2317314041917150828?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/S2IQWEizfHU/rsa-keys-no-insight-whatsoever.html" title="RSA keys: no insight whatsoever" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/rsa-keys-no-insight-whatsoever.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQNRnw9eip7ImA9WhRaE08.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5089584200754662019</id><published>2012-02-14T08:05:00.000-08:00</published><updated>2012-02-15T08:13:17.262-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-15T08:13:17.262-08:00</app:edited><title>SSL MITM Update</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://wackao.com/wp-content/uploads/2009/07/mozilla-firefox.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="192" src="http://wackao.com/wp-content/uploads/2009/07/mozilla-firefox.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
The other day I &lt;a href="http://blog.cryptographyengineering.com/2012/02/trustwave-announces-name-change.html"&gt;snarked about&lt;/a&gt; Trustwave's decision to sell subordinate root ('skeleton') certificates to their corporate clients, for the explicit purpose of&amp;nbsp;&lt;strike&gt;destabilizing the web's Public Key Infrastructure&lt;/strike&gt;&amp;nbsp;'legitimately'* intercepting TLS connections. This practice (new to me) is ostensibly&amp;nbsp;only permitted in limited, controlled settings (usually&lt;i&gt;&amp;nbsp;&lt;/i&gt;to spy on a company's employees).&lt;br /&gt;
&lt;br /&gt;
Trustwave argues that the key was always safe inside of a &lt;a href="http://en.wikipedia.org/wiki/Hardware_security_module"&gt;Hardware Security Module&lt;/a&gt; and besides, they're not doing it any more. (Kind of like saying that you handed out the master key to&amp;nbsp;&lt;i&gt;every door on earth&lt;/i&gt;&amp;nbsp;but it's ok 'cause you chained it to a hubcap.)&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the really bad news is that Trustwave may&amp;nbsp;&lt;i&gt;not&lt;/i&gt;&amp;nbsp;be the only major CA implicated in this practice. And at least one &lt;a href="http://www.mozilla.org/"&gt;browser vendor&lt;/a&gt; is &lt;a href="https://groups.google.com/forum/m/#!topic/mozilla.dev.security.policy/0rJtNGxYm3s/discussion"&gt;planning to do something about it&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Dear Certification Authority,&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&lt;br /&gt;This note requests a set of immediate actions on your behalf, as a&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;participant in the Mozilla root program. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Please reply by {date 2 weeks out}&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;to confirm completion of the&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;following actions or state when these actions will be completed. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;1) Subordinate CAs chaining to CAs in Mozilla’s root program may not be&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;used for MITM purposes, regardless of whether it is in a closed and&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;controlled environment or not. Please review all of your subordinate CAs&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;to make sure that they may not be used for MITM purposes. Any existing&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;subordinate CAs that may be used for that purpose must be revoked and&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;any corresponding HSMs destroyed by {date TBD}&lt;date tbd=""&gt;. For each subordinate CA&amp;nbsp;&lt;/date&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;that is revoked, send me:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;a) The certificate that signed the subCA. If it is a root certificate in&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;NSS, then the root certificate's subject and SHA1 fingerprint.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;b) The Serial Number of the revoked certificate.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;c) The CRL that contains the serial number of the revoked certificate.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;As a CA in Mozilla’s root program you are ultimately responsible for&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;certificates issued by you and your subordinate CAs. After {date TBD}&amp;nbsp;&lt;date tbd=""&gt;if&amp;nbsp;&lt;/date&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;it is found that a subordinate CA is being used for MITM, we will remove&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;the corresponding root certificate. Based on Mozilla’s assessment, we&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;may also remove any of your other root certificates, and root&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;certificates from other organizations that cross-sign your certificates. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;2) Please add a statement to your CP/CPS committing that you will not&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;issue a subordinate certificate that may be used for MITM or traffic&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;management of domain names or IPs that the party does not legitimately&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;own or control. Send me the URL to the updated document(s) and the&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;impacted sections or page numbers.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Participation in Mozilla's root program is at our sole discretion, and&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;we will take whatever steps are necessary to keep our users safe.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Nevertheless, we believe that the best approach to safeguard that&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;security is to work with CAs as partners, to foster open and frank&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;communication, and to be diligent in looking for ways to improve. Thank&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;you for your participation in this pursuit.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Regards,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Kathleen Wilson&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;Module Owner of Mozilla's CA Certificates Module&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now I'm no bomb-thrower, but if it were up to me, {Date TBD} would be yesterday and there would be no re-entry for the CAs caught doing this kind of thing. Still,&amp;nbsp;I'm glad that Mozilla is doing this, and we're all lucky that they have the independence and browser share to force this kind of change.&lt;br /&gt;
&lt;br /&gt;
But not everything is sunshine and rainbows:&lt;br /&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;We have to trust that the CAs in question will respond honestly to Mozilla's inquiry and will voluntarily exit a (presumably) lucrative business. This relies very much on the honor system, and it's hard to presume much honor in a CA that would sell such a product in the first place.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Mozilla only represents 25% of the browser share, and that seems to be falling. That's probably enough to make the difference -- today -- but it'd be nice to hear something similar from Microsoft or Google.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;We still lack a good client-side mechanism for detecting &lt;i&gt;and reporting&lt;/i&gt; unusual (that is: correctly signed, but inconsistent) certificates. Given the news from Trustwave, such a mechanism seems more useful than ever.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
We cannot possibly have faith in the security of the Internet when CAs are willing to engage in this kind of practice -- even if they do it under the most 'carefully-controlled' conditions.&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
* Whatever that means.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-5089584200754662019?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/LBkOUsc8lRs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5089584200754662019/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/quick-hit-ssl-mitm-update.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5089584200754662019?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5089584200754662019?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/LBkOUsc8lRs/quick-hit-ssl-mitm-update.html" title="SSL MITM Update" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/quick-hit-ssl-mitm-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUBSX4_fip7ImA9WhRbGU4.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4104317416417534174</id><published>2012-02-09T13:57:00.000-08:00</published><updated>2012-02-10T20:07:38.046-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-10T20:07:38.046-08:00</app:edited><title>Trustwave announces name change: henceforth will simply be 'Wave'</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.world-net.net/images/trustwave.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://www.world-net.net/images/trustwave.gif" /&gt;&lt;/a&gt;&lt;/div&gt;
This story has making the &lt;a href="http://www.h-online.com/security/news/item/Trustwave-issued-a-man-in-the-middle-certificate-1429982.html"&gt;rounds for about a week&lt;/a&gt;&amp;nbsp;and I'm &lt;i&gt;still&lt;/i&gt;&amp;nbsp;shocked by it. Here's the postage stamp version: at some point in the past few years, certificate authority &lt;a href="https://www.trustwave.com/"&gt;Trustwave&lt;/a&gt; basically handed out their root signing capability to a third party company. But don't worry, it's all better now.&lt;br /&gt;
&lt;br /&gt;
As with any such story, there are bits we know and bits we have to speculate about. Speculation is more fun, so let's start there:&lt;br /&gt;
&lt;br /&gt;
Once upon a time there was a company -- let's call them ACME Inc -- who really didn't trust its employees.&amp;nbsp;For ACME the solution was vigilance. Constant,&amp;nbsp;&lt;i&gt;invasive&lt;/i&gt;&amp;nbsp;vigilance&lt;i&gt;.&lt;/i&gt;&amp;nbsp;ACME's IT department was given the task of intercepting every packet sent to and from the corporate network, which seemed straightforward; until someone pointed out that&amp;nbsp;they could &lt;i&gt;intercept&lt;/i&gt; all the packets they wanted, but they couldn't necessarily &lt;i&gt;read&lt;/i&gt;&amp;nbsp;them. Especially not the ones encrypted with SSL/TLS.&lt;br /&gt;
&lt;br /&gt;
Now this isn't a killer. ACME had a few options: they could&amp;nbsp;&lt;i&gt;(a)&lt;/i&gt;&amp;nbsp;block&amp;nbsp;SSL/TLS at their network gateway, forcing everyone to use cleartext connections. They could &lt;i&gt;(b)&amp;nbsp;&lt;/i&gt;force their employees to use some awkward SSL proxy. If they were feeling ambitious, they could even &lt;i&gt;(c) &lt;/i&gt;run a man-in-the-middle on every SSL connection initiated from within their corporate network. The last option would result in some awkward certificate errors, however -- which would be unpleasant for web users, and downright nasty for embedded devices or headless boxes.&lt;br /&gt;
&lt;br /&gt;
But really, each of these solution is just a different version of flypaper. Why catch flies with flypaper, when you can totally screw with the trust model of the Internet?&lt;br /&gt;
&lt;br /&gt;
And this is where we get to the facts.&amp;nbsp;A few years back ACME -- or some company like ACME -- approached Trustwave with this problem. Trustwave seemed like a good group to ask, since they're one of the select few companies that &lt;i&gt;make&amp;nbsp;&lt;/i&gt;SSL certificates, &lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;they're one of the 'authorities' whose root certs are built into all of the major browsers and OSes.&lt;br /&gt;
&lt;br /&gt;
Somehow the two companies cooked up the following plan. Trustwave would generate a new 'subordinate root' certificate with full signing authority. Anyone who possessed the signing key for this cert would essentially &lt;i&gt;be&lt;/i&gt;&amp;nbsp;Trustwave -- meaning that they could vouch for any website they wanted. Of course, such a key would be enormously valuable (and dangerous). No responsible CA would allow such a thing to leave their facilities.&lt;br /&gt;
&lt;br /&gt;
But apparently Trustwave's motto is 'think different'. So they cheerfully packed the signing key&amp;nbsp;into a Hardware Security Module and sent it over to ACME. From that point on, ACME possessed the ability to transparently impersonate &lt;i&gt;any SSL website on the Internet&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
And impersonate they did; whenever some client initiated an SSL connection from within ACME's corporate network, an ACME server would intercept the connection, sign a fresh certificate on the requested domain, then deliver that cert back to the client. To the client, it appeared that the connection went through perfectly. But of course the client was now talking to ACME's server,&lt;i&gt;&amp;nbsp;not&lt;/i&gt;&amp;nbsp;to the company whose name was on the certificate. ACME would in turn&amp;nbsp;connect on to the &lt;i&gt;target&amp;nbsp;&lt;/i&gt;SSL server, thus completing the connection.&lt;br /&gt;
&lt;br /&gt;
Technically this tampering wasn't totally invisible; a clever user might notice that every certificate was now signed by Trustwave -- and comparison with certificates received &lt;i&gt;outside&lt;/i&gt;&amp;nbsp;of ACME's network would clearly reveal something funny going on. But since the vast majority of web users &lt;i&gt;don't&lt;/i&gt;&amp;nbsp;check this kind of thing, the interception was basically transparent.&lt;br /&gt;
&lt;br /&gt;
Now I hope I don't need to tell you why this is a bad idea. Let's just take it a a given that this is a bad idea. Even Trustwave now realizes it's a bad idea, and have&amp;nbsp;'proactively' revoked the cert to make sure the evil thing doesn't fall into the wrong hands. From their&amp;nbsp;&lt;a href="http://blog.spiderlabs.com/2012/02/clarifying-the-trustwave-ca-policy-update.html"&gt;blog post&lt;/a&gt;&amp;nbsp;about it:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;Trustwave has decided to be open about this decision as well as stating that we will no longer enable systems of this type and are effectively ending this short journey into this type of offering.&lt;/i&gt;&lt;/blockquote&gt;
&lt;div&gt;
I guess we can at least be thankful that Trustwave has decided to be open about this decision, despite the fact that they &lt;i&gt;weren't&lt;/i&gt;&amp;nbsp;open about it while it was happening. Let's all hope this is really the last journey Trustwave plans to take into&lt;i&gt; this type of offering, &lt;/i&gt;where&amp;nbsp;by 'offering' I mean -- disastrous, short-sighted mistake.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-4104317416417534174?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/92onuIGFrZ0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4104317416417534174/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/trustwave-announces-name-change.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4104317416417534174?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4104317416417534174?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/92onuIGFrZ0/trustwave-announces-name-change.html" title="Trustwave announces name change: henceforth will simply be 'Wave'" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/trustwave-announces-name-change.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUDRHo8eCp7ImA9WhRaFE8.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-1030567993844004760</id><published>2012-02-05T12:25:00.000-08:00</published><updated>2012-02-16T11:24:35.470-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-16T11:24:35.470-08:00</app:edited><title>Satellite phone encryption is terrible. Anyone surprised?</title><content type="html">&lt;a href="http://www.thuraya.de/media/Thuraya-Rugged-XS.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;i&gt;&lt;img border="0" height="320" src="http://www.thuraya.de/media/Thuraya-Rugged-XS.jpg" width="160" /&gt;&lt;/i&gt;&lt;/a&gt;&lt;br /&gt;
I adhere to a 'one post, one topic' rule on this blog, which means that this weekend I actually have to&amp;nbsp;&lt;i&gt;choose&lt;/i&gt;&amp;nbsp;which bad-crypto news I'm going to blog about.&lt;br /&gt;
&lt;br /&gt;
It's a tough call, but the most interesting story&amp;nbsp;&lt;a href="http://cryptanalysis.eu/blog/2012/02/02/dont-trust-satellite-phones-the-gmr-1-and-gmr-2-ciphers-have-been-broken/"&gt;comes via Erik Tews&lt;/a&gt;, who recently attended a talk on satellite phone security at Ruhr&amp;nbsp;Universität Bochum. It seems that researchers Benedikt Driessen, Ralf Hund,&amp;nbsp;Carsten Willems, Christof Paar, and Thorsten Holz&amp;nbsp;&lt;a href="http://gmr.crypto.rub.de/paper/paper-1.pdf"&gt;have reverse-engineered and cryptanalyzed&lt;/a&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;the&lt;i&gt;&amp;nbsp;&lt;/i&gt;proprietary ciphers used in the&amp;nbsp;&lt;a href="http://www.hughes.com/ProductsAndTechnology/StandardsTechnicalPublications/Pages/OtherCommonAirInterfaceStandards.aspx"&gt;GMR-1&lt;/a&gt;&amp;nbsp;and GMR-2 satellite telephone standards.* If you've never heard of these standards, what you need to know is that they power the networks of satphone providers&amp;nbsp;&lt;a href="http://www.thuraya.com/"&gt;Thuraya&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="http://www.inmarsat.com/"&gt;Inmarsat&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The verdict? Encrypting with these ciphers is better than using &lt;i&gt;no&lt;/i&gt;&amp;nbsp;encryption. But not necessarily by much.&lt;br /&gt;
&lt;br /&gt;
I guess this shouldn't come as a big shock -- link privacy in mobile telephony has always been kind of a mess. And the GMR ciphers come from the same folks (&lt;a href="http://www.etsi.org/WebSite/homepage.aspx"&gt;ETSI&lt;/a&gt;) who brought us the A5-series GSM ciphers. If you pay attention to this sort of thing, you probably know that &lt;i&gt;those&lt;/i&gt; ciphers have &lt;a href="http://www.nytimes.com/2009/12/29/technology/29hack.html?pagewanted=all"&gt;also had some problems&lt;/a&gt;. In fact, today it's possible to download&amp;nbsp;&lt;a href="http://opensource.srlabs.de/projects/a51-decrypt/files"&gt;rainbow tables&lt;/a&gt;&amp;nbsp;that permit (efficient) decryption of A5/1-encrypted GSM phone calls.&lt;br /&gt;
&lt;br /&gt;
A5/1 is actually the&amp;nbsp;&lt;i&gt;strong&lt;/i&gt;&amp;nbsp;member of the GSM family. For export purposes there's&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/A5/2"&gt;A5/2&lt;/a&gt; -- a weakened version with a much shorter key. You don't hear about people downloading huge A5/2 rainbow tables, mostly because you&amp;nbsp;&lt;i&gt;don't&lt;/i&gt; &lt;i&gt;need&lt;/i&gt;&amp;nbsp;&lt;i&gt;them&lt;/i&gt;. A5/2 is vulnerable to&amp;nbsp;&lt;a href="http://cryptome.org/gsm-crack-bbk.pdf"&gt;ciphertext-only attacks&lt;/a&gt;&amp;nbsp;that run in a few minutes on a standard PC.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-bQ7wT6RKwBo/Ty4KVbRrd9I/AAAAAAAAAIQ/mRAtACX6ZS4/s1600/a52.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="122" src="http://1.bp.blogspot.com/-bQ7wT6RKwBo/Ty4KVbRrd9I/AAAAAAAAAIQ/mRAtACX6ZS4/s200/a52.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A5/2 GSM cipher. Image:&amp;nbsp;&lt;a href="http://cryptome.org/gsm-crack-bbk.pdf"&gt;Barkan, Biham, Keller&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
ETSI seems to have had A5/2 in mind when developing the GMR-1 and GMR-2 ciphers. Both are custom designs, use short keys, and depend heavily on&amp;nbsp;&lt;i&gt;obscurity of design&amp;nbsp;&lt;/i&gt;to make up for any shortcomings (the ciphers are only given to manufacturers&lt;i&gt;&amp;nbsp;&lt;/i&gt;who sign an NDA). This secrecy hardly inspires confidence, and worse yet, it &lt;i&gt;doesn't even do a good job of keeping things secret.&lt;/i&gt;&amp;nbsp;The R.U.B. researchers didn't have to break into Thuraya's hardware lab; they simply reversed the ciphers from handset&lt;i&gt;&amp;nbsp;&lt;/i&gt;firmware updates.**&lt;br /&gt;
&lt;br /&gt;
GMR-1 uses an LFSR-based cipher quite similar to A5/2 (pictured above), which means that it's vulnerable to a similar class of attacks.&amp;nbsp;Since the underlying plaintext has correctness checks built into it, it's possible to recover the key using only ciphertext and about 30 minutes on a standard PC. The GMR-2 cipher is a bit more sophisticated (and &lt;a href="http://cryptanalysis.eu/blog/2012/02/02/dont-trust-satellite-phones-the-gmr-1-and-gmr-2-ciphers-have-been-broken/"&gt;weirder&lt;/a&gt;&amp;nbsp;to boot), but it also appears to have weaknesses.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.ewh.ieee.org/r2/baltimore/Chapter/Comm/egmprs/sld002.htm"&gt;&lt;img border="0" height="240" src="http://www.ewh.ieee.org/r2/baltimore/Chapter/Comm/egmprs/img004.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So why is this a big deal?&amp;nbsp;The obvious answer is that satellite telephone security &lt;i&gt;matters&lt;/i&gt;. In many underdeveloped rural areas it's the primary means of communicating with the outside world. Satphone coverage is also important in war zones, where signal privacy is of more than academic interest.&lt;br /&gt;
&lt;br /&gt;
Moreover, eavesdropping on satellite communications is (in principle) easier than eavesdropping on cellular signals. That's because satellite 'spot beams' cover relatively broad geographic territories (Thuraya's are 600km on average). So you don't just have to worry about eavesdropping by your neighbor, you have to worry about eavesdropping by &lt;i&gt;neighboring countries.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The really sad thing is that, unlike cellular networks -- which are fundamentally vulnerable to government eavesdropping at the infrastructure level&amp;nbsp;-- satellite networks like Thuraya/Inmarsat don't need local infrastructure. That means their systems really&amp;nbsp;&lt;i&gt;could have &lt;/i&gt;provided&amp;nbsp;privacy for individuals persecuted by oppressive regimes. You can argue about whether the manufacturers even had the option to use strong ciphers; it's quite possible they didn't. Still, I suspect this will be cold comfort to those who suffer as a direct result of ETSI's design choices.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.ewh.ieee.org/r2/baltimore/Chapter/Comm/egmprs/sld002.htm"&gt;&lt;img border="0" height="240" src="http://www.ewh.ieee.org/r2/baltimore/Chapter/Comm/egmprs/img007.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
Those who are really in the know (news organizations, for example) claim to use additional security measures beyond the built-in link encryption found in GMR-1 and GMR-2. Presumably these days the best way to do that is to run your own voice protocol via the packet data extensions. This practice ought to become more common going forward; now that the GMR-1&amp;nbsp;&lt;a href="http://gmr.osmocom.org/trac/blog/a5-gmr-1-support"&gt;code is public&lt;/a&gt;, it looks like the barriers to eavesdropping are going to go down quite a bit.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;The slides above come from &lt;a href="http://www.ewh.ieee.org/r2/baltimore/Chapter/Comm/egmprs/"&gt;this presentation&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* &lt;b&gt;Update&lt;/b&gt; &lt;b&gt;2/16/2012:&lt;/b&gt;&amp;nbsp;I had some initial confusion about the authorship on this work, but the research paper clears it all up: see&amp;nbsp;&lt;a href="http://gmr.crypto.rub.de/paper/paper-1.pdf"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
** And by 'simply', I mean 'with great expertise and difficulty' -- don't read this as trivializing the effort involved. Obtaining the ciphers meant disassembling code written in a proprietary DSP instruction set, and then searching for a cipher without knowing exactly what it looks like. All in all a pretty significant accomplishment. The&amp;nbsp;point here is that &lt;i&gt;it could have been a lot harder.&lt;/i&gt;&amp;nbsp;If you're going to keep a cipher secret, you shouldn't release it as software in the first place.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-1030567993844004760?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/TBZFnn3p56Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/1030567993844004760/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/sattelite-phone-encryption-is-terrible.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1030567993844004760?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1030567993844004760?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/TBZFnn3p56Q/sattelite-phone-encryption-is-terrible.html" title="Satellite phone encryption is terrible. Anyone surprised?" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-bQ7wT6RKwBo/Ty4KVbRrd9I/AAAAAAAAAIQ/mRAtACX6ZS4/s72-c/a52.png" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/sattelite-phone-encryption-is-terrible.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8MQnw9fSp7ImA9WhRbEkw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-7364107077293170451</id><published>2012-02-02T10:07:00.000-08:00</published><updated>2012-02-02T12:18:03.265-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-02T12:18:03.265-08:00</app:edited><title>Multiple encryption</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://athome.kimvallee.com/wp-content/uploads/2010/10/Cocktails_BloodyBrain.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="131" src="http://athome.kimvallee.com/wp-content/uploads/2010/10/Cocktails_BloodyBrain.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Not everything combines well&lt;i&gt;.&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
While browsing some community websites, I noticed a few people talking about the security of &lt;i&gt;double&lt;/i&gt;&amp;nbsp;(or more generally,&amp;nbsp;&lt;i&gt;multiple) encryption&lt;/i&gt;.&amp;nbsp;Multiple encryption addresses the following problem: you have two (or more) encryption schemes, and you're worried that one of them might get compromised. Surely if you encrypt with &lt;i&gt;both&lt;/i&gt;&amp;nbsp;at the same time you'll buy yourself an added safety margin.&lt;br /&gt;
&lt;br /&gt;
Let me preface this by saying that multiple encryption addresses a problem that &lt;i&gt;mostly&lt;/i&gt;&amp;nbsp;doesn't exist. Modern ciphers rarely get broken -- at least, not in the &lt;a href="http://blog.cryptographyengineering.com/2012/01/bad-movie-cryptography-of-week.html"&gt;Swordfish&lt;/a&gt; sense. You're far more likely to get hit by malware or an implementation bug than you are to suffer from a catastrophic attack on AES.*&lt;br /&gt;
&lt;br /&gt;
That said, you really&amp;nbsp;&lt;i&gt;are&lt;/i&gt;&amp;nbsp;likely to get hit by malware or an implementation bug. And that's at least one argument for multiple encryption -- if you're willing to encrypt on separate, heterogenous devices.**&amp;nbsp;There's also the future to think about. We feel good about AES today, but how will we feel in 2040?&lt;br /&gt;
&lt;br /&gt;
I note that these are problems for the extremely paranoid -- governments, mostly --&amp;nbsp;&lt;i&gt;not&lt;/i&gt;&amp;nbsp;for the typical developer. The majority of us should work on getting&lt;i&gt;&amp;nbsp;single encryption &lt;/i&gt;right.&amp;nbsp;But this kind of thing isn't ridiculous -- the &lt;a href="http://www.cosic.esat.kuleuven.be/nessie/deliverables/decision-final.pdf"&gt;NESSIE standards&lt;/a&gt; even recommend it. Moreover, my experience is that when people start &lt;i&gt;asking&lt;/i&gt;&amp;nbsp;questions about the security of &lt;i&gt;X&lt;/i&gt;, it means that they're already &lt;i&gt;doing&lt;/i&gt;&amp;nbsp;X, and have been for some time.&lt;br /&gt;
&lt;br /&gt;
So for all that, it's worth answering some of these questions. And roughly speaking, the questions are:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Am I better off encrypting with two or more encryption schemes (or keys?)&lt;/li&gt;
&lt;li&gt;Could I be &lt;i&gt;worse off?&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;If I have to do it, how should I do it securely?&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Given how little sleep I've gotten recently I don't promise to answer these&amp;nbsp;&lt;i&gt;fully&lt;/i&gt;, or in any particular order. But I do hope I can provide a little bit of insight around the edges.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;Preliminaries&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are many ways to double encrypt, but for most people 'double encryption' means this:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;SuperDuperEncrypt(KA, KB, M) = EncryptA(KA, EncryptB(KB, M))&lt;/span&gt;&lt;/blockquote&gt;
This construction is called a &lt;i&gt;cascade&lt;/i&gt;.&amp;nbsp;Sometimes&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptA&lt;/span&gt; and &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptB&lt;/span&gt; are different algorithms, but that's not really critical.&amp;nbsp;What does matter for our purposes is that the &lt;i&gt;keys&lt;/i&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KA&lt;/span&gt; and &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KB&lt;/span&gt; are independently-generated&lt;i&gt;.*** (&lt;/i&gt;To make life easier, we'll also assume that the algorithms are published.)&lt;br /&gt;
&lt;br /&gt;
A &lt;a href="http://www.sciencedirect.com/science/article/pii/0898122181900298"&gt;lot&lt;/a&gt; has been written about cascade encryption, some good and some bad. The answer to the question largely depends on whether the algorithms are simply block ciphers, or if they're true &lt;i&gt;encryption&lt;/i&gt;&amp;nbsp;algorithms (&lt;i&gt;e.g., &lt;/i&gt;a mode of operation using a block cipher). It also depends on what security definition you're trying to achieve.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The good&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Let's consider the positive results first. If either &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptA&lt;/span&gt; or &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptB&lt;/span&gt; is 'semantically secure'&lt;i&gt;, &lt;/i&gt;i.e., indistinguishable under&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Ciphertext_indistinguishability#Indistinguishability_under_chosen-plaintext_attack_.28IND-CPA.29"&gt;chosen-plaintext attack&lt;/a&gt;, then so is the &lt;a href="http://eprint.iacr.org/2002/135.pdf"&gt;cascade of the two&lt;/a&gt;.&amp;nbsp;This may seem wonky, but it's actually very handy -- since many common cryptosystems are specifically analyzed under (at least) this level of security. For example, in the symmetric setting, both&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29"&gt;CTR&lt;/a&gt;&amp;nbsp;modes of operation &lt;a href="http://www.cs.ucdavis.edu/~rogaway/papers/sym-enc.pdf"&gt;can both be shown&lt;/a&gt; to achieve this security level, provided that they're implemented with a secure block cipher.&lt;br /&gt;
&lt;br /&gt;
So how do we know the combined construction is secure? A formal proof can be found in this &lt;a href="http://eprint.iacr.org/2002/135.pdf"&gt;2002 paper&lt;/a&gt; by Herzberg, but the intuition is pretty simple. If there's an attack algorithm that 'breaks' the combined construction, then we can use that algorithm&lt;i&gt; &lt;/i&gt;to&amp;nbsp;attack either of the two underlying algorithms by simply &lt;i&gt;picking our own key&lt;/i&gt;&amp;nbsp;for the other algorithm and simulating the double encryption on its ciphertexts.&lt;br /&gt;
&lt;br /&gt;
This means that an attack on the combination &lt;i&gt;is&lt;/i&gt;&amp;nbsp;an attack on the underlying schemes. So if one is secure, you're in good shape.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The not-so-good&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Interestingly, Herzberg &lt;a href="http://eprint.iacr.org/2002/135.pdf"&gt;also shows&lt;/a&gt;&amp;nbsp;that the above result does &lt;i&gt;not&lt;/i&gt; apply for all definitions of security, particularly strong definitions such as &lt;a href="http://en.wikipedia.org/wiki/Ciphertext_indistinguishability#Indistinguishability_under_chosen_ciphertext_attack.2Fadaptive_chosen_ciphertext_attack_.28IND-CCA.2C_IND-CCA2.29"&gt;adaptive-chosen ciphertext security&lt;/a&gt;. In the symmetric world, we usually achieve this level of security using&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Authenticated_encryption"&gt;authenticated encryption&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
To give a concrete (symmetric encryption) example, imagine that the inner layer of encryption (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptB&lt;/span&gt;) is&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Authenticated_encryption"&gt;authenticated&lt;/a&gt;, as is the case in&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Galois/Counter_Mode"&gt;GCM-mode&lt;/a&gt;. Authenticated encryption provides both &lt;i&gt;confidentiality&lt;/i&gt; (attackers can't read your message) and&amp;nbsp;&lt;i&gt;authenticity&amp;nbsp;&lt;/i&gt;(attackers can't tamper with your message -- or change the ciphertext in any way.)&lt;br /&gt;
&lt;br /&gt;
Now imagine that the outer scheme (&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptA&lt;/span&gt;)&amp;nbsp;&lt;i&gt;doesn't&lt;/i&gt;&amp;nbsp;provide this guarantee. For a simple example, consider CBC-mode encryption with padding at the end. CBC-mode is well known for its&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Malleability_(cryptography)"&gt;malleability&lt;/a&gt;; attackers can flip bits in a ciphertext, which causes predictable changes to the underlying plaintext.&lt;br /&gt;
&lt;br /&gt;
The combined scheme still provides some authenticity protections -- if the attacker's tampering affects the inner (GCM) ciphertext, then his changes should be detected (and rejected) upon combined decryption. But if his modifications only change the CBC-mode &lt;i&gt;padding&lt;/i&gt;, then the combined ciphertext could be accepted as valid. Hence the combined scheme is 'benignly' malleable,&lt;i&gt;&amp;nbsp;&lt;/i&gt;making it technically&amp;nbsp;&lt;i&gt;weaker&lt;/i&gt;&amp;nbsp;than the inner layer of encryption.&lt;br /&gt;
&lt;br /&gt;
Do you care about this? Maybe, maybe not. Some protocols really&amp;nbsp;&lt;i&gt;do&lt;/i&gt;&amp;nbsp;require a completely non-malleable ciphertext -- for example,&amp;nbsp;to prevent &lt;a href="http://en.wikipedia.org/wiki/Replay_attack"&gt;replay attacks&lt;/a&gt;&amp;nbsp;-- but in most applications these attacks aren't world-shattering. If you do care, you can find some alternative constructions &lt;a href="http://eprint.iacr.org/2003/181.pdf"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The ugly&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Of course, so far all I've discussed is whether the combined encryption scheme is &lt;i&gt;at least as&lt;/i&gt;&amp;nbsp;secure as either underlying algorithm. But some people want more than 'at least as'. More importantly, I've been talking about entire encryption algorithms (&lt;i&gt;e.g., &lt;/i&gt;modes of operation), not raw ciphers.&lt;br /&gt;
&lt;br /&gt;
So let's address the first question. Is a combined encryption scheme significantly more secure than either algorithm on its own? Unfortunately the answer is: &lt;i&gt;not necessarily&lt;/i&gt;. There are at least a couple of counterexamples here:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;i&gt;The encryption scheme is a group.&lt;/i&gt;&amp;nbsp;Imagine that &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptA&lt;/span&gt; and &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;EncryptB&lt;/span&gt; are the same algorithm, with the following special property: when you encrypt sequentially with &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KA&lt;/span&gt; and &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KB&lt;/span&gt; you obtain a ciphertext that can be decrypted with some&amp;nbsp;&lt;i&gt;third&lt;/i&gt;&amp;nbsp;key &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KC&lt;/span&gt;.**** In this case, the resulting ciphertext ought to be at least as vulnerable as a single-encrypted ciphertext. Hence double-encrypting gives you no additional security &lt;i&gt;at all.&amp;nbsp;&lt;/i&gt;Fortunately modern&amp;nbsp;&lt;i&gt;block ciphers&lt;/i&gt;&amp;nbsp;&lt;a href="http://math.boisestate.edu/~liljanab/Math509Spring10/DesNotGroup.pdf"&gt;don't (seem) to have&lt;/a&gt; this property -- in fact, cryptographers explicitly design against it, as it can make the cipher weaker. But some&amp;nbsp;&lt;a href="http://www.rose-hulman.edu/~holden/Preprints/pohlig-hellman.pdf"&gt;number-theoretic schemes&lt;/a&gt; do, hence it's worth looking out for.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Meet-in-the-Middle Attacks.&lt;/i&gt;&amp;nbsp;MiTM attacks are the most common 'real-world' counterexample that come up in discussions of cascade encryption (really, cascade &lt;i&gt;encipherment)&lt;/i&gt;. This attack was first discovered by &lt;a href="http://origin-www.computer.org/plugins/dl/pdf/mags/co/1977/06/01646525.pdf?template=1&amp;amp;loginState=1&amp;amp;userData=anonymous-IP%253A%253AAddress%253A%2B96.6.46.94%252C%2B%255B140.98.196.191%252C%2B76.21.153.251%252C%2B127.0.0.1%252C%2B96.6.46.94%255D"&gt;Diffie and Hellman&lt;/a&gt;, and is a member of a class we call &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Space%E2%80%93time_tradeoff"&gt;time-space tradeoff&lt;/a&gt; attacks.&lt;/i&gt;&amp;nbsp;It's useful in constructions that use a deterministic algorithm like a block cipher. For example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;DOUBLE_DES(KA, KB, M) = DES_ENCRYPT(KA, DES_ENCRYPT(KB, M))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the face of it, you'd assume that this construction would be substantially stronger than a single layer of DES. If a brute-force attack on DES requires 2^56 operations (DES has a 56-bit key), you'd hope that attacking a construction with &lt;i&gt;two&lt;/i&gt;&amp;nbsp;DES keys would require on the order of 2^112 operations. But actually this hope is a false one -- &lt;i&gt;if the attacker has lots of storage.&lt;br /&gt;&amp;nbsp;&lt;/i&gt;The attack works like this. First, obtain the encryption&amp;nbsp;&lt;i&gt;C&lt;/i&gt;&amp;nbsp;of some &lt;i&gt;known &lt;/i&gt;plaintext&lt;i&gt; M&lt;/i&gt;&amp;nbsp;under the two unknown secret keys &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KA&lt;/span&gt; and &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KB&lt;/span&gt;. Next,&amp;nbsp;construct a huge table comprising the encipherment of&amp;nbsp;&lt;i&gt;M&lt;/i&gt;&amp;nbsp;under every possible DES key. In our DES example there are 2^56 keys, this would take a corresponding amount of effort, and the resulting table will be astonishingly huge.&amp;nbsp;But leave that aside for the moment.&lt;br /&gt;&lt;br /&gt;Finally, try decrypting&amp;nbsp;&lt;i&gt;C&lt;/i&gt;&amp;nbsp;with&amp;nbsp;every possible DES key. For each result, check to see if it's in the table you just made. If you find a match, you've now got two keys: &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KA'&amp;nbsp;&lt;/span&gt;and&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;KB'&lt;/span&gt;&amp;nbsp;that satisfy the encryption equation above.*****&lt;br /&gt;&lt;br /&gt;If you ignore storage costs (ridiculously impractical, but which may also be traded for time), this attack will run you (2^56)*2 = 2^57 cipher operations.&amp;nbsp;That's &lt;i&gt;much&lt;/i&gt;&amp;nbsp;less than the 2^112 we were hoping for. If you're willing to treat it as a&amp;nbsp;&lt;i&gt;chosen&lt;/i&gt;&amp;nbsp;&lt;i&gt;plaintext attack&lt;/i&gt; you can even re-use the table for many separate attacks.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Plaintext distribution issues.&amp;nbsp;&lt;/i&gt;Maurer showed &lt;a href="ftp://ftp.inf.ethz.ch/pub/crypto/publications/MauMas93a.pdf"&gt;one more interesting result&lt;/a&gt;, which is that in a cascade of&amp;nbsp;&lt;i&gt;ciphers&lt;/i&gt;, the entire construction is guaranteed to be as secure as the first cipher, but &lt;i&gt;not necessarily any stronger&lt;/i&gt;. This is because the first cipher may introduce certain patterns into its output that can assist the attacker in breaking the second layer of encipherment. Maurer even provides a (very contrived) counterexample in which this happens.&lt;br /&gt;&lt;br /&gt;I presume that this is the source of the following folklore construction, which is referenced in Applied Cryptography and other sources around the Internet:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;UberSuperEncrypt(KA, KB, M) = EncryptA(KA, R⊕M) ||&amp;nbsp;EncryptB(KB, R))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Where || indicates concatenation, and&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;R&lt;/span&gt;&lt;span style="font-size: small;"&gt; is a random string of the same length of the message. Since in this case both &lt;/span&gt;&lt;span style="font-size: small;"&gt;R&lt;/span&gt;&lt;span style="font-size: small;"&gt; and&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="font-size: x-small;"&gt;R⊕M&amp;nbsp;&lt;/span&gt;both have a random distribution, this tends to eliminate the issue that Maurer notes. At the cost of doubling the ciphertext size!&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;
Now the good news is that multiple encipherment (done properly) can &lt;i&gt;probably&lt;/i&gt;&amp;nbsp;make things more&amp;nbsp;secure.&amp;nbsp;This is precisely what constructions like DESX and 3DES try to achieve (using a single cipher). If you make certain strong assumptions about the &lt;i&gt;strength&lt;/i&gt;&amp;nbsp;of the cipher, it is possible to show that these constructions are harder&amp;nbsp;to attack than the underlying cipher itself (see this analysis&amp;nbsp;of&amp;nbsp;&lt;a href="http://www.cs.ucdavis.edu/~rogaway/papers/desx.pdf"&gt;DESX&lt;/a&gt;&amp;nbsp;and this one of 3&lt;a href="http://eprint.iacr.org/2004/331.pdf"&gt;DES&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
I warn you that these analyses use an unrealistic model for the security of the cipher, and they don't treat multiple &lt;i&gt;distinct&lt;/i&gt;&amp;nbsp;ciphers., Still, they're a useful guide -- assuming that your attacker does not have any special attack against (at least one) of the underlying schemes. Your mileage may vary, and I would generally advise against assembling this sort of thing yourself unless you really know what you're doing.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I'm afraid this post will end with a whimper rather than a bang. It's entirely possible to combine encryption schemes in secure ways (many of which are &lt;i&gt;not&lt;/i&gt;&amp;nbsp;cascade constructions), but the &lt;i&gt;amount&lt;/i&gt;&amp;nbsp;of extra security you'll get is subject to some debate.&lt;br /&gt;
&lt;br /&gt;
In fact, this entire idea has been studied for a quite a while under the heading of &lt;i&gt;(robust) combiners&lt;/i&gt;. These deal with combining cryptosystems (encryption, as well as hashing, signing, protocols, etc.) in a secure way, such that the combination remains secure even if some of the underlying schemes are broken.&lt;br /&gt;
&lt;br /&gt;
If you're interested, that's the place to start. But in general&amp;nbsp;my advice is that this is not something that most people should spend a lot of time doing, outside of (perhaps) the government and the academic world. If you want to do this, you should familiarize yourself with some of the academic papers already mentioned. Otherwise, think hard about &lt;i&gt;why&lt;/i&gt;&amp;nbsp;you're doing it, and what it's going to buy you.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;* &lt;/i&gt;And yes, I know about MD5 and the recent biclique attacks one AES. That &lt;i&gt;still&lt;/i&gt;&amp;nbsp;doesn't change my opinion.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;** &lt;/i&gt;Note that this is mostly something the government likes to think about, namely: how to use consumer off-the-shelf products together so as to achieve the same security as trusted, government-certified hardware. I'm dubious about this strategy based on my suspicion that all consumer products will soon be manufactured by&amp;nbsp;&lt;a href="http://www.foxconn.com/"&gt;Foxconn&lt;/a&gt;. Nonetheless&amp;nbsp;I wish them luck.&lt;br /&gt;
&lt;br /&gt;
*** This key independence is a big deal. If the keys are related (worst case: KA &lt;i&gt;equals&lt;/i&gt;&amp;nbsp;KB) then all guarantees are off. For example, consider a stream cipher like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29"&gt;CTR mode&lt;/a&gt;,&amp;nbsp;where encryption and decryption are the same algorithm. If you use the same algorithm and key, you'd completely cancel out the encryption, &lt;i&gt;i.e.:&lt;/i&gt;&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;CTR_ENC(K, IV, CTR_ENC(K, IV, M) = M.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
**** Classical &lt;a href="http://en.wikipedia.org/wiki/Substitution_cipher"&gt;substitution ciphers&lt;/a&gt; (including the &lt;a href="http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher"&gt;Vigenere&lt;/a&gt;&amp;nbsp;cipher and Vernam One-Time Pad) have this structure.&lt;br /&gt;
&lt;br /&gt;
*****&amp;nbsp;The resulting KA' and KB' &lt;i&gt;aren't&lt;/i&gt;&amp;nbsp;necessarily the right keys, however, due to&amp;nbsp;&lt;i&gt;false positives:&lt;/i&gt;&amp;nbsp;keys that (for a single message &lt;i&gt;M&lt;/i&gt;) satisfy&amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;DES(KA', DES(KB', M))&amp;nbsp;= DES(KA, DES(KB, M))&lt;/span&gt;. You can quickly eliminate the bad keys by obtaining the encryption of a second message M' and testing it against each of your candidate matches. The chance that a given false positive will work on two messages is usually quite low.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-7364107077293170451?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/kdcv22iCL8k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/7364107077293170451/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/02/multiple-encryption.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7364107077293170451?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7364107077293170451?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/kdcv22iCL8k/multiple-encryption.html" title="Multiple encryption" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/02/multiple-encryption.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YAQ3s7fCp7ImA9WhRbEUw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6880503101157583829</id><published>2012-01-30T14:56:00.000-08:00</published><updated>2012-02-01T08:52:22.504-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-01T08:52:22.504-08:00</app:edited><title>Bad movie cryptography, 'Swordfish' edition</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://moviecrackhouse.files.wordpress.com/2008/06/swordfish.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="190" src="http://moviecrackhouse.files.wordpress.com/2008/06/swordfish.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Hackers are paler than the general public. Also, they use gel.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
I was just working on an honest-to-god technical post when I thought: here's an idea, let's illustrate this point with a reference to the classic bad-security movie '&lt;i&gt;&lt;a href="http://www.imdb.com/title/tt0244244/"&gt;Swordfish&lt;/a&gt;&lt;/i&gt;'.&amp;nbsp;What a terrible mistake.&lt;br /&gt;
&lt;br /&gt;
In searching for a link I turned up what purports to be Skip Woods' &lt;a href="http://www.imsdb.com/scripts/Swordfish.html"&gt;original shooting script&lt;/a&gt;. And now I'm not going to get any work done until I get this off my chest:&amp;nbsp;&lt;i&gt;holy &amp;amp;#^$*&amp;amp;# crap the cryptography in that movie is way worse than I thought it was.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I know, I know, it's a ten year old movie and it's all been &lt;a href="http://apcmag.com/top-10-worst-movie-tech-moments.htm"&gt;said before&lt;/a&gt;. So many times that it's not even shooting fish in a barrel anymore, it's more like shooting &lt;i&gt;frozen&lt;/i&gt; fish in a barrel.&lt;br /&gt;
&lt;br /&gt;
There isn't much&amp;nbsp;crypto in the movie. But what there is, whew... If you consider a modified&amp;nbsp;&lt;a href="http://www.generationterrorists.com/quotes/dps.html"&gt;Pritchard scale&lt;/a&gt;&amp;nbsp;where the X axis is '&lt;i&gt;refers to a technology that could actually exist&lt;/i&gt;' and the Y axis is '&lt;i&gt;doesn't make me want to stab myself', &lt;/i&gt;Skip Woods has veered substantially into negative territory.&lt;br /&gt;
&lt;br /&gt;
I know most people will say something like '&lt;i&gt;Duh' &lt;/i&gt;or&lt;i&gt;&amp;nbsp;'It's swordfish!' &lt;/i&gt;or&amp;nbsp;&lt;i&gt;'What do you expect from a movie where a guy breaks a password while John Travolta holds a gun to his head &lt;/i&gt;and&lt;i&gt;&amp;nbsp;Halle Berry fiddles around in his lap&lt;/i&gt;.'&lt;i&gt;&amp;nbsp;&lt;/i&gt;And yes, I realize that this happens. But&amp;nbsp;that stuff actually doesn't trouble me so much.&lt;br /&gt;
&lt;br /&gt;
What does bother me is that the DoD system he breaks into uses&amp;nbsp;&lt;i&gt;128-bit RSA encryption&lt;/i&gt;. Does anyone really think that the NSA would validate that? And then there's this exchange (emphasis mine):&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="font-size: 14px;"&gt;&lt;b&gt;                            GABRIEL
&lt;/b&gt;                  Here's the deal. I need a worm,
                  Stanley. A hydra, actually. A
                  multi-headed worm to break an
                  encryption and then sniff out
                  latent digital footprints
                  throughout an encrypted network.

&lt;b&gt;                                STANLEY
&lt;/b&gt;                  What kind of cypher?

&lt;b&gt;                                GABRIEL
&lt;/b&gt;                  &lt;a href="http://en.wikipedia.org/wiki/One-time_pad"&gt;Vernam encryption&lt;/a&gt;.

&lt;b&gt;                                STANLEY
&lt;/b&gt;                  A Vernam's impossible. Its key
                  code is destroyed upon
                  implementation. &lt;i&gt;&lt;u&gt;Not to mention
&lt;/u&gt;                  &lt;u&gt;being a true 128 bit encryption.
&lt;/u&gt;&lt;/i&gt;
&lt;b&gt;                                GABRIEL
&lt;/b&gt;                  &lt;u&gt;&lt;i&gt;Actually, we're talking 512 bit.&lt;/i&gt;&lt;/u&gt;
&lt;/pre&gt;
&lt;pre style="font-size: 14px;"&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="font-family: Times; text-align: -webkit-auto; white-space: normal;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;Ok, I don't know about the stuff at the beginning -- but the rest is serious. We're not going after a mere&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/One-time_pad"&gt;Vernam One-Time Pad&lt;/a&gt;, which would just be impossible to break. Instead we're going after the Big Kahuna, the true 128-bit unbreakable Vernam One-Time Pad. &lt;i&gt;No, wait, that's too easy&lt;/i&gt;. To do this right, we're gonna have to break the full&amp;nbsp;&lt;i&gt;512-bit&lt;/i&gt; unbreakable Vernam One-Time Pad, which is at least &lt;i&gt;2^384 times as unbreakable &lt;/i&gt;as the regular unbreakable kind. &lt;i&gt;G&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;i style="font-family: Arial, Helvetica, sans-serif; text-align: -webkit-auto; white-space: normal;"&gt;et Halle back in here!&lt;/i&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;What kills me is that if you squint a little some of this&lt;/span&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&amp;nbsp;technical jargon kind of makes sense. This can only mean one thing&lt;/span&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;: Skip Woods&lt;/span&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&amp;nbsp;brought in a technical advisor.&lt;/span&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&amp;nbsp;But having done so, he obviously took the advice he was given and let it fly prettily out the windows of his Mercedes on the way home. Then he wrote what he wanted to write. Who needs an unbreakable cipher when we can have an unbreakable cipher with a frickin' &lt;strike&gt;128&lt;/strike&gt; 512 bit key!&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;I thought this post would be cathartic, but the truth is I just feel dirty now. Where will this end? Will I find myself criticizing &lt;a href="http://www.imdb.com/title/tt0120749/"&gt;Mercury Rising&lt;/a&gt; and Star Trek? The thing is, I &lt;i&gt;like&lt;/i&gt;&amp;nbsp;movies, even bad ones. I don't ask for realism. I just have limits.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="text-align: left;"&gt;&lt;span style="text-align: -webkit-auto; white-space: normal;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;And Swordfish is a bridge too far. If you're a Hollywood type and you need someone to vet your scripts, I'll do it. Cheap. I won't leave you all hung up in painful details -- if your plot requirements have the main character breaking cryptography in his head, I'll find a way to make it work. But it won't be a One-Time Pad and it sure as hell won't be 128-bit RSA. It will be *ahem* &lt;i&gt;realistic&lt;/i&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-6880503101157583829?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/3FqAwQQ3_SA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6880503101157583829/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/bad-movie-cryptography-of-week.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6880503101157583829?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6880503101157583829?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/3FqAwQQ3_SA/bad-movie-cryptography-of-week.html" title="Bad movie cryptography, 'Swordfish' edition" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/bad-movie-cryptography-of-week.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YBRXY5eSp7ImA9WhRUFkU.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-7711237448529519385</id><published>2012-01-26T08:01:00.000-08:00</published><updated>2012-01-27T08:19:14.821-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-27T08:19:14.821-08:00</app:edited><title>Tor and the Great Firewall of China</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm7.staticflickr.com/6129/5995126552_7d139911d0_m.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://farm7.staticflickr.com/6129/5995126552_7d139911d0_m.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://www.flickr.com/photos/julielaurent/"&gt;credit&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Here's a fascinating post by Tim Wilde over at the &lt;a href="https://blog.torproject.org/blog/knock-knock-knockin-bridges-doors"&gt;Tor Project blog&lt;/a&gt;, discussing&amp;nbsp;China's growing sophistication in blocking Tor connections:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
In October 2011, ticket #4185 was filed in the Tor bug tracker by a user in China who found that their connections to US-based Tor bridge relays were being regularly cut off after a very short period of time. At the time we performed some basic experimentation and discovered that Chinese IPs (presumably at the behest of the Great Firewall of China, or GFW) would reach out to the US-based bridge and connect to it shortly after the Tor user in China connected, and, if successful, shortly thereafter the connection would be blocked by the GFW.&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
... &lt;b&gt;we discovered two types of probing&lt;/b&gt;. &lt;b&gt;First, "garbage binary" probes, containing nothing more than arbitrary (but sometimes repeated in later probes) binary data&lt;/b&gt;, were experienced by the non-China side of any connection that originated from China to TCP port 443 (HTTPS) in which an SSL negotiation was performed. ... The purpose of these probes is unknown ...&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;The second type of probe, on the other hand, is aimed quite directly at Tor.&lt;/b&gt; When a Tor client within China connected to a US-based bridge relay, we consistently found that at the next round 15 minute interval (HH:00, HH:15, HH:30, HH:45), the bridge relay would receive a probe from hosts within China that not only&lt;b&gt; established a TCP connection, but performed an SSL negotiation, an SSL renegotiation, and then spoke the Tor protocol sufficiently to build a one-hop circuit and send a BEGIN_DIR cell&lt;/b&gt;. No matter what TCP port the bridge was listening on, once a Tor client from China connected, within 3 minutes of the next 15 minute interval we saw a series of probes including at least one connection speaking the Tor protocol.&lt;/blockquote&gt;
Obviously this is disturbing. And unlike &lt;a href="https://blog.torproject.org/blog/update-internet-censorship-iran"&gt;previous, passive efforts to block Tor&lt;/a&gt;, these active attacks are tough to defend against. After all, Tor was designed to be a public service. If the general public can download a Tor client and connect to a bridge, so can the Chinese government. This means that protocol-level workarounds (&lt;a href="https://gitweb.torproject.org/obfsproxy.git/blob/HEAD:/doc/tor-obfs-howto.txt"&gt;obfuscators&lt;/a&gt;, for example) will only work until China cares enough to stop them.&lt;br /&gt;
&lt;br /&gt;
The situation isn't hopeless: proposed workarounds include&amp;nbsp;&lt;a href="https://lists.torproject.org/pipermail/tor-dev/2011-November/003060.html"&gt;password protecting&lt;/a&gt;&amp;nbsp;Tor bridges, which might solve the problem to an extent -- though it seems to me that this is just kicking the problem down the road a bit. As with the bridge security model, it embeds the assumption that Chinese &lt;i&gt;users&lt;/i&gt; can find bridges/passwords, but their government can't. More to the point, any password protocol is going to have to work hard to look 'innocent' (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;not Tor-like)&amp;nbsp;to someone who doesn't know the password. There are a lot of ways this could go wrong.&lt;br /&gt;
&lt;br /&gt;
On the research side there are ideas like&amp;nbsp;&lt;a href="https://telex.cc/"&gt;Telex&lt;/a&gt;&amp;nbsp;which would eliminate the need for bridges by embedding anti-censorship &lt;i&gt;into&lt;/i&gt;&amp;nbsp;the network. Chinese Tor clients would make TLS connections to arbitrary US websites; the connections would be monitored by special Telex routers along the way; any TLS connection with a special&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Steganography"&gt;steganographic&lt;/a&gt; marking would get transparently re-routed to the nearest Tor node. Unfortunately, while the crypto in Telex is great, actually&amp;nbsp;&lt;i&gt;deploying&lt;/i&gt;&amp;nbsp;it would be a nightmare -- and would almost certainly require government cooperation. Even if Western governments were game, the Chinese government could respond by banning overseas TLS connections altogether.&lt;br /&gt;
&lt;br /&gt;
One last note: I love a good mystery, so does anyone care to speculate about those "garbage probes"? What are they -- a test? Automated fuzzing? Most likely they're an attempt to provoke a response from some other TLS server that the Chinese government cares about, but if it's not Tor then what is it?&lt;br /&gt;
&lt;br /&gt;
Tim's full investigation can be found &lt;a href="https://gist.github.com/da3c7a9af01d74cd7de7"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update 1/26: &lt;/b&gt;Emily Stark points me to the&amp;nbsp;&lt;a href="http://crypto.stanford.edu/flashproxy/"&gt;Flash Proxies&lt;/a&gt;&amp;nbsp;project out of Stanford. This would put&amp;nbsp;Tor proxies in individual client machines, thus massively increasing the number of bridges available and eliminating the outgoing client-&amp;gt;bridge connection. They even have an implementation, though I warn you: running untrusted traffic through your Flash plugin is not for the faint of heart!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-7711237448529519385?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/Up1yWuBeLAg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/7711237448529519385/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/tor-and-great-firewall-of-china.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7711237448529519385?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/7711237448529519385?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/Up1yWuBeLAg/tor-and-great-firewall-of-china.html" title="Tor and the Great Firewall of China" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/tor-and-great-firewall-of-china.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUBQH46eip7ImA9WhRUE04.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2391279358163046632</id><published>2012-01-22T11:10:00.000-08:00</published><updated>2012-01-23T07:57:31.012-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-23T07:57:31.012-08:00</app:edited><title>In memoriam: Tim Hartnell</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://pics.librarything.com/picsizes/1b/f1/1bf14ba540c1d1c5936666c5677434d414f4541.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://pics.librarything.com/picsizes/1b/f1/1bf14ba540c1d1c5936666c5677434d414f4541.jpg" width="132" /&gt;&lt;/a&gt;&lt;/div&gt;
Last week the students and I went looking for our long-lost&amp;nbsp;&lt;a href="http://gnuradio.org/redmine/projects/gnuradio/wiki/USRP"&gt;GnuRadio USRP&lt;/a&gt;&amp;nbsp;in a dusty hardware security lab down the hall. This particular USRP hasn't been seen in about five years (I suspect it may have been deported with the lab's previous occupant) so the whole thing was kind of a long shot.&lt;br /&gt;
&lt;br /&gt;
Sometimes best part of a treasure hunt is what you find along the way.&amp;nbsp;The students didn't find the USRP, but they &lt;i&gt;did &lt;/i&gt;uncover&amp;nbsp;a fog machine and laser that someone had tucked under a workbench. This kept them happy 'til we got a whiff of the "fog" it was making. I scored something even better:&amp;nbsp;a mint copy of &lt;a href="http://en.wikipedia.org/wiki/Tim_Hartnell"&gt;Tim Hartnell&lt;/a&gt;'s 1985 masterpiece, the&amp;nbsp;&lt;i&gt;Giant Book of Computer Games&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
If you're just a few years younger than me, you might think&amp;nbsp;&lt;i&gt;Games &lt;/i&gt;is a book&amp;nbsp;&lt;i&gt;about &lt;/i&gt;games&lt;i&gt;. &lt;/i&gt;But of course, it literally &lt;i&gt;is&lt;/i&gt; games:&amp;nbsp;dozens of all-caps BASIC listings, printed in a font that was probably old when&amp;nbsp;&lt;a href="http://www.imdb.com/title/tt0086567/"&gt;Wargames&lt;/a&gt;&amp;nbsp;was new. Each game sits there on the page, pregnant with potential, waiting for a bored 9-year old to tap it into his C64 or Apple ][ and hit "RUN". It could be long wait.&lt;br /&gt;
&lt;br /&gt;
Flipping through&amp;nbsp;&lt;i&gt;Games&lt;/i&gt;&amp;nbsp;brings back memories. The Chess AI was a bastard, routinely cheating&amp;nbsp;&lt;i&gt;even if&lt;/i&gt;&amp;nbsp;you implemented it properly. And you&amp;nbsp;&lt;i&gt;never&lt;/i&gt; implemented anything properly, at least not on the first pass. This was part of the fun. Between typos and the fact that Hartnell apparently coded to his own BASIC standard, the first play usually went like this:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;WELCOME TO SNARK HUNT&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;ENTER 1 FOR SNARK, 2 FOR HUNTER&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;gt; 2&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;YOU CHOSE SNARK&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;?SYNTAX ERROR AT LINE 3980&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;READY&lt;/span&gt;&lt;/blockquote&gt;
You learned debugging&amp;nbsp;&lt;i&gt;fast&lt;/i&gt;. When that didn't work, your last, desperate move was simply to&amp;nbsp;&lt;i&gt;delete&lt;/i&gt;&amp;nbsp;the offending lines -- 'til the program either &lt;i&gt;(a)&lt;/i&gt;&amp;nbsp;worked, or &lt;i&gt;(b) &lt;/i&gt;got so crazy that you deleted it and loaded Bruce Lee off a cassette. Sometimes you hit the sweet spot between the two: my "Chess" AI would grab control of &lt;i&gt;my&lt;/i&gt;&amp;nbsp;pieces &lt;a href="http://en.wikipedia.org/wiki/Agent_Smith"&gt;Agent Smith&lt;/a&gt;-style and send them hurtling towards my undefended King. I never saw this as a bug, though; I just thought it had &lt;i&gt;style&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
When I started writing this post I intended to make a broader&amp;nbsp;point about how my experience with &lt;i&gt;Games&lt;/i&gt;&amp;nbsp;mirrors the way that &lt;i&gt;modern&lt;/i&gt;&amp;nbsp;implementers feel when faced with a mysterious, unjustified cryptographic standard. I think there is a point to be made here, and I'll make it. Another day.&lt;br /&gt;
&lt;br /&gt;
But when I googled to see what Hartnell is up to, I was saddened to learn that he died all the way back in 1991, only a few years after &lt;i&gt;Games&lt;/i&gt;&amp;nbsp;was published. He was only a few years older than I am today. So on reflection, I think I'll just let this post stand as it is, and I'll go spend some&amp;nbsp;time with &lt;i&gt;my&lt;/i&gt;&amp;nbsp;kid.&lt;br /&gt;
&lt;br /&gt;
Tim, wherever you are, please accept this belated tribute. Your book meant a lot to me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-2391279358163046632?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/9w9sODqfNME" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2391279358163046632/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/in-memorium-tim-hartnell.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2391279358163046632?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2391279358163046632?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/9w9sODqfNME/in-memorium-tim-hartnell.html" title="In memoriam: Tim Hartnell" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/in-memorium-tim-hartnell.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMCRHs5fyp7ImA9WhRUFUQ.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-8889073607441463224</id><published>2012-01-15T19:20:00.000-08:00</published><updated>2012-01-26T09:21:05.527-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-26T09:21:05.527-08:00</app:edited><title>EAX', Knight Rider, and an admission of defeat</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-qCFKC11N5ac/TxN__mEUY1I/AAAAAAAAAII/CQX9gpGeGtY/s1600/djbtweet.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="180" src="http://1.bp.blogspot.com/-qCFKC11N5ac/TxN__mEUY1I/AAAAAAAAAII/CQX9gpGeGtY/s200/djbtweet.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
A few weeks back I found myself on the wrong side of&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Daniel_J._Bernstein"&gt;Daniel Bernstein&lt;/a&gt;&amp;nbsp;over something I'd tweeted the week before.&lt;i&gt;&amp;nbsp;&lt;/i&gt;This was pretty surprising, since my original tweet hadn't seemed all that controversial.&lt;br /&gt;
&lt;br /&gt;
What I'd said was that&amp;nbsp;&lt;i&gt;cryptographic standards&lt;/i&gt;&amp;nbsp;aren't always perfect, but &lt;i&gt;non-standard&lt;/i&gt; crypto is almost always worse.&amp;nbsp;Daniel politely pointed out that I was nuts -- plenty of bad stuff appears in standards, and conversely, plenty of good stuff &lt;i&gt;isn't&lt;/i&gt;&amp;nbsp;standardized. (As you can see, the conversation got a little weirder after that.)&lt;br /&gt;
&lt;br /&gt;
Today I'm here to say that I've found religion. Not only do I see where Daniel's coming from, I'm here to surrender, throw down my hat and concede defeat.&amp;nbsp;Daniel: you win.&amp;nbsp;I still think standards are preferable&amp;nbsp;&lt;i&gt;in theory,&lt;/i&gt;&amp;nbsp;but only if they're promulgated by reasonable standards bodies.&amp;nbsp;And we seem to have a shortage of those.&lt;br /&gt;
&lt;br /&gt;
My new convictions are apropos of an&amp;nbsp;&lt;a href="http://eprint.iacr.org/2012/018.pdf"&gt;innocuous-looking ePrint&lt;/a&gt;&amp;nbsp;just posted by&amp;nbsp;Kazuhiko Minematsu,&amp;nbsp;Hiraku Morita&amp;nbsp;and Tetsu Iwata.&amp;nbsp;These researchers have found serious&amp;nbsp;flaws in an&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/AEAD_block_cipher_modes_of_operation"&gt;authenticated block cipher mode of operation&lt;/a&gt;&amp;nbsp;called&amp;nbsp;&lt;a href="http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/eax-prime/eax-prime-spec.pdf"&gt;EAX'&lt;/a&gt; (henceforth: EAX&lt;i&gt;prime&lt;/i&gt;). EAXprime was recently adopted as the encryption mode for ANSI's&amp;nbsp;&lt;a href="http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+C12.22-2008"&gt;Smart Grid standard&lt;/a&gt;, and (until today) was practically a shoo-in to become a standalone&amp;nbsp;&lt;a href="http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html#05"&gt;NIST&lt;/a&gt;-certified mode of operation.&lt;br /&gt;
&lt;br /&gt;
Ok, so standards get broken. Why I am I making such a big deal about &lt;i&gt;this&lt;/i&gt;&amp;nbsp;one? The simple reason is that&amp;nbsp;EAXprime isn't just another standard. It's a slightly-modified version of &lt;a href="http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf"&gt;EAX mode&lt;/a&gt;, which was proposed by Bellare, Rogaway and Wagner. And the important thing to know about EAX (&lt;i&gt;non&lt;/i&gt;-prime) is that it comes with a formal &lt;i&gt;proof of security.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
It's hard to explain how wonderful this is. The existence of such a proof means that (within limits) a vulnerability in EAX mode would indicate a problem with the underlying cipher (&lt;i&gt;e.g., &lt;/i&gt;AES) itself. Since we're pretty confident in the security of our standard block ciphers, we can extend that confidence to EAX.&amp;nbsp;And the best part: this wonderful guarantee costs us almost nothing -- EAX is a &lt;i&gt;very&lt;/i&gt; efficient mode of operation.&lt;br /&gt;
&lt;br /&gt;
But not efficient enough for ANSI, which decided to standardize on a variant called EAX&lt;i&gt;prime&lt;/i&gt;. EAXprime &lt;i&gt;is&lt;/i&gt;&amp;nbsp;faster: it uses&amp;nbsp;3-5 fewer block cipher calls to encrypt each message, and (in the case of AES) about 40 bytes less RAM to store scheduled keys. (This is presumably important when your target is a tiny little embedded chip in a &lt;a href="http://en.wikipedia.org/wiki/Smart_meter"&gt;smart meter&lt;/a&gt;.)&lt;br /&gt;
&lt;br /&gt;
Unfortunately, there's a cost to that extra speed: EAX&lt;i&gt;prime&lt;/i&gt;&amp;nbsp;is no longer covered by the original EAX security proof.&amp;nbsp;Which brings us towards the moral of the story, and to the&amp;nbsp;&lt;a href="http://eprint.iacr.org/2012/018.pdf"&gt;Minematsu, Morita and Iwata paper&lt;/a&gt;.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;a href="http://www.popularmechanics.com/cm/popularmechanics/images/jQ/kitt-315-b-1207.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="133" src="http://www.popularmechanics.com/cm/popularmechanics/images/jQ/kitt-315-b-1207.jpg" width="200" /&gt;&lt;/a&gt;Did you ever see that old&amp;nbsp;&lt;a href="http://www.imdb.com/title/tt0620846/plotsummary"&gt;episode of Knight Rider&lt;/a&gt;&amp;nbsp;where the bad guys figure out how to neutralize&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/KITT"&gt;KITT&lt;/a&gt;'s bulletproof coating? Reading this paper&amp;nbsp;is kind of like watching the middle part of that episode. Everything pretty much looks the same but&amp;nbsp;&lt;i&gt;holy crap WTF the bullets aren't bouncing off anymore&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
The MMI attacks allow an adversary to create ciphertexts (aka forgeries) that seem valid even though they weren't created by the actual encryptor. They're very powerful in that sense, but they're limited in others (they only work against very short messages).&amp;nbsp;Still, at the end of the day, they're&lt;i&gt; attacks&lt;/i&gt;. Attacks that couldn't possibly exist if the standards designers had placed a high value on EAX's security proof, and had tried to maintain that security in their optimized standard.&lt;br /&gt;
&lt;br /&gt;
And this is why I'm admitting defeat on this whole standards thing. How can I advocate for crypto standards when standards bodies will casually throw away something as wonderful as a security proof? At least when KITT lost his bulletproof coating it was because of something &lt;i&gt;the bad guys&lt;/i&gt;&amp;nbsp;did to him. Can you imagine the &lt;i&gt;good guys&lt;/i&gt; doing that to him on purpose?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-8889073607441463224?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/THMjhYjowEk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/8889073607441463224/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/eax-provable-security-knight-rider-and.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8889073607441463224?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8889073607441463224?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/THMjhYjowEk/eax-provable-security-knight-rider-and.html" title="EAX', Knight Rider, and an admission of defeat" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-qCFKC11N5ac/TxN__mEUY1I/AAAAAAAAAII/CQX9gpGeGtY/s72-c/djbtweet.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/eax-provable-security-knight-rider-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcHQ3o9eCp7ImA9WhRVFEw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-4890267941603219350</id><published>2012-01-12T08:13:00.000-08:00</published><updated>2012-01-12T17:10:32.460-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-12T17:10:32.460-08:00</app:edited><title>Useful cryptography resources</title><content type="html">Over the past few weeks I've been scouring the Internet for a good list of crypto and security resources to link to from this blog. The ideal list would include technical blogs, of course, but also textbooks, courses and other helpful websites.&lt;br /&gt;
&lt;br /&gt;
There are a few good resource lists out on the web. Some are even pretty good, but none of them meet all of my criteria. Per&amp;nbsp;&lt;a href="http://xkcd.com/927/"&gt;XKCD&lt;/a&gt;, I decided that the solution here is to obviate them all and create&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/p/useful-cryptography-resources.html"&gt;an even better list of my own&lt;/a&gt;&lt;i&gt;.&amp;nbsp;&lt;/i&gt;You can see my first draft&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/p/useful-cryptography-resources.html"&gt;here&lt;/a&gt; (it's also linked from the sidebar at right, under '&lt;a href="http://blog.cryptographyengineering.com/p/useful-cryptography-resources.html"&gt;Useful crypto resources&lt;/a&gt;').&amp;nbsp;This is very much a work in progress, and I hope that you'll all help me to flesh it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-4890267941603219350?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/OfUZHw7VNnU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/4890267941603219350/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/useful-cryptography-resources.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4890267941603219350?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/4890267941603219350?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/OfUZHw7VNnU/useful-cryptography-resources.html" title="Useful cryptography resources" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/useful-cryptography-resources.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8DQnYzfCp7ImA9WhRaEk8.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-121719072422207965</id><published>2012-01-09T17:11:00.000-08:00</published><updated>2012-02-14T05:07:53.884-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-14T05:07:53.884-08:00</app:edited><title>Attack of the week: Datagram TLS</title><content type="html">&lt;div style="text-align: right;"&gt;
&lt;a href="http://socialanxietygroup.files.wordpress.com/2011/07/shark-attack-copy.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="141" src="http://socialanxietygroup.files.wordpress.com/2011/07/shark-attack-copy.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Nadhem Alfardan&amp;nbsp;and&amp;nbsp;&lt;a href="http://www.isg.rhul.ac.uk/~kp/"&gt;Kenny Paterson&lt;/a&gt; have a paper set to appear in &lt;a href="http://www.isoc.org/isoc/conferences/ndss/12/"&gt;NDSS 2012&lt;/a&gt; entitled '&lt;a href="http://www.isg.rhul.ac.uk/~kp/dtls.pdf"&gt;Plaintext-Recovery Attacks Against Datagram TLS&lt;/a&gt;'.* This is obviously music to my ears. Plaintext recovery! Datagram TLS! Padding oracles. Oh my.&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There's just one problem: &lt;strike&gt;the paper doesn't seem to be online yet&lt;/strike&gt;&amp;nbsp;(&lt;b&gt;Update 1/10:&lt;/b&gt;&amp;nbsp;&lt;i&gt;It &lt;a href="http://www.isg.rhul.ac.uk/~kp/dtls.pdf"&gt;is now&lt;/a&gt;.&amp;nbsp;See my update further below&lt;/i&gt;.)&amp;nbsp;Infoworld has a few&amp;nbsp;&lt;a href="http://www.infoworld.com/d/security/six-security-vulnerabilities-addressed-in-openssl-183396"&gt;vague details&lt;/a&gt;, and&amp;nbsp;it looks like the&amp;nbsp;&lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2011-4108"&gt;vulnerability fixes&lt;/a&gt; are coming fast and furious. So let's put on our thinking caps and try to puzzle this one out.&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;What &lt;i&gt;is&lt;/i&gt; Datagram TLS?&lt;/b&gt;&lt;/blockquote&gt;
If you're reading this blog, I assume you know&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt;&amp;nbsp;is the go-to protocol for encrypting data over the Internet. Most people associate TLS with&amp;nbsp;&lt;i&gt;reliable&lt;/i&gt;&amp;nbsp;transport mechanisms such as TCP.&amp;nbsp;But TCP isn't the only game in town.&lt;br /&gt;
&lt;br /&gt;
Audio/video streaming, gaming, and &lt;a href="http://en.wikipedia.org/wiki/Skype_protocol#UDP"&gt;VoIP&lt;/a&gt;&amp;nbsp;apps often use unreliable &lt;i&gt;datagram&lt;/i&gt;&amp;nbsp;transports like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol"&gt;UDP&lt;/a&gt;. These applications don't care if packets arrive out of order, or if they don't arrive at all. The biggest priority is quickly handling the packets that &lt;i&gt;do&lt;/i&gt;&amp;nbsp;arrive.&lt;br /&gt;
&lt;br /&gt;
Since these applications need security too, TLS tries to handle them via an extension called &lt;a href="http://tools.ietf.org/html/rfc4347"&gt;Datagram TLS&lt;/a&gt; (DTLS). DTLS addresses the two big limitations that make TLS hard to use on an unreliable datagram transport:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_handshake_in_detail"&gt;TLS handshake&lt;/a&gt; messages need to arrive&amp;nbsp;&lt;i&gt;whole&lt;/i&gt;&amp;nbsp;and &lt;i&gt;in the right order. &lt;/i&gt;This is easy when you're using TCP, but doesn't work so well with unreliable datagram transport. Moreover, these messages are&amp;nbsp;bigger than the typical 1500 byte Ethernet frame, which means fragmentation (at best), and packet loss (at worst).&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Ordinarily TLS decryption&lt;i&gt;&amp;nbsp;&lt;/i&gt;assumes that you've received all the previous data.&amp;nbsp;But&amp;nbsp;datagrams&amp;nbsp;arrive when they want to -- that means you need the ability to decrypt a packet even if you haven't received its predecessor.&lt;/li&gt;
&lt;/ol&gt;
There are various ways to deal with these problems;&amp;nbsp;&lt;a href="http://tools.ietf.org/html/rfc4347"&gt;DTLS&lt;/a&gt;&amp;nbsp;mounts a frontal assault.&amp;nbsp;The handshake is made reliable by implementing a custom ack/re-transmit framework. A protocol-level fragmentation mechanism is added to break large handshake messages up over multiple datagrams. And most importantly: the approach to encrypting records is slightly modified.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;So what's the problem?&lt;/b&gt;&lt;/blockquote&gt;
To avoid radical changes, DTLS inherits most of the features of TLS. That includes its wonky (and obsolete) &lt;a href="http://cseweb.ucsd.edu/~mihir/papers/oem.html"&gt;MAC-then-Encrypt&lt;/a&gt; approach to protecting data records. Encryption involves three steps:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Append a &lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;MAC&lt;/a&gt; to the plaintext to prevent tampering.&lt;/li&gt;
&lt;li&gt;Pad the resulting message to a multiple of the cipher block size (16 bytes for AES). This is done by appending &lt;i&gt;X&amp;nbsp;&lt;/i&gt;bytes of padding, where each byte must contain the value &lt;i&gt;X.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Encrypt the whole mess using &lt;a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29"&gt;CBC mode&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Cryptographers have long known that this kind of encryption can admit&amp;nbsp;&lt;a href="http://www.iacr.org/cryptodb/archive/2002/EUROCRYPT/2850/2850.pdf"&gt;padding oracle attacks&lt;/a&gt;&lt;i&gt;. &lt;/i&gt;This happens when a decryptor does something obvious (throw an error, for example) when it encounters &lt;i&gt;invalid&lt;/i&gt; &lt;i&gt;padding, &lt;/i&gt;i.e., padding&amp;nbsp;that doesn't meet the specification above.&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/d/d3/Cbc_encryption.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="129" src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Cbc_encryption.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;CBC Mode encryption, courtesy Wikipedia.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
This wouldn't matter very much, except that CBC mode is &lt;i&gt;malleable. &lt;/i&gt;This&amp;nbsp;means an attacker can flip bits in an intercepted ciphertext, which will cause the &lt;i&gt;same&lt;/i&gt;&amp;nbsp;bits to be flipped when the ciphertext is ultimately decrypted. Padding oracle attacks work by carefully tweaking a ciphertext in specific ways before sending it to an honest decryptor. If the the decryptor returns a padding error, then the adversary knows something about the underlying plaintext. Given enough time the attacker can use these errors to completely decrypt the message.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I could spend a lot of time describing padding oracle attacks, but it's mostly beside the point.** Standard TLS implementations know about this attack and deal with it in a pretty effective way.&amp;nbsp;Whenever the decryptor encounters bad padding, it just&amp;nbsp;&lt;i&gt;pretends that it hasn't. &lt;/i&gt;Instead, it goes ahead with the rest of the decryption procedure (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;checking the MAC) even if it knows that the message is already borked.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This is extra work, but it's extra work with a purpose. If a decryptor doesn't perform the extra steps, then messages with bad padding will get rejected considerably faster than other messages. A clever attacker can detect this condition by carefully timing the responses. Performing the unnecessary steps (mostly) neutralizes that threat.&lt;/div&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;Ok, so you say these attacks are already mitigated. Why are we still talking about this?&lt;/b&gt;&lt;/blockquote&gt;
&lt;div&gt;
Before I go on, I offer one caveat: what I know about this attack comes from speculation, code diffs and some funny shapes I saw in the clouds this afternoon. I &lt;i&gt;think&lt;/i&gt;&amp;nbsp;what I'm saying is legit, but I won't swear to it until I read&amp;nbsp;Alfardan and Paterson's&amp;nbsp;paper.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
But taking my best guess, there are two problems here. One is related to the DTLS spec, and the second is just an implementation problem. Either one alone probably wouldn't be an issue; the two together spell big trouble.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The first issue is in the way that the DTLS spec deals with invalid records.&amp;nbsp;Since standard TLS works over a reliable connection, the application should never receive invalid or out-of-order data except&amp;nbsp;when packets are being &lt;i&gt;deliberately&lt;/i&gt; tampered with. So when standard TLS encounters a bad record MAC (or padding) it takes things very seriously -- in fact, it's required to &lt;i&gt;drop the connection&lt;/i&gt;.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This necessitates a new handshake, a new key, and generally makes it hard for attackers to run an honest padding oracle attack, since these attacks typically require hundreds or thousands of decryption attempts on a single key.***&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
DTLS, on the other hand, runs over an &lt;i&gt;unreliable&lt;/i&gt;&amp;nbsp;datagram transport, which may not correct for accidental packet errors. Dropping the connection for every corrupted packet just isn't an option. Thus, the standard is relaxed. An invalid MAC (or padding) will cause &lt;i&gt;a single record&lt;/i&gt;&amp;nbsp;to be thrown away, but the connection itself goes on.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This still wouldn't matter much if it wasn't for the second problem, which is specific to the implementation of DTLS in libraries like &lt;a href="http://openssl.org/"&gt;OpenSSL&lt;/a&gt;&amp;nbsp;and GnuTLS.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You see, padding oracle vulnerabilities in standard TLS are understood and mitigated. In OpenSSL, for example, the main decryption code has been carefully vetted. It&amp;nbsp;&lt;i&gt;does not&lt;/i&gt;&amp;nbsp;return specific padding errors, and to avoid timing attacks it performs the same (unnecessary) operations whether or not the padding checks out.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In a perfect world DTLS decryption would do all the same things. But&amp;nbsp;DTLS encryption is subtly different from standard TLS encryption, which means it's implemented in separate code. Code that isn't used frequently, and doesn't receive the same level of scrutiny as the main TLS code. Thus -- two nearly identical implementations, subject to the same attacks, with one secure and one not. (&lt;b&gt;Update 1/11:&amp;nbsp;&lt;/b&gt;&lt;i&gt;There's a decent explanation for this, see my update below&lt;/i&gt;.)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
And if you're the kind of person who needs this all tied up with a bow, I would point you to this small chunk of the&amp;nbsp;&lt;a href="http://cvs.openssl.org/chngview?cn=21942"&gt;diff&lt;/a&gt;&amp;nbsp;just released for the latest OpenSSL fix. It comes from the DTLS-specific file d1_pkt.c:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;+&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;/* To minimize information leaked via timing, we will always&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* perform all computations before discarding the message.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;+&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;decryption_failed_or_bad_record_mac = 1;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I guess that confirms the OpenSSL vulnerability.&amp;nbsp;Presumably with these fixes in place, the MAC-then-Encrypt usage in DTLS will now go back to being, well, just &lt;a href="http://cseweb.ucsd.edu/~mihir/papers/oem.html"&gt;theoretically insecure&lt;/a&gt;. But not actively so.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;b&gt;Update 1/11/2012: &lt;/b&gt;Kenny Paterson has kindly sent me a link to the &lt;a href="http://www.isg.rhul.ac.uk/~kp/dtls.pdf"&gt;paper&lt;/a&gt;, which wasn't available when I wrote the original post. And it turns out that while the &lt;i&gt;vulnerability&lt;/i&gt; is along the lines above, the attack is much more interesting.&lt;br /&gt;
&lt;br /&gt;
An important aspect that I'd missed is that DTLS &lt;i&gt;does not&lt;/i&gt;&amp;nbsp;return error messages when it encounters invalid padding -- it just silently drops the packet. This helps to explain the lack of countermeasures in the DTLS code, since the lack of responses would seem to be a padding oracle attack killer.&lt;br /&gt;
&lt;br /&gt;
Alfardan and Paterson show that this isn't the case.&amp;nbsp;They're able to get the same information by timing the arrival of 'heartbeat' messages (or any predictable responses sent by an upper-level protocol). Since DTLS decryption gums up the works, it can slightly delay the arrival of these packets. By measuring this 'gumming' they can determine whether padding errors have ocurred. Even better, they can&amp;nbsp;&lt;i&gt;amplify&lt;/i&gt;&amp;nbsp;this gumming by sending 'trains' of valid or invalid packets.&lt;br /&gt;
&lt;br /&gt;
All in all, a very clever attack. So clever, in fact, that it makes me&amp;nbsp;despair that we'll ever&amp;nbsp;have truly secure systems. I guess I'll have to be satisfied with one less&amp;nbsp;&lt;i&gt;insecure&lt;/i&gt;&amp;nbsp;one.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;br /&gt;
*&amp;nbsp;N.J.A. Alfardan and K.G. Paterson, &lt;i&gt;Plaintext-Recovery Attacks Against Datagram TLS&lt;/i&gt;, To appear in NDSS 2012.&lt;br /&gt;
&lt;br /&gt;
** See &lt;a href="http://www.limited-entropy.com/padding-oracle-attacks"&gt;here&lt;/a&gt;&amp;nbsp;for one explanation. See also &lt;a href="http://blog.cryptographyengineering.com/2011/10/attack-of-week-xml-encryption.html"&gt;a post from this blog&lt;/a&gt; describing a padding oracle attack on XML encryption.&lt;br /&gt;
&lt;br /&gt;
*** There is one &lt;a href="http://lasecwww.epfl.ch/memo/memo_ssl.shtml"&gt;very challenging padding oracle&lt;/a&gt; attack on standard TLS (also mitigated by current implementations). This deals with the problem of session drops/renegotiation by attacking &lt;i&gt;data &lt;/i&gt;that remains constant across sessions -- things like passwords or cookies.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-121719072422207965?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/Tbb1oo8c9GI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/121719072422207965/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/attack-of-week-datagram-tls.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/121719072422207965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/121719072422207965?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/Tbb1oo8c9GI/attack-of-week-datagram-tls.html" title="Attack of the week: Datagram TLS" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/attack-of-week-datagram-tls.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcBQXs5fSp7ImA9WhRVEUw.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5679357933803510202</id><published>2012-01-02T11:16:00.000-08:00</published><updated>2012-01-09T05:50:50.525-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-09T05:50:50.525-08:00</app:edited><title>A very casual introduction to Fully Homomorphic Encryption</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm7.staticflickr.com/6037/6286593673_efe9f98df8.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="212" src="http://farm7.staticflickr.com/6037/6286593673_efe9f98df8.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Craig Gentry on board the mothership. (&lt;a href="http://www.flickr.com/photos/gregpc/"&gt;credit&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
A couple of weeks ago I polled readers for the subjects that they were interested in. You gave me some excellent responses, and I promise they're all in the hopper.&lt;br /&gt;
&lt;br /&gt;
By far the most popular request&amp;nbsp;was for some background on the recent results in&amp;nbsp;&lt;i&gt;computing on encrypted data&lt;/i&gt;, or 'Fully-Homomorphic Encryption'. Even though the current techniques are still in the research phase --&amp;nbsp;&lt;i&gt;way&lt;/i&gt; outside the domain of the 'practical' crypto I usually talk about -- this topic is so neat that it deserves a few words.&lt;br /&gt;
&lt;br /&gt;
Before I get started, I want to make a few important stipulations. First, I'm hardly the world's leading expert on the subject. Moreover, plenty of &lt;i&gt;real&lt;/i&gt; experts have already published highly accessible introductory pieces. If you're interested, you should check out Craig Gentry's &lt;a href="http://crypto.stanford.edu/craig/easy-fhe.pdf"&gt;fantastic intro paper&lt;/a&gt;, or even his (surprisingly readable) &lt;a href="http://crypto.stanford.edu/craig/"&gt;PhD thesis&lt;/a&gt;. Alternatively, you can go directly to some of the &lt;a href="http://eprint.iacr.org/2009/616"&gt;recent&lt;/a&gt; &lt;a href="http://eprint.iacr.org/2011/277"&gt;papers&lt;/a&gt; on FHE.&lt;br /&gt;
&lt;br /&gt;
My last warning is that this subject is kind of involved. I'm going to do my best to keep this explanation relatively non-technical (see the papers above if you want the gory details), but it could still get fairly &lt;i&gt;long&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
In this first post I'm going to cover some of the background behind FHE, and explain why it's such a neat problem.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Why encryption is &lt;i&gt;not&lt;/i&gt; like a safe&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm3.staticflickr.com/2355/2514314499_b9329e26a7.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="150" src="http://farm3.staticflickr.com/2355/2514314499_b9329e26a7.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://www.flickr.com/photos/beatneck/"&gt;credit&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
People love to use analogies to talk about encryption. Sometimes these are helpful, sometimes they're just limiting. Consider this one:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
Encrypting a document is like&amp;nbsp;&lt;i&gt;placing it inside of a locked safe.&lt;/i&gt;&lt;/blockquote&gt;
The locked safe is a great teaching example because cryptography and physical safes (usually) serve the same purpose: they ensure the &lt;i&gt;confidentiality&lt;/i&gt; of sensitive data. In practice, they also share many of the same drawbacks.&lt;br /&gt;
&lt;br /&gt;
If you've ever worked in an environment where safe-storage is required (e.g., a bank or intelligence agency) you probably know what I'm talking about. Once&amp;nbsp;you lock a document into a safe,&amp;nbsp;&lt;i&gt;your&amp;nbsp;document is&lt;/i&gt;&lt;i&gt;&amp;nbsp;locked inside of a damn safe&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Consequently, people tend to remove useful documents from safe storage at the first chance they get. This exposes them to all the usual threats, and explains why&amp;nbsp;so few cases of document theft involve safecracking. Typically the same principle holds for encryption. People decrypt their data so they can use it.&lt;br /&gt;
&lt;br /&gt;
But analogies are never perfect.&amp;nbsp;Encrypting a document &lt;i&gt;isn't&lt;/i&gt;&amp;nbsp;the same as putting it into a physical lockbox. And this is a good thing! Because in fact, there &lt;i&gt;is&lt;/i&gt;&amp;nbsp;a kind of encryption that allows us to bypass some of these limitations. We refer to this as&amp;nbsp;&lt;i&gt;homomorphic encryption&lt;/i&gt;&lt;i&gt;, &lt;/i&gt;and its defining characteristic is this: you can perform useful operations on encrypted values without&lt;i&gt; &lt;/i&gt;decrypting them first.&lt;br /&gt;
&lt;br /&gt;
This may seem like an exotic property. Trust me, it's not. In fact, cryptographers have put a lot of effort into &lt;i&gt;removing&lt;/i&gt;&amp;nbsp;the homomorphic properties from common public-key schemes like &lt;a href="http://en.wikipedia.org/wiki/ElGamal_encryption"&gt;Elgamal&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/RSA_(algorithm)"&gt;RSA&lt;/a&gt;. Without those protections, both schemes are homomorphic with respect to (modular) multiplication. This means you can multiply together any two Elgamal ciphertexts, and upon decryption you'll find that the (single) resulting ciphertext now embeds the &lt;i&gt;product&lt;/i&gt;&amp;nbsp;of the two original plaintexts. Neat!&lt;br /&gt;
&lt;br /&gt;
Homomorphic encryption has some immediate practical applications. Consider the &lt;a href="http://en.wikipedia.org/wiki/Paillier_cryptosystem"&gt;Paillier&lt;/a&gt; scheme that's used in several electronic&amp;nbsp;&lt;a href="http://www.usenix.org/event/evt08/tech/full_papers/xia/xia.pdf"&gt;voting&lt;/a&gt;&amp;nbsp;protocols. Paillier is homomorphic with respect to &lt;i&gt;addition&lt;/i&gt;.&amp;nbsp;Now imagine: each voter encrypts their their ballot as a number (0 or 1) and publishes it to the world. Anyone can now tally up the results into a final ciphertext, which makes it hard for a corrupt election judge to throw away legitimate votes&lt;i&gt;. &lt;/i&gt;Decrypting the&amp;nbsp;final ciphertext reveals only the total.*&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;A few bits of history&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Homomorphic encryption is hardly a new discovery, and cryptographers have long been aware of its promise. Way back in 1978 (about five seconds after the publication of&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/RSA_(algorithm)"&gt;RSA&lt;/a&gt;),&amp;nbsp;Rivest, Adleman and Dertouzos &lt;a href="http://people.csail.mit.edu/rivest/RivestAdlemanDertouzos-OnDataBanksAndPrivacyHomomorphisms.pdf"&gt;proposed&lt;/a&gt;&amp;nbsp;homomorphic encryption schemes that supported interesting functions on encrypted data.&amp;nbsp;Regrettably, those first attempts kind of sucked.** Thus, the agenda for researchers was twofold: &lt;i&gt;(1)&lt;/i&gt; come up with &lt;i&gt;secure&lt;/i&gt;&amp;nbsp;encryption schemes that could handle useful homomorphisms, and &lt;i&gt;(2) &lt;/i&gt;figure out how to do interesting things with them.&lt;br /&gt;
&lt;br /&gt;
To be &lt;i&gt;interesting, a &lt;/i&gt;homomorphic encryption scheme should at very least permit the evaluation of useful mathematical functions, &lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;polynomials. But no computer scientist in history has ever been satisfied with mere polynomials.&amp;nbsp;The holy grail was something much neater: a scheme that could handle&amp;nbsp;&lt;i&gt;arbitrary computations&lt;/i&gt;&amp;nbsp;-- embodied as real computer programs! --&amp;nbsp;on securely encrypted inputs.&lt;br /&gt;
&lt;br /&gt;
This idea -- sometimes called '&lt;i&gt;cryptocomputing'&lt;/i&gt;, or '&lt;i&gt;computing on encrypted data&lt;/i&gt;' -- has a way of capturing the imagination. There's something fascinating about a computer that works on data it can't see.&amp;nbsp;More practically, a technology like this would eliminate a very real weakness in many security systems -- the need to decrypt before processing data. It could even spawn a whole business&amp;nbsp;based on&amp;nbsp;&lt;i&gt;outsourcing&lt;/i&gt;&amp;nbsp;your computations to outside parties. (Something you obviously&amp;nbsp;&lt;a href="http://aws.amazon.com/ec2/"&gt;wouldn't do&lt;/a&gt; without strong cryptographic protections.)&lt;br /&gt;
&lt;br /&gt;
Anyway, it was a beautiful dream. There was just one problem: it didn't work.&lt;br /&gt;
&lt;br /&gt;
To explain why, let's go back to some of the encryption schemes I mentioned above. Throughout the '80s and '90s researchers came up with these, and many more interesting schemes. Quite a few&amp;nbsp;supported some kind of homomorphism, usually multiplication &lt;i&gt;or &lt;/i&gt;addition.&amp;nbsp;However, none seemed capable of handling even&amp;nbsp;&lt;i&gt;both&lt;/i&gt; operations&amp;nbsp;simultaneously -- at least not without serious limitations.&lt;br /&gt;
&lt;br /&gt;
For researchers this was frustrating. Coming up with such a 'doubly homomorphic' scheme was an obvious first step towards the higher purpose.&amp;nbsp;Even better, they quickly realized, this 'first step' was also the &lt;i&gt;last step&lt;/i&gt; they'd need to achieve arbitrary computation.&lt;br /&gt;
&lt;br /&gt;
How's that? Well, imagine that you have a doubly homomorphic encryption scheme that encrypts&amp;nbsp;&lt;i&gt;bits, &lt;/i&gt;meaning that every plaintext is either 0 or 1. Given ciphertexts encrypting bits A and B, we could use this scheme to compute the simple function 1+A*B. Keeping in mind that all arithmetic is binary (&lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Modular_arithmetic"&gt;modulo&lt;/a&gt; 2), such a function would produce the following&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Truth_table"&gt;truth table&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;A B : 1+A*B&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 0 &amp;nbsp; 1&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 1 &amp;nbsp; 1&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 0 &amp;nbsp; 1&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; text-align: center;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 1 &amp;nbsp; 0&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Why the excitement? Well, this table describes a&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/NAND_gate"&gt;NAND gate&lt;/a&gt;.&amp;nbsp;And any computer engineer can tell you that NAND is a big deal: once you've got it, you can derive all of the other useful&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Logic_gate#Logic_gates"&gt;boolean logic gates&lt;/a&gt;:&amp;nbsp;AND, OR, NOT, XOR and XNOR.*** And that means you can implement &lt;i&gt;circuits.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
To a theoretical computer scientist this is a Big Deal. Given an encryption scheme like this, we could encrypt our&amp;nbsp;input one &lt;i&gt;bit&lt;/i&gt; at a time, then send the encrypted values to a third party for processing. This party would run an&amp;nbsp;&lt;i&gt;arbitrary&lt;/i&gt; program just by rendering it into a huge circuit&lt;i&gt; --&lt;/i&gt;&amp;nbsp;a series of connected boolean logic gates -- and evaluating the result one gate at a time. At the end of the process we'd get back a bunch of ciphertexts containing the (bit) results.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
In theory, the existence of an appropriate encryption scheme would give us everything we need to, for example, play &lt;a href="http://halo.xbox.com/en-us/?"&gt;Halo&lt;/a&gt; on encrypted inputs. This would obviously be a poor gaming experience. But it would be &lt;i&gt;possible&lt;/i&gt;.&amp;nbsp;If only we had&amp;nbsp;such an encryption scheme.&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;
&lt;b&gt;A brief note&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
At this point I'd like to take a quick break to address the more practical kind of reader, who (I suspect) is recoiling in horror.&amp;nbsp;I know what you're thinking:&amp;nbsp;&lt;i&gt;I came here for computing&lt;/i&gt;, &lt;i&gt;and this is what you're giving me?&amp;nbsp;Break the input into &lt;/i&gt;single bits &lt;i&gt;and process them one gate at a time?&lt;/i&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;
Well, yes. That's exactly how it's going to work -- at least, if we want&amp;nbsp;&lt;i&gt;general&lt;/i&gt; computation.&amp;nbsp;And I stipulate that in many ways it's going to suck. Consider, for example, a loop like this one:&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;while (encrypted_value &amp;lt; 100) {&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;&amp;nbsp;perform_some_operation_on(&amp;amp;encrypted_value);&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"&gt;}&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
Just try converting that into a circuit. I mean, it's not impossible to unroll loops (if you know the maximum number of iterations), but the resulting circuit is not likely to be practical.&amp;nbsp;Moreover, this isn't purely an issue with the use of circuits, but rather with the use of encrypted data. No matter what computational model you employ, you're always going to have difficulty with things like&amp;nbsp;control flow&amp;nbsp;changes that depend on input data that the executing party can't see.&lt;br /&gt;
&lt;br /&gt;
This makes it tough to implement the efficient programs that we're accustomed to running on typical random access machines. Simply writing a bit to encrypted 'RAM' might require you to recalculate&amp;nbsp;&lt;i&gt;every&lt;/i&gt; bit in memory, at least, if the write location is dependent on the input data.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
And no, I'm not going to reassure you that it gets better from here. Actually it's going to get a lot worse once cryptography comes into the picture. That's because each of these 'bits' is actually going to become a ciphertext -- potentially hundreds or thousands of bits in length. Not to mention that evaluating those logic gates is going to require some pretty serious computing.&lt;br /&gt;
&lt;br /&gt;
I'm pointing this out not to dismiss the research&amp;nbsp;-- which we'll get to, and is pretty amazing -- but rather, to point out that it &lt;i&gt;is&lt;/i&gt;&amp;nbsp;research. We aren't going to be outsourcing general programs with this anytime soon -- and in fact, we may never do so. What we &lt;i&gt;might&lt;/i&gt;&amp;nbsp;do is find ways to implement specialized subroutines with very high sensitivity requirements: &lt;i&gt;e.g.,&lt;/i&gt;&amp;nbsp;stock trading models, proprietary bioinformatics processes, etc. By combining these with other less-general techniques, we could accomplish something pretty useful.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In Summary&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I've written just about all I can fit in a reasonable blog post, and I realize that I've barely covered any of the actual research.&lt;br /&gt;
&lt;br /&gt;
What I did accomplish was to&amp;nbsp;lay out some of the &lt;i&gt;background&lt;/i&gt; behind the recent developments in fully-homomorphic encryption. In the next post we'll talk about the search for an appropriate encryption scheme, some of the failures, and Gentry's eventual success.&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
* Obviously there's more to this. See, for example, &lt;a href="http://www.usenix.org/event/evt08/tech/full_papers/xia/xia.pdf"&gt;this paper&lt;/a&gt; for some of the complexity.&lt;br /&gt;
&lt;br /&gt;
** This might sound insulting, but it's not. As I've said before, 'suck' is a purely technical term for schemes that aren't &lt;a href="http://en.wikipedia.org/wiki/Semantic_security"&gt;semantically secure&lt;/a&gt;, &lt;i&gt;i.e.,&lt;/i&gt;&amp;nbsp;indistinguishable under chosen plaintext attack.&lt;br /&gt;
&lt;br /&gt;
*** Two notes here: First, you can obviously derive these gates more directly. For example, AND is (A*B). Second, while I've used the example of a scheme that encrypts only bits (meaning that addition and multiplication are always mod 2), the encryption scheme doesn't &lt;i&gt;have&lt;/i&gt; to be limited this way. For example, consider a scheme that encrypts arbitrary integers (say, a finite &lt;a href="http://en.wikipedia.org/wiki/Ring_(mathematics)"&gt;ring&lt;/a&gt;). As long as you know that the &lt;i&gt;inputs&lt;/i&gt; (A, B) are both in {0, 1}, you can implement the NAND gate as 1-(A*B). This is a more common description and you'll see it in most papers on the subject.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-5679357933803510202?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/vO-zLUOsobk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5679357933803510202/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/very-casual-introduction-to-fully.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5679357933803510202?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5679357933803510202?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/vO-zLUOsobk/very-casual-introduction-to-fully.html" title="A very casual introduction to Fully Homomorphic Encryption" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/very-casual-introduction-to-fully.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQEQn09fyp7ImA9WhRWFUs.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-309692090103034597</id><published>2012-01-01T22:10:00.000-08:00</published><updated>2012-01-02T20:01:43.367-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-02T20:01:43.367-08:00</app:edited><title>OpenSSL and NSS are FIPS 140 certified. Is the Internet safe now?</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://csrc.nist.gov/groups/STM/cmvp/documents/CMVP2002/index_files/cmvplogo.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="75" src="http://csrc.nist.gov/groups/STM/cmvp/documents/CMVP2002/index_files/cmvplogo.gif" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
People like standards. The more important something is, the greater the&amp;nbsp;likelihood&amp;nbsp;that someone, somewhere has drawn up a standard for how it should be done. Although this can get out of hand (viz: the EU&amp;nbsp;&lt;a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:31988R1677:EN:HTML"&gt;standard for cucumbers&lt;/a&gt;), I do think that standards can serve a useful purpose. This is particularly true when you're talking about something as complicated (and easy to screw up) as &lt;i&gt;encrypting data on the Internet&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Given all this, you'd expect that I'd be excited, nay &lt;i&gt;thrilled,&lt;/i&gt;&amp;nbsp;that two of the major crypto libraries in use today -- &lt;a href="http://openssl.org/"&gt;OpenSSL&lt;/a&gt; and Mozilla's &lt;a href="http://www.mozilla.org/projects/security/pki/nss/"&gt;NSS&lt;/a&gt; -- offer a FIPS-approved mode. Our children can sleep safely at night! And yet, having spent part of the weekend poring over nightmarish NSS code, I feel obliged to offer the following opinion: FIPS compliance, while certainly not a &lt;i&gt;bad&lt;/i&gt; thing, doesn't really have anything to do with the &lt;i&gt;security&lt;/i&gt;&amp;nbsp;of a cryptographic library. Certainly not a library like&amp;nbsp;OpenSSL or NSS.&lt;br /&gt;
&lt;br /&gt;
For those who have no clue what FIPS is, let me start from the beginning.&lt;br /&gt;
&lt;br /&gt;
If there's one organization that &lt;i&gt;really &lt;/i&gt;likes standards, it's the US Federal government. For IT alone the US has an entire fleet of standards known collectively as FIPS -- the &lt;a href="http://itl.nist.gov/fipspubs/"&gt;Federal Information Processing Standards&lt;/a&gt;. These deal with lots of boring stuff like the&amp;nbsp;&lt;a href="http://www.itl.nist.gov/fipspubs/fip5-2.htm"&gt;standard codes to be used when referencing US states&lt;/a&gt;. More interestingly, FIPS also includes the standards for designing&amp;nbsp;&lt;i&gt;cryptographic modules. &lt;/i&gt;These are laid out in a series of documents headlined by &lt;a href="http://csrc.nist.gov/publications/fips/fips140-2/fips1402.pdf"&gt;FIPS 140-2&lt;/a&gt;&amp;nbsp;(obligatory warning: do not drive or operate heavy machinery while reading FIPS publications).&lt;br /&gt;
&lt;br /&gt;
FIPS 140-2 outlines a set of requirements that must be adhered to by any US-government certified cryptographic module. This applies to products purchased by Federal agencies, and implicitly to outside systems that exchange sensitive-but-unclassified data with Federal computers (think: banks). To give these standards some teeth, the US &lt;a href="http://www.nist.gov/index.html"&gt;NIST&lt;/a&gt; and Canada's &lt;a href="http://www.cse-cst.gc.ca/index-eng.html"&gt;CSEC&lt;/a&gt; jointly run something called the &lt;a href="http://csrc.nist.gov/groups/STM/cmvp/index.html"&gt;Cryptographic Module Validation Program&lt;/a&gt; (CMVP). Only serious cryptographic modules survive CMVP, at least in theory. So NSS and OpenSSL's validation is a Big Deal.&lt;br /&gt;
&lt;br /&gt;
Like I said, that's the theory.&lt;br /&gt;
&lt;br /&gt;
To understand why I'm not so excited about FIPS, you have to understand the &lt;i&gt;what, who &lt;/i&gt;and &lt;i&gt;why.&lt;/i&gt;&amp;nbsp;Specifically,&amp;nbsp;&lt;i&gt;what&lt;/i&gt; the heck a 'cryptographic module' is,&amp;nbsp;&lt;i&gt;who&lt;/i&gt; does the validation, and&amp;nbsp;&lt;i&gt;why&lt;/i&gt;&amp;nbsp;we're validating these modules in the first place.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is a cryptographic module?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://www.cryptomuseum.com/crypto/philips/spendex10/img/301333/096/full.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="142" src="http://www.cryptomuseum.com/crypto/philips/spendex10/img/301333/096/full.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;A 1970s-era hardware voice encryption&lt;br /&gt;
module.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
To understand the FIPS viewpoint on this, you need to hark back to the early 90s when the FIPS 140-1 standard was first being hashed out. You also need to pretend that you worked for the US DoD in the previous decades. At this point you should have a very clear picture of a cryptographic module in your head. It looks something like the picture on the right.&lt;br /&gt;
&lt;br /&gt;
Ok, so that's a Dutch voice encryption module, and it dates from 1973. The point I'm trying to make is that &lt;i&gt;a cryptographic module is a piece of hardware&lt;/i&gt;. It's contained within some kind of metal enclosure. Plaintext data comes in on a physical port, encrypted data comes out of another. Keys are entered by punching them into the front, or alternatively, by inserting some kind of key storage token.&lt;br /&gt;
&lt;br /&gt;
In fact, to achieve "FIPS 140 Level 2" (or higher) certification, you still need hardware. But what does FIPS 140-2 tell us about&amp;nbsp;evaluating pure&amp;nbsp;&lt;i&gt;software&lt;/i&gt;&amp;nbsp;cryptographic modules? How do we map these hardware rules onto something like OpenSSL?&lt;br /&gt;
&lt;br /&gt;
Mostly by doing a lot of creative re-interpretation. Module boundaries have to become &lt;i&gt;machine&lt;/i&gt;&amp;nbsp;boundaries. Logical boundaries have to be defined around the software itself. The flow of data across these boundaries has to be relentlessly mapped into a hardware metaphor, &lt;i&gt;even if using that metaphor&lt;/i&gt;&amp;nbsp;&lt;i&gt;doesn't provide any tangible security benefit&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
(To give a concrete example: FIPS key management at higher levels requires entering&amp;nbsp;only encrypted keys. Neat. But if the module is a piece of software, what's the point? You might find yourself encrypting keys on one machine, so that they can be decrypted in another process on the same machine. This is silly. But if that's how NIST will interpret the standard, then that's what we'll do.)&lt;br /&gt;
&lt;br /&gt;
In fairness, a new iteration of the standard --&amp;nbsp;&lt;a href="http://csrc.nist.gov/groups/ST/FIPS140_3/"&gt;FIPS 140-3&lt;/a&gt;&amp;nbsp;--&amp;nbsp;is supposed to make validation of software modules a whole lot clearer. Unfortunately the finalization date is currently listed as TBD. Moreover, when it comes to government standards, sometimes you're better off with the devil you know.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Who does the validation?&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Here's another thing about CMVP to keep in mind. It's not a free service offered by the US government to those modules it finds really important.&lt;br /&gt;
&lt;br /&gt;
Yes, final approval of modules is performed by a team at NIST. However, this is only the tip of the iceberg. In order to reach NIST, you need to first retain a private &lt;a href="http://csrc.nist.gov/groups/STM/testing_labs/index.html"&gt;testing laboratory&lt;/a&gt;, who will actually do most of the validation. NIST mostly evaluates the results of this process. You have a choice of labs, and yes, they compete on price. I've had the good fortune of working with excellent testing labs, but that doesn't mean that my results are typical.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Why (and what) are we validating?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we get to the most important question: &lt;i&gt;why&lt;/i&gt; are you evaluating the module. Actually, this is more of a what question -- what does the evaluation look for, what kind of bugs is it going to turn up, and how much assurance do you really have at the end of the process.&lt;br /&gt;
&lt;br /&gt;
And this is the depressing part. FIPS is not about detailed software evaluation. It's not code review, at least not the kind of rigorous code review that will find the inevitable (and devastating) software vulnerabilities that your development team missed. It's certainly not going to detect subtle cryptographic attacks that stem from bad use of padding or the presence of useful timing channels. And it's&amp;nbsp;&lt;i&gt;definitely&lt;/i&gt; not going to detect clever backdoors.&lt;br /&gt;
&lt;br /&gt;
What it &lt;i&gt;is&lt;/i&gt;&amp;nbsp;going to tell you is whether you have a solid checklist describing how the system should be used. It'll tell whether you're using some sort of authentication to launch the module. It'll ensure that you're using only FIPS-approved algorithms, and only in a way that's specified by NIST. Finally, validation will tell you whether you're implementing those algorithms correctly -- or more accurately, whether your outputs&amp;nbsp;&lt;i&gt;match a set of test vectors &lt;/i&gt;provided by your testing lab, which is mostly, but not entirely the same thing.&lt;br /&gt;
&lt;br /&gt;
These are all good things, and they probably serve to lop off the low-hanging fruit -- the genuinely dumb bugs that lead to obvious compromise. (As a side benefit, FIPS prohibits the use of &lt;a href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html"&gt;RC4&lt;/a&gt;.) Moreover, the process of getting through CMVP is so time-consuming that it probably increases the likelihood that your engineers will find bugs in the code along the way. This is a good thing, but it's hardly a &lt;i&gt;first order&lt;/i&gt;&amp;nbsp;effect.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So what does this have to do with NSS and OpenSSL?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Good question. What &lt;i&gt;are&lt;/i&gt; the problems in these libraries, and how is FIPS supposed to solve them?&lt;br /&gt;
&lt;br /&gt;
The big problem that I see with both NSS and OpenSSL is not that they use bad algorithms, or that they have bad security policies. Rather, it's that their code is &lt;i&gt;uncommented&lt;/i&gt; and hard to read, which occasionally hides serious (but extremely subtle) vulnerabilities.&lt;i&gt;&amp;nbsp;&lt;/i&gt;Moreover, even when the implementation is faithful, they each support legacy standards that contain a lot of questionable nonsense (e.g., obsolete padding schemes) which needs to be hacked around.&amp;nbsp;The above issues would be academic, except that to a surprising extent these two libraries are responsible for securing the Internet.&lt;br /&gt;
&lt;br /&gt;
Even more problematic is that between OpenSSL and NSS we have&amp;nbsp;&lt;i&gt;two&lt;/i&gt;&amp;nbsp;separate and competing libraries, in a world with enough interested brains and eyeballs to review at most one. Optimistically.&lt;br /&gt;
&lt;br /&gt;
This is how NSS managed to stay vulnerable to the &lt;a href="http://www.net-security.org/article.php?id=1638"&gt;BEAST attack&lt;/a&gt; until this year, despite the fact that OpenSSL had '&lt;a href="http://www.openssl.org/~bodo/tls-cbc.txt"&gt;empty fragment&lt;/a&gt;' mitigations in place since 2002. Similarly, it's how OpenSSL managed &lt;a href="http://www.openssl.org/news/vulnerabilities.html"&gt;all of this&lt;/a&gt;. It's why OpenSSL code often&amp;nbsp;&lt;a href="http://www.peereboom.us/assl/assl/html/openssl.html"&gt;looks like this&lt;/a&gt;, and why NSS is no better.&lt;br /&gt;
&lt;br /&gt;
Unfortunately the problems that FIPS evaluation solves are mostly&amp;nbsp;orthogonal&amp;nbsp;to these.&lt;br /&gt;
&lt;br /&gt;
Now, to be fair, nobody in either the OpenSSL project or Mozilla is claiming that FIPS compliance makes these libraries magically secure. I'm sure they not only know better, but they curse FIPS privately behind closed doors because it requires a whole lot of extra code in exchange for a dubious security benefit. Moreover, both libraries are developed by smart people &lt;i&gt;and&lt;/i&gt;&amp;nbsp;have done fairly well considering what they're up against.&lt;br /&gt;
&lt;br /&gt;
Still, there's a huge need for a &lt;i&gt;real&lt;/i&gt;&amp;nbsp;security standard for cryptographic modules, one that takes into account all of the things we know can go wrong. At very least we could&amp;nbsp;&lt;i&gt;mandate&lt;/i&gt;&amp;nbsp;a coding standard with requirements for commenting, indentation, sensible error handling, and variable names that aren't plain crazy. (Even if a single review doesn't find the bugs, mandating a coding standard could increase the probability that &lt;i&gt;others&lt;/i&gt;&amp;nbsp;do.)&lt;br /&gt;
&lt;br /&gt;
The whole point of this post is to remind readers that FIPS 140-2&lt;i&gt;&amp;nbsp;&lt;/i&gt;is &lt;i&gt;not&lt;/i&gt;&amp;nbsp;that standard. Encrypt with caution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-309692090103034597?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/p-T2oDqYC8o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/309692090103034597/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2012/01/openssl-and-nss-are-fips-140-certified.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/309692090103034597?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/309692090103034597?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/p-T2oDqYC8o/openssl-and-nss-are-fips-140-certified.html" title="OpenSSL and NSS are FIPS 140 certified. Is the Internet safe now?" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2012/01/openssl-and-nss-are-fips-140-certified.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8FSHo8eCp7ImA9WhRUFk8.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-181856815249514402</id><published>2011-12-28T21:37:00.000-08:00</published><updated>2012-01-26T16:06:59.470-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-26T16:06:59.470-08:00</app:edited><title>2011 Redux</title><content type="html">&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://farm6.staticflickr.com/5006/5268766463_ba00744c60.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="125" src="http://farm6.staticflickr.com/5006/5268766463_ba00744c60.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://www.flickr.com/photos/iuniquefx/"&gt;credit&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
I started this blog just a few months ago, and it's been something of a learning experience. Someday maybe I'll talk about that, but not in this post. What I'm here to talk about is regret -- regret that&amp;nbsp;there are so many things I missed&amp;nbsp;the opportunity to blog about in 2011.&lt;br /&gt;
&lt;br /&gt;
Since I'm finally done traveling and the alternative is to actually be &lt;i&gt;productive&lt;/i&gt;, I thought this might be a good opportunity to make up for some of that lost blogging ground. Hence this post: my attempt to sum up what's happened&amp;nbsp;in &lt;i&gt;practical&amp;nbsp;&lt;/i&gt;cryptography in 2011.&lt;br /&gt;
&lt;br /&gt;
Before anyone objects, I'm going to clarify the ground rules. This list is naturally incomplete, and moreover, I'm going to take '&lt;i&gt;practical&lt;/i&gt;' seriously. That rules out reduced-round attacks (on anything); improvements in Fully-Homomorphic Encryption (getting&amp;nbsp;&lt;a href="http://eprint.iacr.org/2011/277"&gt;faster&lt;/a&gt;!); and any paper with 'composable' in the title. I will cover implementation and usability issues. But I don't really plan to take any of my own rules that seriously. If you think I missed something important -- and I will -- please feel free to follow up in comments.&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://i259.photobucket.com/albums/hh284/CTone03/Guns%20in%20movies/Resident%20Evil/BaconWrappedCujos.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="107" src="http://i259.photobucket.com/albums/hh284/CTone03/Guns%20in%20movies/Resident%20Evil/BaconWrappedCujos.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Phishers don't mess with the&lt;br /&gt;
imaginary SecurID key&amp;nbsp;storage facility.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;SecurID not so secure after all.&lt;/b&gt;&amp;nbsp;RSA's SecurID has become practically synonymous with two-factor authentication. And it's not a bad system. Back in 2010 if you'd asked me about the most likely avenue for a compromise, I would have guessed &lt;i&gt;(a)&lt;/i&gt;&amp;nbsp;theft of secrets from a local SecurID server, or &lt;i&gt;(b) &lt;/i&gt;some kind of bug in the authentication software.&lt;br /&gt;&lt;br /&gt;What I &lt;i&gt;wouldn't&lt;/i&gt;&amp;nbsp;have guessed was &lt;i&gt;(c)&lt;/i&gt;&amp;nbsp;&lt;a href="http://money.cnn.com/2011/06/08/technology/securid_hack/index.htm"&gt;compromise of RSA's master seed data&lt;/a&gt;.&amp;nbsp;Obviously &lt;i&gt;that&lt;/i&gt; wasn't going to happen --&amp;nbsp;given the sensitivity of this information,&amp;nbsp;RSA naturally took good care of it. Remember the underground research facility in&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Resident_Evil_(film)"&gt;Resident Evil&lt;/a&gt;? My vision of the RSA master seed storage facility was kind of like that, only without the&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Red_Queen_and_White_Queen#Red_Queen_and_White_Queen"&gt;friendly computer&lt;/a&gt;&amp;nbsp;or &lt;a href="http://collider.com/wp-content/uploads/resident-evil-afterlife-movie-image-milla-jovovich-12.jpg"&gt;Milla Jovovich&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In retrospect this seems a bit naive, but really: SecurID was everywhere. Even &lt;i&gt;military contractors&lt;/i&gt; used it. If local banks had learned to store their secrets in hardware security modules, then certainly RSA would take modest precautions with something as important as their master seed database.&lt;br /&gt;&lt;br /&gt;What 2011 taught us is that just because you think something will be done a certain way, it won't necessarily be so. Perhaps 2012 will be different.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Still more attacks on AES. &lt;/b&gt;I promised to keep this to the &lt;i&gt;practical, &lt;/i&gt;and the &lt;a href="http://research.microsoft.com/en-us/projects/cryptanalysis/aesbc.pdf"&gt;latest attacks&lt;/a&gt; against AES certainly aren't. The best of them still only shave a couple of bits off of the security of an AES key (although the new attacks &lt;i&gt;don't&lt;/i&gt;&amp;nbsp;depend on related keys).&lt;br /&gt;&lt;br /&gt;Still, AES is such an important cipher that any reduction in its security margin is going to have some kind of practical impact. The question now is what lies down the road: &lt;i&gt;(a) &lt;/i&gt;an improved AES beefed up with additional rounds, &lt;i&gt;(b)&lt;/i&gt; a new standards competition, &lt;i&gt;(c) &lt;/i&gt;apathy,&amp;nbsp;or &lt;i&gt;(d)&lt;/i&gt; something even weirder. Maybe 2012 will put us on a path to finding that answer.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;D-Wave actually builds a quantum computer. &lt;/b&gt;With two caveats: it's not really a computer, and it may or may not be quantum.&lt;br /&gt;&lt;br /&gt;In case you've never heard of &lt;a href="http://www.dwavesys.com/en/dw_homepage.html"&gt;D-Wave&lt;/a&gt;, they're a private company that purports to sell the first working &lt;a href="http://en.wikipedia.org/wiki/Adiabatic_quantum_computation"&gt;adiabatic quantum computer&lt;/a&gt;, complete with "128 pair-wise coupled superconducting flux qubits". If you're not sure what to make of this, you're not the only one. Thanks to D-Wave's NDA-heavy business model, there's been &lt;a href="http://www.scottaaronson.com/blog/?p=431"&gt;some doubt in learned quarters&lt;/a&gt; as to whether the D-Wave device actually performs useful &lt;i&gt;quantum&lt;/i&gt; computation at all.&lt;br /&gt;&lt;br /&gt;But D-Wave has an active and respectable research department. Just this past May they published an &lt;a href="http://www.nature.com/nature/journal/v473/n7346/full/nature10012.html"&gt;article in Nature&lt;/a&gt;&amp;nbsp;demonstrating &lt;a href="http://dwave.wordpress.com/2011/05/11/catching-quantum-mechanics-in-the-act%E2%80%A6/"&gt;apparent quantum tunneling&lt;/a&gt; amongst eight qubits. This is a far cry from the 128 qubits claimed in their commercial products, it doesn't demonstrate entanglement, and of course, it doesn't result in computation. Still it's not nothing. So does this mean practical implementations of &lt;a href="http://en.wikipedia.org/wiki/Shor's_algorithm"&gt;Shor's algorithm&lt;/a&gt; are just around corner? &lt;a href="http://www.forbes.com/sites/alexknapp/2011/05/24/q-and-a-with-prof-scott-aaronson-on-d-waves-quantum-computer/"&gt;Probably not.&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;TLS falls to the BEAST.&amp;nbsp;&lt;/b&gt;This fall Thai Duong and Juliano Rizzo raised the pulse of the security industry by demonstrating the most exciting &lt;a href="http://www.theregister.co.uk/2011/09/23/google_ssl_not_vulnerable_to_beast/"&gt;practical attack&lt;/a&gt; against &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;SSL/TLS&lt;/a&gt; in years. This attack is dear to my heart because it's one of the first attacks I &lt;a href="http://blog.cryptographyengineering.com/2011/09/brief-diversion-beast-attack-on-tlsssl.html"&gt;wrote about on this blog&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;BEAST is based on a five year-old &lt;a href="http://eprint.iacr.org/2006/136"&gt;academic attack&lt;/a&gt; on a &lt;i&gt;twelve&amp;nbsp;year old&lt;/i&gt;&amp;nbsp;&lt;a href="http://www.ietf.org/rfc/rfc2246.txt"&gt;standard&lt;/a&gt;. Now there's a bit more to the attack that Rizzo/Duong implemented, but still --- how in the world does such a thing stay in the wild so long? A colleague describes Rizzo/Duong's research strategy as 'working their way through the Eurocrypt archives, actually &lt;i&gt;exploiting&lt;/i&gt;&amp;nbsp;the theoretical vulnerabilities that academics couldn't be bothered to follow through on'. If this sounds dismissive, it wasn't -- he only wished that&amp;nbsp;he'd done it first.&lt;br /&gt;&lt;br /&gt;Lesson: there's a hell of a gap between academic crypto and 'the real world'. We're only safe as long as you believe in attackers who are sophisticated enough to spear-phish SecurID, but not bright enough to read a crypto paper. Time will tell if that belief is a good one.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Nothing much happens with hash functions. &lt;/b&gt;Well, that's a bit unfair. Things &lt;i&gt;did&lt;/i&gt;&amp;nbsp;happen, and there are some papers to show for it. The SHA3 finalists, announced late last year, continued to percolate through the system. (Go BLAKE!)&amp;nbsp;Still, 2011 was a huge disappointment for those of &lt;strike&gt;us&lt;/strike&gt; you who thought that it would be the year of SHA1 collisions. I guess there's always 2012.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Unsigned code running on iOS.&amp;nbsp;&lt;/b&gt;Many cryptographers would exclude this from a list of 'crypto' happenings. Still, a theme of this blog is that your crypto doesn't matter if&amp;nbsp;your &lt;i&gt;implementation&lt;/i&gt; undermines it.&lt;br /&gt;&lt;br /&gt;This is exactly what Charlie Miller&amp;nbsp;&lt;a href="http://www.theregister.co.uk/2011/11/10/apple_iphone_security_bug/"&gt;demonstrated&lt;/a&gt; when he showed how to execute malicious application code on an iPhone. Even though iOS devices are only supposed to run signed code, it turns out that a few bad checks created a tiny section of memory in which these requirements were irrelevant. To thank him, Apple created a &lt;a href="http://www.zdnet.com/blog/security/after-latest-iphone-hack-charlie-miller-kicked-out-of-ios-dev-program/9773"&gt;tiny section of their developer program&lt;/a&gt;&amp;nbsp;in which Charlie Miller is irrelevant.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Certificate Authorities still a giant mess. &lt;/b&gt;Some will say I'm exaggerating -- there were only a few major hacks this year, notably Dutch CA &lt;a href="http://en.wikipedia.org/wiki/DigiNotar"&gt;DigiNotar&lt;/a&gt;, and a smaller CA called&amp;nbsp;&lt;a href="http://translate.google.com/translate?sl=auto&amp;amp;tl=en&amp;amp;js=n&amp;amp;prev=_t&amp;amp;hl=en&amp;amp;ie=UTF-8&amp;amp;layout=2&amp;amp;eotf=1&amp;amp;u=http%3A%2F%2Fwebwereld.nl%2Fnieuws%2F108815%2Fweer-certificatenleverancier-overheid-gehackt.html&amp;amp;act=url"&gt;Gemnet&lt;/a&gt;. But don't forget, Microsoft also revoked&amp;nbsp;&lt;a href="http://www.livehacking.com/2011/11/07/microsoft-to-revoke-trust-in-malaysian-ca/"&gt;Digicert Malaysia &lt;/a&gt;-- not because they were hacked, but for using 512-bit RSA keys to sign certificates (!!) And this is only a partial list of the problems&amp;nbsp;&lt;i&gt;we know about. &lt;/i&gt;All in all, it was not a good year to be a CA.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Secure police radios not all that secure.&lt;/b&gt;&amp;nbsp;&lt;a href="http://www.apco911.org/frequency/project25.php"&gt;APCO Project 25&lt;/a&gt; is a digital radio standard used by law enforcement. Naturally it supports encryption -- a valuable tool when you're discussing a confidential source or razzing those Occupy protestors. And the P25 encryption itself isn't half bad (it's unauthenticated AES). Rather, the problem with P25 is that simply &lt;i&gt;&lt;a href="http://www.crypto.com/papers/p25sec.pdf"&gt;getting encryption turned on&lt;/a&gt; &lt;/i&gt;is a daunting prospect -- to the point where it often doesn't happen&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;To illustrate the problem, a&amp;nbsp;&lt;a href="http://www.crypto.com/papers/p25sec.pdf"&gt;team from UPenn&lt;/a&gt; spent two years snarfing up confidential traffic. The agents generating most of this traffic either &lt;i&gt;thought&lt;/i&gt;&amp;nbsp;it was encrypted, or&amp;nbsp;&lt;i&gt;would&amp;nbsp;have&lt;/i&gt;&amp;nbsp;encrypted it if only they could've figured out how to set the keys. Still more evidence that &lt;i&gt;usability&lt;/i&gt; is every bit as important as crypto, implementation, or any other issue that we come across in our field.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;XML Encryption nearly as awful as XML itself. &lt;/b&gt;This fall brought news of a &lt;a href="http://blog.cryptographyengineering.com/2011/10/attack-of-week-xml-encryption.html"&gt;clever attack&lt;/a&gt; on the unauthenticated W3C XML Encryption standard. The attack, by researchers&amp;nbsp;Tibor Jager and Juraj Somorovsky, used various features of XML encoding to implement what I would call a 'padding oracle attack-plus-plus' -- which completely decrypts protected XML on Axis2 and JBoss systems. &lt;br /&gt;&lt;br /&gt;The &lt;a href="http://www.w3.org/QA/2011/10/some_notes_on_the_recent_xml_e.html"&gt;W3C response&lt;/a&gt;: "We are so sorry for promulgating this terrible standard and recommend that you never, ever listen to anything we say regarding security every again." No, of course I'm just kidding. Actually, they're adding &lt;a href="http://en.wikipedia.org/wiki/Galois/Counter_Mode"&gt;AES-GCM&lt;/a&gt; as an option. Should take care of everything.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Quantum key distribution still a work in progress. &lt;/b&gt;Quantum Key Distribution (QKD), sometimes known as 'quantum crypto' is a promising technique for distributing keys over geographic distances without the need to rely on &lt;i&gt;complicated stuff&lt;/i&gt;&amp;nbsp;like hard mathematical problems. Instead, you just need to run direct fiber-optic cables to the person you want to communicate with (much easier). On the bright side, the security of QKD is supposedly based on fundamental quantum-physical properties.&lt;br /&gt;&lt;br /&gt;In general, the caveat in any QKD design is that security only holds &lt;i&gt;if the physical device works as expected&lt;/i&gt;. This year researchers&amp;nbsp;from Singapore and Norway showed that this is a big assumption: by exploiting certain limitations of existing detector equipment, they were able to &lt;a href="http://www.nature.com/ncomms/journal/v2/n6/full/ncomms1348.html"&gt;extract an entire secret key&lt;/a&gt; without anyone being the wiser. None of these attacks are fundamental 'breaks' of QKD, and indeed&amp;nbsp;&lt;a href="http://www.physorg.com/news/2011-06-quantum-cryptography.html"&gt;they've already been mitigated&lt;/a&gt;. But it goes to show how you should never trust a system just because someone tells you it's 'theoretically unbreakable'.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
And that's 2011. I'm sure I'm missing tons of important stuff -- and that's what comments are for. Please enjoy the rest of your holidays and be safe in the new year.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-181856815249514402?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/ctUl3LFrh0s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/181856815249514402/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/2011-redux.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/181856815249514402?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/181856815249514402?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/ctUl3LFrh0s/2011-redux.html" title="2011 Redux" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/2011-redux.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ASHk6eyp7ImA9WhRXGE8.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-1727185376212344825</id><published>2011-12-23T23:19:00.000-08:00</published><updated>2011-12-25T07:44:09.713-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-25T07:44:09.713-08:00</app:edited><title>What's TLS Snap Start?</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.defeatdiabetes.org/resource/dynamic/global/food_-_snap-peas.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="150" src="http://www.defeatdiabetes.org/resource/dynamic/global/food_-_snap-peas.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Google is promoting a new TLS extension&amp;nbsp;which is designed to speed up the negotiation of TLS handshakes. The extension is called&amp;nbsp;called&amp;nbsp;&lt;a href="http://tools.ietf.org/html/draft-agl-tls-snapstart-00"&gt;Snap Start&lt;/a&gt;, and it's&amp;nbsp;already been deployed in Chrome (and presumably throughout Google's back end.)&lt;br /&gt;
&lt;br /&gt;
So what is Snap Start, why is it different/better than simply resuming a TLS session, and most importantly: how snappy is it?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Background: The TLS Handshake&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To understand Snap Start we need to quickly review the TLS handshake. Snap Start only supports the classic (non-ephemeral) handshake protocol, so that's what we'll be talking about here. Leaving out a lot of detail, that handshake can be reduced to the following four messages:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;C -&amp;gt; S: Client sends a random nonce &lt;b&gt;CR&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;C &amp;lt;- S: Server responds with its public key (certificate) and another nonce &lt;b&gt;SR&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;C -&amp;gt; S: Client generates a pre-master secret&amp;nbsp;&lt;b&gt;PMS&lt;/b&gt;, encrypts it with the server's public key and sends the ciphertext to the server.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;C &amp;lt;- S: The client and server both derive a 'master secret' by hashing* together (&lt;b&gt;CR, SR, PMS&lt;/b&gt;). The server and client also MAC all previous handshake messages to make sure nothing's been tampered with. Finally the server notifies the client that it's ready to communicate.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
I'm ignoring many, many important details here. These include ciphersuite negotiation, parameter data, and -- most importantly -- client authentication, which we'll come back to later. But these four messages are what we need to think about right now.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;So why Snap Start?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
It only takes a glance at the above protocol to identify the problem with the classic handshake: &lt;i&gt;it's frickin'&amp;nbsp;&lt;/i&gt;&lt;i&gt;slow.&lt;/i&gt;&amp;nbsp;Every new TLS connection requires two latency-inducing round-trips. This can be a drag when you're trying to deploy TLS everywhere.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now technically you don't need to run the whole handshake each time you connect. Once you've established a TLS session you can resume it anytime you want -- provided that both client and server retain the master secret.** Session resumption reduces communication overhead, but it isn't&amp;nbsp;the answer to everything. Most people will balk at the idea of hanging onto secret keys across machine reboots, or even browser restarts.&amp;nbsp;Moreover, it's not clear that a busy server can afford to securely cache the millions of keys it establishes every day.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
What's needed is a speedy handshake protocol that doesn't rely on caching&amp;nbsp;&lt;i&gt;secret&lt;/i&gt;&amp;nbsp;information. And that's where Snap Start comes in.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The intuition behind Snap Start is simple: if TLS requires too many communication rounds, &lt;i&gt;then why not ditch some.&lt;/i&gt;&amp;nbsp;In this case, the target for ditching is the server's message in step (2). Of course, once you've done that you may as well roll steps (1) and (3) into one mutant mega-step. This cuts the number of handshake messages in half.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There are two wrinkles with this approach -- one obvious and one subtle. The obvious one is that step (2) delivers the server's certificate. Without this certificate, the client can't complete the rest of the protocol. Fortunately server certificates don't change that often, so the client can simply cache one after the first time it completes the full handshake.***&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Replays&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
The subtle issue has to do with the &lt;i&gt;reason&lt;/i&gt;&amp;nbsp;those nonces are there in the first place. From a security perspective, they're designed to prevent &lt;a href="http://msdn.microsoft.com/en-us/library/aa738652.aspx"&gt;replay attacks&lt;/a&gt;. Basically, this is a situation where an attacker retransmits captured data from one TLS session back to a server in the hopes that the server will accept it as fresh. Even if the data is stale, there are various scenarios in which replaying it could be useful.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Normally replays are prevented because the server picks a distinct (random) nonce &lt;b&gt;SR &lt;/b&gt;in step (2), which has implications throughout the rest of the handshake. But since &lt;i&gt;we no longer have a&amp;nbsp;&lt;/i&gt;step&amp;nbsp;(2), a different approach is required. Snap Start's solution is simple: let the &lt;i&gt;client&lt;/i&gt;&amp;nbsp;propose the nonce&amp;nbsp;&lt;b&gt;SR&lt;/b&gt;, and just have the server make sure that value hasn't been used before.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Obviously this requires the server to keep a list of previously-used &lt;b&gt;SR&amp;nbsp;&lt;/b&gt;values (called a 'strike list'), which -- assuming a busy server -- could get out of control pretty fast.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The final Snap Start optimization is to tie proposed&amp;nbsp;&lt;b&gt;SR&lt;/b&gt;&amp;nbsp;values with time periods. If the client suggests an &lt;b&gt;SR &lt;/b&gt;that's too old, reject it. This means that the server only has to keep a relatively short strike list relating to the last few minutes or hours. There are other optimizations to deal with cases where multiple servers share the same certificate, but it's not all that interesting.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So here's the final protocol:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;The client generates a random nonce&amp;nbsp;&lt;b&gt;CR &lt;/b&gt;and a &lt;i&gt;proposed &lt;/i&gt;nonce &lt;b&gt;SR.&amp;nbsp;&lt;/b&gt;It also generates a pre-master secret&amp;nbsp;&lt;b&gt;PMS&lt;/b&gt;, encrypts it with the server's public key and sends the ciphertext and nonces to the server.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;The server checks that &lt;b&gt;SR&lt;/b&gt;&amp;nbsp;hasn't been used before/recently. Both the&amp;nbsp;client and server both derive a 'master secret' by hashing* together (&lt;b&gt;CR, SR, PMS&lt;/b&gt;). The server notifies the client that it's ready to communicate.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The best part is that if anything goes wrong, the server can always force the client to engage in a normal TLS handshake.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Now for the terrible flaw in Snap Start&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
No, I'm just kidding. There doesn't seem to be anything wrong with Snap Start. With caveats. It requires some vaguely synchronized clocks. Moreover, it's quite possible that a strike list could get wiped out in a server crash, which would open the server up to limited replays (a careful implementation could probably avoid this). Also, servers that share a single certificate could wind up vulnerable to cross-replays if their administrator forgets to configure them correctly.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
One last thing I didn't mention is that Snap Start tries to use as much of the existing TLS machinery as possible. So even though the original step (2) ('Server Hello' message) no longer exists, it's 'virtually' recreated for the purposes of computing the TLS Finished hash check, which hashes over all preceding handshake messages. Ditto for client authentication signatures. Some new Snap-specific fields are also left out of these hashes.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
As a consequence, I suppose there's a hypothetical worry that an attack on Snap Start (due to a bad server implementation, for example) could be leveraged into an attack that works even when the client requests a normal TLS handshake. The basic idea would be to set up a man-in-the-middle that converts the client's standard TLS handshake request into a Snap Start request, and feeds convincing lies back to the client. I'm fairly certain that the hash checks and extra Snap Start messages will prevent this attack, but I'm not 100% sure from reading the spec.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Beyond that, all of this extra logic opens the door for implementation errors and added complexity. I haven't looked at any server-side implementations, but I would definitely like to. Nonetheless, for the moment Snap Start seems like a darned good idea. I hope it means a lot more TLS in 2012.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
* Technically this is a denoted as a PRF, but it's typically implemented using hash functions.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
** At session resumption the master secret is 'updated' by combining it with new client and server randomness.&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
*** Certificate revocation is still an issue, so Snap Start also requires caching of 'stapled' &lt;a href="http://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol"&gt;OCSP&lt;/a&gt; messages. These are valid for a week.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-1727185376212344825?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/wvTrtrjxJZs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/1727185376212344825/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/whats-tls-snap-start.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1727185376212344825?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/1727185376212344825?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/wvTrtrjxJZs/whats-tls-snap-start.html" title="What's TLS Snap Start?" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/whats-tls-snap-start.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cNRH8yeSp7ImA9WhRXF0k.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-8030355938620481026</id><published>2011-12-23T12:58:00.000-08:00</published><updated>2011-12-24T07:38:15.191-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-24T07:38:15.191-08:00</app:edited><title>A brief note on end-of-year giving</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://www.eff.org/files/EFF-logo.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="120" src="https://www.eff.org/files/EFF-logo.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
I wanted to take a quick break from the technical to bug you about something important.&lt;br /&gt;
&lt;br /&gt;
The end of the year is coming up and no doubt there are some folks thinking about last minute charitable donations. There are many, many worthy causes you can support. All things being equal, I'd give to my &lt;a href="http://feedingamerica.org/"&gt;local food bank&lt;/a&gt;&amp;nbsp;first, given how much need there is, and how far these institutions can stretch a charitable dollar ($1 at a food bank buys the equivalent of $20 at a retail supermarket).&lt;br /&gt;
&lt;br /&gt;
But if you have something left over I'd strongly recommend that you give to the &lt;a href="https://www.eff.org/"&gt;Electronic Frontier Foundation&lt;/a&gt;. In case you haven't noticed, there's a lot of crazy stuff going on with technology and &lt;a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act"&gt;the law&lt;/a&gt; these days. I recently &lt;a href="http://blog.cryptographyengineering.com/2011/11/digital-fortress-i-read-it-so-you-dont.html"&gt;poked fun&lt;/a&gt; at how small the EFF's budget is, but I meant it with love (and with reason!). They're fighting a tough uphill battle with minimal resources.&lt;br /&gt;
&lt;br /&gt;
I have a personal reason for supporting the EFF. Back when I was a grad student, some colleagues and I reverse-engineered a commercial device as part of a research project.&amp;nbsp;This is something that security researchers do from time to time, and it's something we &lt;i&gt;should&lt;/i&gt;&amp;nbsp;be able to do. Our goal was expose flaws in industrial security systems, and hopefully to spur the adoption of better technology. (Note: better technology is now out there, and no, I'm not taking credit. But scrutiny is generally a good thing.)&lt;br /&gt;
&lt;br /&gt;
Anyway, we knew that there were legal obstacles related to this work, we just didn't realize how significant they'd be.&amp;nbsp;When&amp;nbsp;we first disclosed our findings, there were some... unpleasant phone calls at high levels. The University's legal counsel politely informed us that in the event of a lawsuit -- even a frivolous one -- we'd be bearing the expense on our own. This is not a pleasant prospect for a newly-married grad student who's just signed mortgage papers.&lt;br /&gt;
&lt;br /&gt;
It's possible that without the EFF we'd have called the whole thing off right then.&amp;nbsp;But the EFF did support us. They took our case (for free!), and worked miracles.&lt;br /&gt;
&lt;br /&gt;
While our story has a happy ending, white hat security research in the US is still a minefield. Sadly this state of affairs doesn't seem to be improving. The EFF is just about the only group I know of that stands up for security researchers. Even if you're not a researcher, you probably benefit indirectly from their work.&lt;br /&gt;
&lt;br /&gt;
So please take a minute to &lt;a href="https://supporters.eff.org/donate"&gt;donate&lt;/a&gt;. It's tax deductible and some employers will match. If you donate at least $65 and become a &lt;a href="https://supporters.eff.org/join"&gt;member&lt;/a&gt;, they'll even send you an awesome T-shirt (I have one from 1999 that's still going strong -- it's ugly as sin but damn, the build quality is high.) Again, I'm not saying this should be the only donation you make this year, but it certainly would be a good one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-8030355938620481026?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/wb8Rs5fJyOY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/8030355938620481026/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/brief-note-on-end-of-year-giving.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8030355938620481026?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/8030355938620481026?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/wb8Rs5fJyOY/brief-note-on-end-of-year-giving.html" title="A brief note on end-of-year giving" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/brief-note-on-end-of-year-giving.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMNRn48eyp7ImA9WhRXFU0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6722394709457832058</id><published>2011-12-21T12:35:00.000-08:00</published><updated>2011-12-21T12:48:17.073-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-21T12:48:17.073-08:00</app:edited><title>A question for you</title><content type="html">This post is addressed to you, my patient and wonderful audience.&lt;br /&gt;
&lt;br /&gt;
I realize that my interests may not be entirely representative of yours.&amp;nbsp;So what would &lt;i&gt;you&lt;/i&gt; like to read about? I don't guarantee that I'll write on any of your suggestions, but&amp;nbsp;I do promise to at least &lt;i&gt;think&lt;/i&gt;&amp;nbsp;about the topics you propose.&lt;br /&gt;
&lt;br /&gt;
Feel free to make your suggestions in comments or Twitter. If you don't, be warned: you'll be as much to blame for that future post on Leakage Resilient Cryptography as I will.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-6722394709457832058?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/TWpc4rKWGQU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6722394709457832058/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/question-for-you.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6722394709457832058?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6722394709457832058?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/TWpc4rKWGQU/question-for-you.html" title="A question for you" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/question-for-you.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIBRHw4eCp7ImA9WhRXFU0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-6847037711092810379</id><published>2011-12-15T08:11:00.000-08:00</published><updated>2011-12-21T12:49:15.230-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-21T12:49:15.230-08:00</app:edited><title>What's the deal with RC4?</title><content type="html">&lt;div style="text-align: right;"&gt;
&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Playign_cards-biju.jpg/640px-Playign_cards-biju.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="143" src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Playign_cards-biju.jpg/640px-Playign_cards-biju.jpg" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;(&lt;a href="http://en.wikipedia.org/wiki/File:Playign_cards-biju.jpg"&gt;credit&lt;/a&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;a href="http://twitter.com/#!/ioerror"&gt;Jacob Appelbaum&lt;/a&gt;&amp;nbsp;tweets:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
Does anyone have a good reading list on practically attacking RC4?&lt;/blockquote&gt;
I don't intend to give an exact answer to Jacob's question here, but his tweet caught my eye for a reason.&amp;nbsp;You see, just the other week I &lt;a href="http://blog.cryptographyengineering.com/2011/11/how-not-to-use-symmetric-encryption.html"&gt;advised implementers&lt;/a&gt;&amp;nbsp;to &lt;i&gt;avoid&lt;/i&gt;&amp;nbsp;RC4 -- both because it's easy to misuse, and because it's has some real and theoretical flaws. But that doesn't mean any particular RC4 implementation is broken.&lt;br /&gt;
&lt;br /&gt;
Instead, you should take my advice as the crypto equivalent of "don't run with scissors", "don't run near the pool", or "don't run near the pool while carrying scissors". I don't know anyone who's actually lost an eye because they ignored these warnings, but I still yell this stuff at my kids. It's common sense.&lt;br /&gt;
&lt;br /&gt;
Still, this leaves us with a question: how bad is RC4, really?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;RC4, the stream cipher for the rest of us&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
First, the basics. RC4 was invented in 1987 by Ron Rivest. It spent its first seven years as an RSA trade secret before it was eventually&amp;nbsp;&lt;a href="http://web.archive.org/web/20080404222417/http://cypherpunks.venona.com/date/1994/09/msg00304.html"&gt;leaked&lt;/a&gt;&amp;nbsp;to a public mailing list in 1994. The rest, as they say, is history.&lt;br /&gt;
&lt;br /&gt;
You could argue that RC4's rise was inevitable. By the time of its leak, it was already in widespread commercial use&lt;i&gt;. &lt;/i&gt;Unlike &lt;a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard"&gt;DES&lt;/a&gt; it was&amp;nbsp;&lt;i&gt;fast&lt;/i&gt;&amp;nbsp;in software.* More importantly, the scheme itself is&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/RC4#The_key-scheduling_algorithm_.28KSA.29"&gt;dirt simple&lt;/a&gt;. You can fit the code for RC4 onto a cocktail napkin, with plenty of room left over for the cocktail. And of course, having become public, the 'alleged' RC4 was&amp;nbsp;free&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/RC4.svg/800px-RC4.svg.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="89" src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/RC4.svg/800px-RC4.svg.png" width="200" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;One phase of the RC4 PRG. K is the&lt;br /&gt;
output byte. Image: Wikipedia.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The scheme consists of two parts: a key scheduling algorithm (KSA), and a pseudo-random generator (PRG).&amp;nbsp;To encrypt a message, you run the key through the key scheduler, which produces a scrambled array called the &lt;i&gt;state vector&lt;/i&gt;. You then feed the state vector into the PRG, which continuously permutes it while outputting a series of bytes. You then XOR those 'keystream' bytes with your plaintext.&lt;br /&gt;
&lt;br /&gt;
RC4 is probably most famous for its (mis)use in 802.11 &lt;a href="http://en.wikipedia.org/wiki/Wired_Equivalent_Privacy"&gt;WEP&lt;/a&gt;. It's still used in WPA-&lt;a href="http://en.wikipedia.org/wiki/Temporal_Key_Integrity_Protocol"&gt;TKIP&lt;/a&gt;&amp;nbsp;(unsurprising, since TKIP is just a bandaid patch for WEP). But its use goes way beyond that. For one thing, it's a common ciphersuite for &lt;a href="http://en.wikipedia.org/wiki/Transport_Layer_Security"&gt;TLS&lt;/a&gt;, and as of a year or two ago it was even&amp;nbsp;&lt;i&gt;&lt;a href="http://burgerminds.wordpress.com/2009/12/22/google-chrome-security-fail-ssl-ciphers/"&gt;preferred&lt;/a&gt;&lt;/i&gt;&amp;nbsp;by browsers like Chrome. Up until recently,&amp;nbsp;&lt;a href="http://www.schneier.com/blog/archives/2005/01/microsoft_rc4_f.html"&gt;Microsoft&lt;/a&gt; used it everywhere. Skype uses it to obfuscate (though not to encrypt) its communication protocol. It shows up in&amp;nbsp;&lt;a href="http://mtc.sri.com/Conficker/"&gt;malware&lt;/a&gt;&amp;nbsp;and a zillion crappy DRM packages.&lt;br /&gt;
&lt;br /&gt;
To make a long story short, you'll usually find RC4 anywhere the hardware was too weak, or the developers too lazy to use a better cipher.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The plain stupid&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are a few basic things you need to avoid when using any PRG-based cipher. These aren't specific to RC4, but for some reason they seem to crop up at a higher rate in RC4 implementations than with other ciphers.&lt;br /&gt;
&lt;br /&gt;
The big honking obvious one is that&amp;nbsp;&lt;i&gt;you can't re-use the same RC4 keystream to encrypt two different messages. &lt;/i&gt;I hope I don't need to go into the consequences, but&lt;i&gt;&amp;nbsp;&lt;/i&gt;they're bad. Don't do it.&lt;br /&gt;
&lt;br /&gt;
You'd think this is so obvious that nobody could get it wrong, but that's exactly what&amp;nbsp;&lt;a href="http://eprint.iacr.org/2005/007.pdf"&gt;Microsoft famously did&lt;/a&gt;&amp;nbsp;back in 2005, encrypting different versions of a Word document with the same key.&amp;nbsp;If you &lt;i&gt;must&lt;/i&gt; use the same key for different messages, the solution is to combine the key with an Initialization Vector or 'nonce'. Unfortunately this can be problematic as well.&lt;br /&gt;
&lt;br /&gt;
Another big issue is ciphertext&amp;nbsp;&lt;i&gt;malleability&lt;/i&gt;. If you flip a bit in an RC4 ciphertext, you'll see the same bit flipped in the decrypted plaintext. This is awesome at parties. More to the point, it can lead to practical&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/10/attack-of-week-xml-encryption.html"&gt;padding-oracle type attacks&lt;/a&gt;&amp;nbsp;that totally compromise the security of your encryption.**&lt;br /&gt;
&lt;br /&gt;
The solution to the latter problem is simply to&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Message_authentication_code"&gt;MAC&lt;/a&gt; your ciphertexts. Unfortunately, people don't use RC4 because they know what a MAC is -- they use RC4 because you can download the code from Wikipedia. So, again, while this can happen with many ciphers, it tends to happen with RC4 a lot more than it should.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Key Scheduling&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Leaving aside the stupid, the real problem with RC4 is the Key Scheduling Algorithm (KSA), which kind of sucks.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://www.fitceleb.com/files/cards.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="146" src="http://www.fitceleb.com/files/cards.gif" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;
Picture a brand new box of playing cards. Starting with the unshuffled deck, work systematically from top to bottom, swapping each card's position with another card in the deck. The position you're swapping to is determined by a few simple computations involving the original card's face value and the cryptographic key. Now do this with a stack of about&amp;nbsp;&lt;i&gt;five&lt;/i&gt;&amp;nbsp;ordered decks and you've got the RC4 KSA.&lt;br /&gt;
&lt;br /&gt;
While this shuffle seems thorough, the devil is in those simple computations. Ultimately their simplicity means the shuffle isn't unpredictable&amp;nbsp;&lt;i&gt;enough&lt;/i&gt;. This leads to predictable patterns that show up in the first PRG output bytes. For example,&amp;nbsp;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6198"&gt;Mantin and Shamir&lt;/a&gt;&amp;nbsp;noted that the second output byte takes on the value '0' with about twice the probability it should. By itself that may not seem terribly useful, but for one thing: it's enough to practically determine whether an unknown algorithm &lt;i&gt;is&amp;nbsp;&lt;/i&gt;RC4, given about 128 keystreams on different (random) keys.&lt;br /&gt;
&lt;br /&gt;
From what I can tell, the first person to notice problems with KSA was Andrew Roos, who posted a &lt;a href="http://marcel.wanda.ch/Archive/WeakKeys-posting"&gt;paper&lt;/a&gt; to sci.crypt about a year after the leak. Aside from the fact that it was published on&amp;nbsp;&lt;i&gt;Usenet&lt;/i&gt;, Roos's result is notable for two reasons. First, he correctly identified use of concatenated IVs as a likely source of weakness in WEP implementations -- years before anyone else did.&amp;nbsp;Second, Roos gave recommendations that -- had they been followed -- could have prevented a lot of subsequent heartache. (Lesson: don't publish scientific results in newsgroups.)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;FMS&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Roos's paper set the table for the most famous attack on RC4, and the one that people still associate with RC4, even though it's rarely used in its original form. This is, of course, the &lt;a href="http://aboba.drizzlehosting.com/IEEE/rc4_ksaproc.pdf"&gt;Fluhrer, Mantin and Shamir&lt;/a&gt;, or 'FMS' attack, which appeared in 2001.&lt;br /&gt;
&lt;br /&gt;
Just like Roos, FMS looked at the KSA and found it wanting -- specifically, they discovered that for certain weak keys, the &lt;i&gt;first&lt;/i&gt; byte&amp;nbsp;output by the PRG tends to be correlated to bytes of the key. These weak keys can be obtained by prepending&lt;i&gt; &lt;/i&gt;a few &lt;i&gt;chosen&lt;/i&gt; bytes (say, 3 of them) to an unknown, fixed, secret key. Given keystreams resulting from 60 such chosen keys, you can derive one byte of the secret portion of the key. A 16-byte key can therefore be computed from about 960 such keystreams.&lt;br /&gt;
&lt;br /&gt;
On the face of it this sounds pretty unlikely -- after all, how are you going to get an encryptor to prepend &lt;i&gt;chosen&lt;/i&gt;&amp;nbsp;bytes to their secret key. Fortunately the attack works fine even if the adversary just &lt;i&gt;knows&lt;/i&gt;&amp;nbsp;that the appropriate bytes were used. This works perfectly for implementations that prepend (or append) a known&amp;nbsp;&lt;i&gt;Initialization Vector &lt;/i&gt;to the WEP key. Simply by observing a few million IVs, an attacker can eventually collect enough keystreams to meet the FMS requirements.&lt;br /&gt;
&lt;br /&gt;
All of this would have be a historical footnote if it hadn't been for protocols like&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Wired_Equivalent_Privacy"&gt;WEP&lt;/a&gt;, which (among its many problems) used a three-byte prepended IV. FMS was quickly &lt;a href="http://www.cs.jhu.edu/~astubble/600.412/s-c-papers/wireless2.pdf"&gt;demonstrated&lt;/a&gt;&amp;nbsp;to work on WEP, then &lt;a href="http://airsnort.shmoo.com/"&gt;packaged&lt;/a&gt;&amp;nbsp;into a neat tool and distributed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Klein, Dropping and Hashing&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are two common approaches to dealing with the FMS attack:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Drop the first &lt;i&gt;N&lt;/i&gt;&amp;nbsp;bytes of the RC4 keystream, for values of N ranging from 256 to 3,072.&lt;/li&gt;
&lt;li&gt;Don't concatenate the IV to the key, &lt;i&gt;hash&lt;/i&gt; the two together instead.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
The first option is sometimes referred to as &lt;a href="http://www.users.zetnet.co.uk/hopwood/crypto/scan/cs.html#RC4-drop"&gt;RC4-drop[N]&lt;/a&gt;, and the actual value of N has been subject to some debate.&amp;nbsp;In 2006,&amp;nbsp;&lt;a href="http://cage.ugent.be/~klein/RC4/RC4-en.ps"&gt;Klein&lt;/a&gt;&amp;nbsp;presented a super-charged variant of the FMS attack that reduced the necessary number of IVs from millions down to about 25,000. More importantly, he showed that FMS-type attacks are still (borderline) viable even if you drop the first 256 bytes of the keystream. So 768 seems like a &lt;i&gt;bare&lt;/i&gt; minimum to me, and some people will argue for much larger values.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The second approach was adopted for WPA-&lt;a href="http://en.wikipedia.org/wiki/Temporal_Key_Integrity_Protocol"&gt;TKIP&lt;/a&gt;, which was proposed as a band-aid replacement for WEP. TKIP was designed to support legacy WEP-capable devices that had internal RC4 hardware, but weren't powerful enough to handle AES. It made a bunch of positive changes to WEP (including adding a larger IV to prevent &lt;a href="http://etutorials.org/Networking/Wireless+lan+security/Chapter+6.+Wireless+Vulnerabilities/WEP+Keystream+and+Plaintext+Recovery/"&gt;keystream reuse&lt;/a&gt;), but the most notable change was a new custom &lt;i&gt;hash function&lt;/i&gt;&amp;nbsp;that creates a per-packet key from an IV and secret key.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As a hash function, the TKIP hash kind of stinks. For one thing, it can be &lt;a href="http://www.nowires.org/Papers-PDF/WPA_attack.pdf"&gt;inverted&lt;/a&gt; given only about 10 per-packet keys and about 2^32 computation (these days, a few minutes on a TI calculator). However, this isn't as big of a deal as it sounds: pre-image resistance isn't precisely a goal of the TKIP hash, since those per-packet keys&amp;nbsp;themselves&amp;nbsp;should themselves be hard to obtain. Nonetheless, I wouldn't recommend that &lt;i&gt;you&lt;/i&gt;&amp;nbsp;mess around with it. If you must use RC4, try a proper hash function. Or better yet, don't use RC4 at all.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Distinguishers&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Last but not least: RC4 is just a PRG, and a PRG is secure if its output is&amp;nbsp;&lt;i&gt;indistinguishable&lt;/i&gt; from a stream of truly random bits --&amp;nbsp;to a 'reasonable'&amp;nbsp;adversary who doesn't know the key.*** Hence a great deal of RC4 research focuses on the quality of the cipher's PRG.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So is RC4 a good pseudo-random generator? Meh. Given a &lt;i&gt;mere&lt;/i&gt; 1.5GB of keystream data, &lt;a href="http://www.mindspring.com/~dmcgrew/rc4-03.pdf"&gt;Fluhrer and McGrew&lt;/a&gt; presented an algorithm that distinguishes RC4 from random. I already mentioned&amp;nbsp;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6198"&gt;Mantin and Shamir&lt;/a&gt;&amp;nbsp;who cranked this down to about 256 bytes (over various unknown, unrelated keys) by looking at the second output byte. Finally,&amp;nbsp;&lt;a href="http://www.iacr.org/archive/eurocrypt2005/34940491/34940491.pdf"&gt;Mantin&lt;/a&gt; noticed the presence of repeating patterns in RC4, which &lt;i&gt;aren't&lt;/i&gt;&amp;nbsp;simply dependent on the first few bytes of output, and can be used to distinguish RC4 given about 64MB of keystream.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There are, of course, other distinguishing attacks. But does it matter?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Well, sort of. Indistinguishability is a critical characteristic of an XOR-based stream cipher. If we have it, then the security argument for RC4 encryption is very simple: to an adversary who &lt;i&gt;can't&lt;/i&gt;&amp;nbsp;distinguish the PRG, RC4 encryption is indistinguishable from using a &lt;a href="http://en.wikipedia.org/wiki/One-time_pad"&gt;one-time pad&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Unfortunately the converse isn't true. Just because RC4 output is distinguishable from random &lt;i&gt;doesn't&lt;/i&gt;&amp;nbsp;mean that there's a practical attack on the cipher. These results are important mostly because they illustrate the fundamental wonkiness of RC4, wonkiness that doesn't go away just because you drop the first 3,072 bytes. But they don't exactly give us a practical opening into the cipher itself. Yet.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Ok, none of this was very helpful. I just want to know: can I use RC4?&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Great question.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The upshot is that RC4, if used as recommended (with hashed IVs and/or dropped output and MACs), is perfectly sufficient for securely encrypting messages. Today. The problem is, we never know what the future will bring.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
My advice? Don't run with scissors. You can lose an eye that way.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;Notes:&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
* My totally unscientific results, from running 'openssl speed' on a lightly loaded Macbook Pro:&amp;nbsp;3DES-EDE: 21 bytes/μsec. DES: 54 bytes/μsec. AES-128: 118 bytes/μsec. RC4: 248&amp;nbsp;bytes/μsec.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;**&amp;nbsp;&lt;/i&gt;You might argue that RC4 implementations shouldn't&amp;nbsp;&lt;i&gt;use&lt;/i&gt;&amp;nbsp;padding in the first place, since (unlike CBC mode encryption with a block cipher) messages don't need to be padded to a multiple of a block size. This is true -- however, I would note that 'padding oracle'-style attacks needn't rely specifically on padding. Padding is just one type of encoding that can leak useful information if used incorrectly. For a great example, see&amp;nbsp;Jager and Somorovsky's&amp;nbsp;recent result that uses UTF8 coding checks to defeat&amp;nbsp;&lt;a href="http://blog.cryptographyengineering.com/2011/10/attack-of-week-xml-encryption.html"&gt;XML encryption&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
*** By reasonable, of course, we mean 'computationally limited'. This rules out attacks that require an unrealistically long time, quantum computing, or ESP.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-6847037711092810379?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/i1Kb35H5yjQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/6847037711092810379/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6847037711092810379?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/6847037711092810379?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/i1Kb35H5yjQ/whats-deal-with-rc4.html" title="What's the deal with RC4?" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/whats-deal-with-rc4.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EEQ34zfip7ImA9WhRQGU0.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5667243749159381828</id><published>2011-12-13T16:37:00.000-08:00</published><updated>2011-12-14T15:33:22.086-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-14T15:33:22.086-08:00</app:edited><title>Programming note</title><content type="html">I realize that posts have been a bit light on this blog over the past couple of weeks. I've been a bit preoccupied recently, but this will soon change. I'm also aware that I have a few outstanding unfinished threads, and I certainly haven't forgotten them. If you have no idea what I'm talking about, that's great! See:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://blog.cryptographyengineering.com/2011/11/how-not-to-use-symmetric-encryption.html"&gt;How (not) to use symmetric encryption&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.cryptographyengineering.com/2011/09/what-is-random-oracle-model-and-why.html"&gt;What is the random oracle model and why should you care?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.cryptographyengineering.com/2011/09/when-things-fall-apart-part-1.html"&gt;Where things fall apart&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Stay tuned. There will be content.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-5667243749159381828?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/b4GiGqz_hkk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5667243749159381828/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/programming-note.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5667243749159381828?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5667243749159381828?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/b4GiGqz_hkk/programming-note.html" title="Programming note" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/programming-note.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UERXg_fCp7ImA9WhRQF00.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-5322881937118498799</id><published>2011-12-11T22:44:00.001-08:00</published><updated>2011-12-12T07:53:24.644-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-12T07:53:24.644-08:00</app:edited><title>Paul Kocher</title><content type="html">&lt;div class="separator" style="clear: both; text-align: left;"&gt;
On the one hand, I have enormous respect for Paul Kocher.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
On the other hand, writing:&lt;br /&gt;
&lt;i&gt;/* Paul Kocher thinks this is ok */&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
does not necessarily make it ok.&lt;br /&gt;
&lt;br /&gt;
Just sayin'.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-5322881937118498799?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/xuim_2rp07c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/5322881937118498799/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/paul-kocher.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5322881937118498799?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/5322881937118498799?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/xuim_2rp07c/paul-kocher.html" title="Paul Kocher" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/paul-kocher.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cBQn07eyp7ImA9WhRQFko.&quot;"><id>tag:blogger.com,1999:blog-4341554630550651649.post-2580317488010172276</id><published>2011-12-11T21:50:00.001-08:00</published><updated>2011-12-11T22:24:13.303-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-11T22:24:13.303-08:00</app:edited><title>Liveblogging WWII: December 12, 1941</title><content type="html">&lt;blockquote&gt;
In mid-December 1941, Driscoll finally sent the British some information on her special method, with only cursory answers to the few questions Denniston had posed four months before. Driscoll again declared her faith in her approach, but GCCS concluded that it "apparently failed." For one thing, it could not, as she had claimed, overcome the problem of turnover -- that is, the tumbling of the Enigma's wheels before enough letters had been enciphered to identify the wheel being used. And as Turing pointed out to her in a letter in October 1941, her method would take seventy-two thousand hours -- more than eight years -- to find a solution. Given Driscoll's obstinacy, Bletchley park began to have second thoughts about providing more technical information.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
As luck would have it, an apparent mix-up in the mail delivery between OP20G and Bletchley Park soon brought the simmering distrust and jealousies between the two agencies flaring the the surface. Dennison's early October dispatch -- a bag of materials containing detailed answers to all but one of Driscoll's questions -- never reached OP20G, the Navy claimed. It didn't take long for Safford, who feared the British were breaking their promises, to push Leigh Noyes into firing off a series of complaints to the British. Through November and December 1941, angry memos and accusations flew across the Atlantic. Noyes didn't mince his words: Britain had broken its promise to OP20G; American had no use for the Bombe; and if GCCS cooperated, Driscoll could have her method working on real problems. ...&lt;/blockquote&gt;
&lt;blockquote&gt;
Noyes, who was unaware of the complexities of the mail mix-up, continued to fire off angry memos to the British, some of them clearly threatening. The U.S. Navy, he said, had never agreed to confine itself to Enigma research. It had always intended to be "operational" -- that is, intercepting and decoding messages on its own. He told Hastings that all the Navy wanted from the British was the information on the Enigma and the codebooks and Enigma machine that Safford and Driscoll had requested.&amp;nbsp;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
Then, belying later histories of GCCS and OP20G relations, Noyes apologized to the British, twice. On December 10 and again on the twelfth, he declared that British explanations and actions since his outbursts had satisfied him and "everyone" at OP20G. The missing package, of course, was found. On December 13, Bletchley received a cryptic yet pointed message from someone in the U.S. Navy Department: "Luke Chapter 15, v 9: And she found it. She calleth together her friends and neighbors saying: Rejoice with me for I have found the piece which we lost".&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote&gt;
 -- Jim DeBrosse, Colin Burke: The secret in Building 26&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4341554630550651649-2580317488010172276?l=blog.cryptographyengineering.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/AFewThoughtsOnCryptographicEngineering/~4/hyeO_qmTB04" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cryptographyengineering.com/feeds/2580317488010172276/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cryptographyengineering.com/2011/12/liveblogging-wwii-december-12-1941.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2580317488010172276?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4341554630550651649/posts/default/2580317488010172276?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AFewThoughtsOnCryptographicEngineering/~3/hyeO_qmTB04/liveblogging-wwii-december-12-1941.html" title="Liveblogging WWII: December 12, 1941" /><author><name>Matthew Green</name><uri>http://www.blogger.com/profile/05041984203678598124</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="19" height="32" src="http://1.bp.blogspot.com/-Capxfq7y1NM/TsEUFDvh2vI/AAAAAAAAAGE/fvLwd6KQdyY/s220/mgreen_toon.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cryptographyengineering.com/2011/12/liveblogging-wwii-december-12-1941.html</feedburner:origLink></entry></feed>

