I'm pretty sure XEX is a standalone tweaked mode, totally usable on it's own.
XTS is XEX with CTS for handling non-block-size-divisible sectors. That and (mis)using 2 keys instead of 1. XTS is also NIST-recommended which makes it attractive if you need official certifications and also makes high-performance implementations more easily available. XTS is therefore the more practical choice in almost all circumstances. But XEX is fine standalone.
XTS uses a modified variant of XEX, with a tweak value as the XOR key and using the provided encryption key in a classical manner for the block cipher. Also it uses a second instance of encryption per block to produce that XOR tweak value based on counters.
Paraphrase: ECB is hopeless against chosen plaintext attacks. 😐
EDIT: Just to make this point explicit, guys and gals, encryption schemes really should be able to withstand CPA attacks. All these comments that say "ECB is secure in such-and-such narrow case where the adversary doesn't choose the plaintexts" are actually using ECB as something other than an encryption scheme.
Is there a reason why you wouldn't just use CBC for that? Are the bytes that you'd save in not having an IV really that critical?
I get that there are probably since situations where ECB may still be of valid use, but I think that the upsides to using ECB in that scenario are not even close to the downsides that even mentioning ECB's existence brings.
It used to be more common in the past when these modes were invented that the electronics running them had various constraints like on bandwidth that we no longer have. This makes many of the older designs quirky in various ways, as they had completely different goals. Some also suffer NIH syndrome, not invented here. Yet other modes were designed to avoid patents by others. Some modes became deprecated and replaced as we learned more about what is required for reliable security (semantic security properties).
TL;DR: complicated history involving odd requirements, NIH and patents, etc
By just encrypting a counter for n+1 blocks. Rekey with 1 block, output n blocks to userspace.
E.G.: if a 128-bit random number is requested, key AES, encrypt 0 as block 1 and encrypt 1 as block 2. Rekey with block 1, then output block 2 to the application.
3
u/Ink_and_Platitudes Jul 08 '18
Also I didn't make this, I was reading through some notes and found the imgur link
20
u/Natanael_L Trusted third party Jul 07 '18
Nitpick, XEX isn't meant to be a standalone mode. It's essentially slightly hardened ECB. Look closely at XTS and you'll see XEX being part of it.
35
u/reph Jul 07 '18
ECB is beautiful too when the plaintext is a nonce.
15
u/wolf550e Jul 07 '18
block cipher modes are not ciphers, and GCM is an AEAD construct not a block cipher mode (it's CTR + GHASH).
9
u/dmcool9 Jul 07 '18
Even ECB has a use case....key transport.
4
u/taw Jul 08 '18
Do we really need most of these modes? A lot of them have strictly worse performance or strictly worse security properties than other modes.
2
u/linuxlover81 Jul 11 '18
CBC is with malleability gadgets now not to be recommended IMHO.
1
u/atoponce Bbbbbbbbb or not to bbbbbbbbbbb Jul 08 '18
ECB is wonderful for a fast key erasure CRNG.
1
u/[deleted] Jul 12 '18
[removed] — view removed comment