[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YMLJjT97wHh4XJiZ@sol.localdomain>
Date: Thu, 10 Jun 2021 19:25:17 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: linux-fscrypt@...r.kernel.org
Cc: linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
Daniel Rosenberg <drosen@...gle.com>, stable@...r.kernel.org
Subject: Re: [PATCH v2] fscrypt: fix derivation of SipHash keys on big endian
CPUs
On Sat, Jun 05, 2021 at 12:50:33AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
>
> Typically, the cryptographic APIs that fscrypt uses take keys as byte
> arrays, which avoids endianness issues. However, siphash_key_t is an
> exception. It is defined as 'u64 key[2];', i.e. the 128-bit key is
> expected to be given directly as two 64-bit words in CPU endianness.
>
> fscrypt_derive_dirhash_key() and fscrypt_setup_iv_ino_lblk_32_key()
> forgot to take this into account. Therefore, the SipHash keys used to
> index encrypted+casefolded directories differ on big endian vs. little
> endian platforms, as do the SipHash keys used to hash inode numbers for
> IV_INO_LBLK_32-encrypted directories. This makes such directories
> non-portable between these platforms.
>
> Fix this by always using the little endian order. This is a breaking
> change for big endian platforms, but this should be fine in practice
> since these features (encrypt+casefold support, and the IV_INO_LBLK_32
> flag) aren't known to actually be used on any big endian platforms yet.
>
> Fixes: aa408f835d02 ("fscrypt: derive dirhash key for casefolded directories")
> Fixes: e3b1078bedd3 ("fscrypt: add support for IV_INO_LBLK_32 policies")
> Cc: <stable@...r.kernel.org> # v5.6+
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
> ---
>
> v2: Fixed fscrypt_setup_iv_ino_lblk_32_key() too, not just
> fscrypt_derive_dirhash_key().
>
> fs/crypto/keysetup.c | 40 ++++++++++++++++++++++++++++++++--------
> 1 file changed, 32 insertions(+), 8 deletions(-)
>
Applied to fscrypt.git#master for 5.14.
- Eric
Powered by blists - more mailing lists