fscrypto: make XTS tweak initialization endian-independent
authorEric Biggers <ebiggers@google.com>
Thu, 13 Oct 2016 03:30:16 +0000 (23:30 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Oct 2016 07:45:30 +0000 (03:45 -0400)
commit8b722a45b3e2cc10dee3bb96e4fae0b2267607ce
tree6967081d148d885119e03f04577c9f2a544e6b4d
parent628ab14b21e2f2114d0509fe9abe27abb2630f91
fscrypto: make XTS tweak initialization endian-independent

commit fb4454376df9d820d95452d71dd83da6971f9338 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/crypto/crypto.c