OSDN Git Service

fscrypto: make XTS tweak initialization endian-independent
authorEric Biggers <ebiggers@google.com>
Thu, 13 Oct 2016 03:30:16 +0000 (23:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 13 Oct 2016 03:30:16 +0000 (23:30 -0400)
commitfb4454376df9d820d95452d71dd83da6971f9338
treef2054e18f36c9968c8027097b16a4d9951fa37ba
parentc4704a4fbe834eee4109ca064131d440941f6235
fscrypto: make XTS tweak initialization endian-independent

The XTS tweak (or IV) was initialized differently on little endian and
big endian systems.  Because the ciphertext depends on the XTS tweak, it
was not possible to use an encrypted filesystem created by a little
endian system on a big endian system and vice versa, even if they shared
the same PAGE_SIZE.  Fix this by always using little endian.

This will break hypothetical big endian users of ext4 or f2fs
encryption.  However, all users we are aware of are little endian, and
it's believed that "real" big endian users are unlikely to exist yet.
So this might as well be fixed now before it's too late.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
fs/crypto/crypto.c