From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC8C6CDB483 for ; Tue, 17 Oct 2023 05:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234276AbjJQFUh (ORCPT ); Tue, 17 Oct 2023 01:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjJQFUg (ORCPT ); Tue, 17 Oct 2023 01:20:36 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65951A2; Mon, 16 Oct 2023 22:20:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB774C433C7; Tue, 17 Oct 2023 05:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697520035; bh=EN8UTTtNUR9NGvJgHNEIP2VQzznAFZZ16jnJFPy09Xw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rkew1ESvq+SpaJvC7VUG27cP/dpfeMOefWyylOS+wXeSTITqhuhwe+D1mT73xh/mL 0cqLO0885YILbTFRcQUo8n12nsBVQwDS7g6JfggW3HFkXqJgdGgV9CZxhCbKJ2sHxn +wWab0SRazuac3x9l8rswPTWGIQnIfBSNgiGrcT8SbqgfSYDUO8eJZh4qw5tZbO7IV 1ZpioaQR0hYtz2fgh22IHcww53zghTKvjB1qHqL6CeMkniNdExaKXuxwdCPL3IMqfz AKkDN+JqmI8w1EPmXtvv2LXioJrsVZdK6X7X6VB07fX2JxI4enKH7LX+dL+jKvVNdH z93GTh2/9HR2w== Date: Mon, 16 Oct 2023 22:20:33 -0700 From: Eric Biggers To: Josef Bacik Cc: fstests@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org, Sweet Tea Dorminy Subject: Re: [PATCH 01/12] common/encrypt: separate data and inode nonces Message-ID: <20231017052033.GE1907@sol.localdomain> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, Oct 10, 2023 at 04:25:54PM -0400, Josef Bacik wrote: > From: Sweet Tea Dorminy > > btrfs will have different inode and data nonces, so we need to be > specific about which nonce each use needs. For now, there is no > difference in the two functions. > > Signed-off-by: Sweet Tea Dorminy > --- > common/encrypt | 33 ++++++++++++++++++++++++++------- > tests/f2fs/002 | 2 +- > tests/generic/613 | 4 ++-- > 3 files changed, 29 insertions(+), 10 deletions(-) > > diff --git a/common/encrypt b/common/encrypt > index 1a77e23b..04b6e5ac 100644 > --- a/common/encrypt > +++ b/common/encrypt > @@ -488,7 +488,7 @@ _add_fscrypt_provisioning_key() > # Retrieve the encryption nonce of the given inode as a hex string. The nonce > # was randomly generated by the filesystem and isn't exposed directly to > # userspace. But it can be read using the filesystem's debugging tools. > -_get_encryption_nonce() > +_get_encryption_file_nonce() > { > local device=$1 > local inode=$2 > @@ -532,15 +532,34 @@ _get_encryption_nonce() > }' > ;; > *) > - _fail "_get_encryption_nonce() isn't implemented on $FSTYP" > + _fail "_get_encryption_file_nonce() isn't implemented on $FSTYP" > ;; > esac > } > > -# Require support for _get_encryption_nonce() > +# Retrieve the encryption nonce used to encrypt the data of the given inode as > +# a hex string. The nonce was randomly generated by the filesystem and isn't > +# exposed directly to userspace. But it can be read using the filesystem's > +# debugging tools. > +_get_encryption_data_nonce() > +{ > + local device=$1 > + local inode=$2 > + > + case $FSTYP in > + ext4|f2fs) > + _get_encryption_file_nonce $device $inode > + ;; > + *) > + _fail "_get_encryption_data_nonce() isn't implemented on $FSTYP" > + ;; > + esac > +} Shouldn't this be _get_encryption_extent_nonce(), taking the offset of the extent as a parameter? Also I think it would sound better as _get_extent_encryption_nonce(), and likewise _get_file_encryption_nonce(). - Eric