Re: Cipher advice
- From: Mark Wooding <mdw@xxxxxxxxxxxxxxxx>
- Date: Wed, 6 Sep 2006 00:14:35 +0000 (UTC)
David Wagner <daw@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
AES in CTR mode doesn't provide integrity or message authentication,
so it wouldn't be enough on its own.
.... but would be OK instead of CBC mode, if you also made sure of the
integrity of the ciphertext. However, CBC mode is a bit more
`forgiving' of implementation errors: if you reuse an IV, for example,
then CBC mode will leak a block or so, probably, while CTR mode will
fail catastrophically.
That said, properly implemented, CTR mode is /less/ likely to leak than
CBC (see Ferguson and Schneier's `Practical Cryptography'). Also, since
you'll presumably need a sequence number in your packets anyway, to
protect against replay attacks, you can, if you're careful, reuse that
to form your CTR-mode IVs. Suppose that you know that you won't produce
more than 2^64 messages in a session, and each one will be at most 2^64
blocks long. (These are not, I think you'll find, particularly onerous
limitations.) Then, for message number q, you can use I64(q) || 0^64 as
the IV, where I64 formats a number as a 64-bit string in some
unambiguous way.
The reuse-the-IV trick doesn't work for CBC mode as it is: CBC mode is
weak if an attacker can predict the IV you'll use for the next message.
However, if you use AES_K(I128(q)) then you'll be OK -- because he
doesn't know the key, he won't be able to predict the IV.
(Hmm. Stream of consciousness musings...
I think that applying an AXU hash is sufficient to be able to use nonces
rather than random IVs for CBC mode. That is, let H_k(.) be an AXU
hash, E_K(.) be a block cipher; choose K and k at random. To encrypt a
message x_0, ... with nonce n, compute y_0 = E_K(x_0 XOR H_k(n)), and
y_i = E_K(x_i XOR y_{i-1}) for i > 0 as usual.
Certainly, if an adversary wants to choose IVs and plaintexts to
collide, then he needs H(n) XOR x = H(n') XOR x', which an AXU hash will
resist.
Hmm, but that's not good enough, because it's sufficient for him to find
n such that H(n) XOR x = z for some known z, and I can't get a better
bound than \sqrt{\epsilon} for this, for an \epsilon-AXU hash.
Fortunately, for the specific hash H_k(n) = k n in GF(q), we know that
H(.) is 1/q-AXU, and the guessing game is won with probability 2/q.
I should go away and think about this some more. Maybe it's too late
and I'm utterly wrong.)
-- [mdw]
.
- References:
- Cipher advice
- From: wesley . hall
- Re: Cipher advice
- From: Francois Grieu
- Re: Cipher advice
- From: wesley . hall
- Re: Cipher advice
- From: Alan
- Re: Cipher advice
- From: David Wagner
- Cipher advice
- Prev by Date: Re: Need help RNG project
- Next by Date: Re: Need help RNG project
- Previous by thread: Re: Cipher advice
- Next by thread: Re: Cipher advice
- Index(es):
Relevant Pages
|