Re: [PATCH 05/29] fscrypt: Let fs select encryption index/tweak

From: Eric Biggers
Date: Sun Nov 27 2016 - 02:00:19 EST


On Thu, Nov 24, 2016 at 04:57:51PM +0100, David Gstir wrote:
>
> > Also, if the intent is just that the 'index' represent the data's offset in
> > filesystem blocks rather than in pages, then perhaps it should be documented as
> > such. (This would be correct for ext4 and f2fs; they just happen to only
> > support encryption with block_size = PAGE_SIZE currently.)
>
> Yes, in case of UBIFS it is exactly that.
>
> However, I'm actually not really happy with the name 'index'. I'd rather call it 'iv' (or 'tweak') directly. In the context of encryption its purpose will be more obvious, especially in regard to the "IV _must_ not be reused" constraint you mentioned above.
>

Well, the way I'd prefer to think about it is that the filesystem does not
provide an IV directly (it doesn't anyway, since the actual IV is a u8[16]), but
rather the number of the logical block of the file, like 'u64 lblk_num'. And
that is sufficient to avoid IV reuse.

Eric