Re: [PATCH 4/4] crypto: lmk2/lmk3 cipher block modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Herbert,

On Sun, Jan 17, 2010 at 10:03:25PM +1100, Herbert Xu wrote:
> On Mon, Dec 28, 2009 at 06:59:15PM +0000, Max Vozeler wrote:
> > Both modes operate on full 512 byte sectors. They use CBC
> > with an IV derived from the sector number, the data and (for
> > lmk3 only) an extra 128-bit IV seed.
> 
> So this is just CBC with a modified IV? 

Is is almost CBC, but not exactly.

The difference is that the IV is derived from the cleartext and
so is not known before decrypt.

So decrypt could be described using CBC as, I think:

 1) CBC decrypt with null IV
 2) Derive IV based on cleartext of blocks 1..31
 3) XOR block 0 with IV

> If so it should not be implemented as another mode. Doing it as
> a mode means that you will not benefit from any hardware
> implementations of CBC.

If there is some way to implement it cleanly without making it
another mode I would prefer doing that.

> You should instead implement it as an IV generator.  Currently
> they're done in dm-crypt. 

I'd agree that dm-crypt would be the more suitable place.

But I'm not sure how to implement it given the difference
described above. It might look something like this:

 - Add IV generators "lmk2", "lmk3"

 - Treat them as "cbc" with null IV internally, then after 
   decrypt derive IV and xor block 0 with it.

The second part is why I built this as a mode originally. It
seemed like it was not belonging in dm-crypt.

	Max
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux