347 points · by notRobot · 6y ago · 117 comments
Since then several protocols have shifted towards preferring Elliptic Curve Diffie-Hellman key exchange which doesn't suffer from the same attack, or at least using larger primes for plain DHKE (1536-bit and above). However I don't know the extent of this - a lot of VPNs at least are still using the old, weak DH keys.
Fast forward to today, and devs/cryptographers absolutely threw the nsa and cia out on their asses for their SPECK kernel argument hinging on the seemingly ironclad credibility of "it's classified."
Corporate players will still sneak backdoors;it's what they do. But the real blow to the intelligence community is the loss of default trust and the active denial by the open source community.
I'm on the fence about speck. It's so simple that there isn't much room in there for a back door, meaning that if there is one it implies that the NSA knows something we don't about ARX ciphers.
If the NSA knows something we dont about ARX, then could they also know something about ChaCha?
The parent comment to yours gets a bit excitable about ed25519 being a prime-rejecting miracle cure. Indeed 2^255-19... is prime. Elliptic curve cryptography still relies on large prime order subgroups for its security and that's not going away until and if quantum computers get good enough to break it. The main advantage of ed25519 is that it is fairly hard to implement badly. No k=3 randomness issues as with ECDSA (you can also use deterministic ECDSA to get this property). Constant time curve constructions. Etc etc.
The same team who designed SIMON and SPECK designed SHA2 so, worth thinking about that.
My personal opinion is that there's nothing wrong with SIMON and SPECK. However there's also not a lot wrong with AES and so little reason to downgrade to something else in almost all use cases. The reason Germany and Israel kicked them out of ISO was likely entirely politically motivated. I mean if I were them and I'd maybe been stung by some of the Snowden leaks e.g. using weaker crypto, or had lost trust in the NSA, I'd probably do the same.
The argument for lightweight crypto is not at all clear. I've heard of people implementing AES in less than 1000 gate equivalents, with the target GE in the NIST lightweight competition being 2000. There is somewhat more justification for lightweight hashing because of say the large internal state size of Keccak not being particularly embedded friendly.
But we're talking about super constrained devices here. RFID tags or encrypted flash storage to go with a cortex-m.
It's entirely justified to remove SIMON/SPECK from the Linux kernel. To run vanilla Linux you need an MMU, and the cortex-m series of processors that power most embedded stuff don't have one. Even then, they're actually powerful enough to do full TLS anyway if coded properly (bearssl for example).
That, ultimately, has been the solution the community landed at: nothing-up-my-sleeve curves for ECDH and EdDSA.
The nothing-up-my-sleeve part is all about setting / agreeing to obvious and hard guidelines for generating and selecting curves before doing the selection, then you can see that a curve was generated and selected without any hidden agendas. We have several of these now that are generally thought to be secure, though, of course, it's hard to say for sure. It's a pretty good outcome.
The NSA has given us good reason to question everything they release.
That does not mean the probability is the same. Whatever X they develop and push has much greater probability than other X-es.
Their loss is our gain.
There was a strange twist in this story: "Then, in August of this year, NSA freaked out.". And this guy is a professional.
https://blog.cryptographyengineering.com/2015/10/22/a-riddle...
Back in 2016 I noticed that OpenSSL was using the wrong primes (https://github.com/openssl/openssl/commit/fb015ca6f05e09b11a...) and since then I've been very curious to know how prevalent the previous DH primes are.
https://news.ycombinator.com/item?id=10390822
https://news.ycombinator.com/item?id=13198567
There's probably a lot of information in those discussions, but you can't comment there, so if you have anything to add, this is the place.
1800: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause...
2000: lol tech lets us read it all
2025: Oh no, crypto is good now? They want us to get a warrant and use non-dragnet surveillance to pursue leads? THE HORROR!
> There was once a far away land called Ruritania, and in Ruritania there was a strange phenonmenon -- all the trees that grew in Ruritainia were transparent. Now, in the days when people had lived in mud huts, this had not been a problem, but now high-tech wood technology had been developed, and in the new age of wood, everyone in Ruritania found that their homes were all 100% see through...
> One day, a smart man invented paint -- and if you painted your house, suddenly the police couldn't watch all your actions at will...
> Indignant, the state decided to try to require that all homes have video cameras installed in every nook and cranny. "After all", they said, "with this new development crime could run rampant. Installing video cameras doesn't mean that the police get any new capability -- they are just keeping the old one." [...]
Why would you build houses out of wood if the wood is transparent?
It would make more sense if it were discovered years later that the police had special polarizing binoculars that let them see through the wood, which no one knew they had until it was too late and all the old mud huts had been phased out.
Also, describing someone as a “paint technologist” when they are anti-paint is a confusing decision for a parable: a story intended to make a complex issue easier to understand. I initially assumed they were going to have a role analogous to a cryptographer, not an anti-privacy provocateur.
Perhaps having the police attempt to foil insidious flower thieves or dastardly rebel plots to undermine the government controlled potato cartel would also be more in spirit with a parable. The use of awful real life crimes (against children, even) make this a difficult one to share.
Hopefully the aftermath of this era of corruption and grift in government is a better legal framework.
The biggest problem in the past was secure coordination. For example, the battle plans at the Battle of Antietam were discovered in cigars.
Thus, the calculus was that people could keep their stuff private, but if they were trying to coordinate with others, communications were able to be cracked.
However, now, people can do secure, encrypted communication easily with dozens of people worldwide. This changes the calculus of what they can accomplish. A person with a locked briefcase at home is pretty limited in what kind of stuff they can coordinate. A person securely communicating with dozens of people worldwide, can accomplish quite a lot without discovery.
This changes the calculus from the 1800s.
Calling 2000 as the "year of dragnet surveillance" has similar issues, because you could argue that dragnet surveillance really got started in the telegraph era and scaled during -- was it WWI? If I think too hard about these dates I'm going to wake up tomorrow drooling on the keyboard from a wikipedia binge.
edit: I realize I wasn't clear what the more serious problems I'm referencing are. They are human trafficking, murder, domestic abuse and so on.
I think every new impactful tech requires a reevaluation of laws to keep the balance from tipping in the wrong direction.
I also object to your wording around "bad guys" and "good guys." When Joe LEO wants to use the state surveillance apparatus to spy on his ex, is he a "good guy"? When the FBI mailed MLK Jr a suicide letter, was MLK the "bad guy"?
(Libressl is developed by OpenBsd)
This doesn't seem relevant here. The government can make all the secret attempts to read your communications remotely that they want. If they want to take the strategy of torturing you until you hand the information over yourself, at a bare minimum they need to be willing to admit to doing it. It's not a threat to worry about, from the US government.
1: https://en.wikipedia.org/wiki/Extraordinary_rendition
2: https://en.wikipedia.org/wiki/Enhanced_interrogation_techniq...
3: https://en.wikipedia.org/wiki/Police_brutality_in_the_United...
You are first of all assuming the worries are coming from US citizens. People outside the US can obviously worry about the US government or its allies breaking their knees, it is a widely documented fact of life in many US war zones. We know that the US has officially been torturing people it suspected of terrorism for information (Guantanamo, CIA prisons in Eastern Europe) .
Second of all, we also know from the past that the FBI has been involved in campaigns of infiltration, blackmail, threats, incitement to violence, and almost certainly assassination of civil rights organizations and leaders (COINTELPRO). This was investigated at the time by Congress and new laws were put in place to prevent this type of behavior, but we have no guarantee that it didn't resurface in some form, especially in the current political climate (especially by not only the 'war on terrorism' started by Bush and escalated by Obama, and enthusiastically supported by Trump).
Overall, I think it's perfectly reasonable to fear the US government may physically force you to give up secrets, obviously so if you are not a citizen, and quite likely even if you are one.
Once you have taken care of these priorities, you can start worrying about the soundness of your encryption. Inventing safe encryption if you're not overly concerned about performance is really not hard, even experienced laymen can do that by using existing cryptographic primitives. You can even make it quantum safe. (It should be, in the described scenario.) If you think that is not within your capabilities, then you're probably right, but then you've already failed at task 1 and 2 anyway.
For the remaining 99.9999% of the population this is not a realistic threat scenario, and it's best to use a well-established cryptographic library with the recommended defaults.
Whose knees to break though?
The obvious backdoor in Dual EC-DRBG is a good example, and you have companies helping the NSA in very extensive ways (e.g. Crypto AG).
It's just logic, the goal of the NSA is to protect interests of the US, if it involves pushing rigged / weak algorithms for the greater "good" (at least from a US perspective), they'll do it.
It's legal, and logical.
In the short term it may have been a good idea but Blind Freddy could have seen the damage it would/did cause when people discovered it.
As others have said, the NSA/CIA is on default-distrust now with crypto devs. That's not protecting the US interests.
https://archive.fosdem.org/2014/schedule/event/nsa_operation...
When you manage to break an encryption method you protect your zero-day investment by encouraging everyone to continue to think you can't.
#SetecAstronomy
How are they recruiting so many qualified individuals?
Say what you want, the NSA probably has some of the most interesting tech problems you'll encounter. Part of that is due to the unique job that they do-- by definition, they're doing things that nobody else in the US is allowed to do, so they need people to solve problems that don't exist elsewhere. Part of that is due to having a huge amassed knowledge particular to their area of work, which allows them to work on things that other people/organizations simply don't even know about.
Also: the NSA has supercomputers that make your eyes bleed. A buddy of mine who worked there says that even their power bills are classified. Back in the day, they developed a lot of highly specialized, one-of-a-kind hardware. Cray processors had a popcount instruction that was supposedly put in place at the NSA's behest. They can afford to get specialized treatment and demand specialized features from folks who build their computers. If speculation regarding their signal collection capabilities is true, then they also have to have serious signal processing and communications tech, too.
The NSA has interesting challenges and cool tech to work with. That can attract a LOT of people.
Another issue is mission. Look, you may not agree with the NSA's techniques and methods. But at least the original goal of the NSA-- breaking codes used by foreign adversaries to gain an intelligence and military advantage-- is pretty standard military fare, and not inherently evil. SIGINT played a major role in shortening WWII, and who knows may have happened since then (since it's all classified). The folks I know who work there are proud of their work, and believe they're doing the right thing. I'll note that these are GOOD people whom I respect, which leads me to believe that the NSA isn't just moustache-twirling and evil cackling. Some people work there because they believe they are genuinely serving their country.
Finally: tickets. Several of the folks I know have gone to the NSA, worked there a few years, then jumped ship to take industry jobs with clearances. Government contractors pay a premium for cleared workers, and if you show up with a TOP SECRET clearance in hand, your job interview chances just got better. It's a good way to set yourself up for decent job security and comfortable pay.
At no point was that true for 1024 bit DH keys.
So why did anyone ever implement it?
I used to do freelancing for an ICT magazine and in early-to-mid 00s ran some numbers, as part of an article I did on limitations of applied cryptography. You can't do 1024-bit math on 32-bit or even 64-bit integers. Not without bignum libraries, which in turn make use of applied number theory. Under the hood the multiplication of two large numbers is an O(n^2) operation.
Performing an RSA or DH calculation with decent desktop computer in ~2003 took about 20ms with a 1024-bit number, and 80ms with a 2048-bit number. IIRC the first was expected to be theoretically breakable in a decade or so, assuming Moore's Law held true. The second was thought to be computationally infeasible for at least 100 years. These days the professionally paranoid use 4096-bit keys. (Or more recently, the nice 25519 curve which is more compact.)
So raising the security margin from "reasonable" to "paranoid", back in the day, would have required 4x the hardware investment to serve the same amount of traffic, and it would have imposed severe latency issues for everyone. We also have to consider the fact that most commercial secrets have a shelf life of years to a couple of decades. So before "E2E for everyone" became a thing, there simply wasn't widespread interest for crypto that could protect personal secrets for a lifetime.
With regards to using cryptography for personal privacy, cypherpunks were well ahead of their time. It's only become a mainstream issue in the last 5 years or so.
Since DH key exchange isn't done on all the data, only to exchange keys, and no machine then or now was setting up 1 million encrypted connections per second, I don't see this as a performance bottleneck at all.
What am I missing?
[1]: https://books.google.co.uk/books?id=V5oACAAAQBAJ&pg=PA208
That's 1024 32-to-64-bit wide multiply operations. On x86, where regular mul is wide (it sets both edx and eax), that's the same as a regular operation. Some architectures that have just a MUL and a MULH instruction would make it two instructions. If you have neither, that would require 3 multiply instructions plus a few shifts.
> Even in 2003, they were typically pipelined with a throughput of one multiply per cycle[1], so you should be able to do that in ~1040 clock cycles.
The inner loop is much more than a wide multiply. You have to load the two words you're multiplying (although one of them should already be loaded in the outer loop). Then you need to two adds-with-carry, store the results back. Next you need to handle the extra carry bit, which in the most naïve case is another load, add-with-carry, store. And finally, you need the regular loop management instructions.
That's 4 loads, 3 stores, 3 adds, and 1 multiply, repeated 1024 times. I don't know the exact port availability and timing of Pentium 3 processors, but if there's only one load /store port, and it's a 4-cycle latency operation, you're looking at probably 25-ish cycles per inner loop iteration, or about 25,000 clock cycles.
On the bright side, the brainfart triggered a lot of interesting discussion. :)
In particular, crypto typically works with integers zillions of times smaller, so you certainly don't want the Harvey-van der Hoeven algorithm for that.
It's likely already operational ;)
Silent updates are extremely dangerous. This is why you can see some Israelis, for example, refusing over-the-air updates on their phone while traveling.
https://medium.com/@topjohnwu/huaweis-undocumented-apis-a-ba...
Think of two servers first doing DH and then doing ECDH. You'd get two shared keys. This is inefficient because it has more roundtrips than doing the algorithm's steps in parallel, but helps with understanding.
These two secrets can then serve as inputs to your KDF which derives multiple secrets for each of the data ciphers you use. E.g. first AES with the first secret then encrypt that with ChaCha20 with the second secret. As long as your KDF is preimage resistant, you can't get from one algo to another.
And yes, length of keys and computation do increase. But I argue that this will be a cost worth paying at least in some scenarios. Especially in a time we make our CPUs slower by double digit percentages for all computation in the name of security.
Hell, the Windows Genuine Advantage system, which goes back to Windows 98SE, uses ECC for its keys.
[1] https://internetcafe.ph/forum/4-lounge/17183-all-u-need-to-k...
Coincidence?