Question regarding using AES in CTR mode to encrypt UDP



I am using libtomcrypt & libtomnet programmed by Tom St. Denis for my
university project.

In his libtomnet, he is using AES-128 in CTR mode.
I am interested in encrypting/decrypting packet buffers which I then
sendto/recvfrom using UDP,
but in CTR mode I have a problem synchronising the counter of the CTR
mode (or the IV) -
in UDP packets might get lost, so the synchronization between counters
on both peers is lost as well, for example :

I have two peers A & B which both share the same key and the same IV.
each time, a buffer is encrypted, the IV (or counter) is incremented
by one, and that IV is used in the encryption process.

1. A has counter/IV with a value of 1, and so does B.
2. A encrypts a buffer using the shared key and counter/IV and sends
it to B, but it gets lost (UDP).
3. A now has a new buffer to encrypt and send, it uses the key and
counter/IV of 2 to encrypt, then sends the packet.
This time B gets it, and it uses the shared key and its counter/IV
to decrypt (actually it also encrypts) the buffer.
BUT, since B's counter/IV value is 1 (and not 2 as A's counter/IV
value), the output of the decryption (encryption)
process is totally different from the plain text A encrypted.

Could someone please help me in resolving this issue(one idea I had,
was to send the counter/IV with the encrypted
message, but that increases the packets, and I would like to avoid
it).

So, how can I use CTR mode to encrypt UDP traffic (or if I cannot use
it, what mode (CBC, CFB or other )is best
recommended for working with such a protocol as UDP (unreliable) ?

Thanks :-)

Itay

.



Relevant Pages

  • Question regarding using AES in CTR mode to encrypt UDP
    ... he is using AES-128 in CTR mode. ... A has counter/IV with a value of 1, ... A encrypts a buffer using the shared key and counter/IV and sends ... counter/IV of 2 to encrypt, ...
    (comp.security.misc)
  • Re: Newbie IV Question.
    ... Tom St Denis wrote: ... You mean CTR mode right? ... using ECB to encrypt the IV as the first 16 byte block into the ... with random text following the zero termination. ...
    (sci.crypt)
  • Re: GOST key gen?
    ... If I encrypt 1MB of data with a 64-bit block cipher, ... Information leakage of what kind? ... Could you tell it was encrypted in CTR mode? ... internal collisions. ...
    (sci.crypt)
  • Re: encryption & padding
    ... >> I'm developing a program with relevant data for the user. ... >> All the C reference implementation do encrypt 32 bits of data block. ... CTR mode has so many advantageous over OFB, CFB and CBC mode that its ...
    (sci.crypt)

Quantcast