Messages in this thread | | | Subject | Re: [PATCH 01/04] Adding cipher mode context information to crypto_tfm | From | Fruhwirth Clemens <> | Date | Thu, 10 Feb 2005 02:02:38 +0100 |
| |
On Wed, 2005-02-09 at 19:30 -0500, James Morris wrote: > On Wed, 9 Feb 2005, Fruhwirth Clemens wrote: > > > I can't code for the case of two. Because, first, that's the idea of > > generic in the name "generic scatterwalk", second, I need at least 3 > > scatterlists in parallel for LRW. > > Can you explain why you need a third scatterlist for the LRW tweak?
Because a tweak is different from an IV. There can be an arbitrary number of tweaks. For instance, EME takes 1 tweak per 512 bytes. If you have a 4k page to encrypt, you have to process 8 tweaks of whatever size. Therefore, you need 3 scatterlists: src, dst and the running along tweak.
However, I don't want to limit the discussion to the specific needs of LRW or EME. I wanted to write something nice and generic for other people to use, thus scatterwalk_walk.
There must be a solution to get an arbitrary number of kmappings in softirq problem. If it's possible for 2 pages, I can't see a reason why this ain't possible for more. The use of scratch buffers and constant switching of kmap_atomic mapping is just ridiculously stupid.
> My understanding is that the tweak value is calculated from the disk > position of the plaintext block and and the secondary key.
That's only partially correct. The tweak value _is_ the location on disk. The value which is XORed twice is computed from the tweak and the secondary key. In LRW, you need a tweak value per block. So, if you encode 256 blocks, you need 256 tweaks. That's what the additional scatterlist is for.
> It would be useful to see the original patch (which seems to be > unavailable now), with dm-crypt integration, to see how the entire > mechanism works beyond the test vectors.
Frankly, I don't see a point escalating this discussion. It must be possible to process more than 2 mappings in softirq context. If not, I feel emotionally offended. -- Fruhwirth Clemens <clemens@endorphin.org> http://clemens.endorphin.org [unhandled content-type:application/pgp-signature] | |