fscrypt: invoke crypto API for ESSIV handling
authorEric Biggers <ebiggers@google.com>
Wed, 9 Oct 2019 23:34:16 +0000 (16:34 -0700)
committerEric Biggers <ebiggers@google.com>
Mon, 21 Oct 2019 20:22:08 +0000 (13:22 -0700)
commit4006d799d93b159fd834c50999265b5c534a71d5
tree7f28f0fc26f9b5145dec54ffd8ca1af2a3589453
parent7d194c2100ad2a6dded545887d02754948ca5241
fscrypt: invoke crypto API for ESSIV handling

Instead of open-coding the calculations for ESSIV handling, use an ESSIV
skcipher which does all of this under the hood.  ESSIV was added to the
crypto API in v5.4.

This is based on a patch from Ard Biesheuvel, but reworked to apply
after all the fscrypt changes that went into v5.4.

Tested with 'kvm-xfstests -c ext4,f2fs -g encrypt', including the
ciphertext verification tests for v1 and v2 encryption policies.

Originally-from: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Documentation/filesystems/fscrypt.rst
fs/crypto/crypto.c
fs/crypto/fscrypt_private.h
fs/crypto/keysetup.c
fs/crypto/keysetup_v1.c