All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Theodore Y . Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>
Subject: Re: [PATCH] fscrypt: use AES library for v1 key derivation
Date: Wed, 25 Mar 2026 12:09:19 -0700	[thread overview]
Message-ID: <20260325190919.GA2305@quark> (raw)
In-Reply-To: <20260321075338.99809-1-ebiggers@kernel.org>

On Sat, Mar 21, 2026 at 12:53:38AM -0700, Eric Biggers wrote:
> Convert the implementation of the v1 (original / deprecated) fscrypt
> per-file key derivation algorithm to use the AES library instead of an
> "ecb(aes)" crypto_skcipher.  This is much simpler.
> 
> While the AES library doesn't support AES-ECB directly yet, we can still
> simply call aes_encrypt() in a loop.  While that doesn't explicitly
> parallelize the AES encryptions, it doesn't really matter in this case,
> where a new key is used each time and only 16 to 64 bytes are encrypted.
> 
> In fact, a quick benchmark (AMD Ryzen 9 9950X) shows that this commit
> actually greatly improves performance, from ~7000 cycles per key derived
> to ~1500.  The times don't differ much between 32 bytes and 64 bytes
> either, so clearly the bottleneck is API stuff and key expansion.
> 
> Granted, performance of the v1 key derivation is no longer very
> relevant: most users have moved onto v2 encryption policies.  The v2 key
> derivation uses HKDF-SHA512 (which is ~3500 cycles on the same CPU).
> 
> Still, it's nice that the simpler solution is much faster as well.
> 
> Compatibility verified with xfstests generic/548.
> 
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> 
> This patch is targeting fscrypt/for-next
> 
>  fs/crypto/Kconfig       |  2 +-
>  fs/crypto/keysetup_v1.c | 87 +++++++++++++----------------------------
>  2 files changed, 29 insertions(+), 60 deletions(-)

Applied to https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=for-next

- Eric

      reply	other threads:[~2026-03-25 19:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  7:53 [PATCH] fscrypt: use AES library for v1 key derivation Eric Biggers
2026-03-25 19:09 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260325190919.GA2305@quark \
    --to=ebiggers@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.