Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3416485ybk; Tue, 19 May 2020 04:14:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqP+O1aayaxb9gdV5RSVNqRAKLqz6u2QybErNArCb4ijrK1DV8GN1eUMnzx5hBSUUjuk9K X-Received: by 2002:a50:fd83:: with SMTP id o3mr3771047edt.329.1589886861562; Tue, 19 May 2020 04:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589886861; cv=none; d=google.com; s=arc-20160816; b=X533aJJOxrxNG6FTeFQg7lTeUCiqZjRY388fjV7OaDB6qE27qIRX0KfUt/ljS1gVJu 2Nfk4YwV6F+Utek4Sr32hgI1zghcU+a/Un9cPO0nwgcmzz1yCIObxac/6glAiyZk64GY PWiYVNAPt0ANybf8AqukM+Xt34AQowpiwoWDo31s/Zz84m08mp4MFNG7ixJMfjMEpCHU gi7P6SepVL+0CpjDTtnZUrhGbbxDZBFtP5VEdbVUBP9yHki7fKq8pNLUZ1rzNSGr3GTz s4OYz2Iog8f/SZGsb01IIIUFlcl0vNFuQBpsoSuy/COmwzaUr9CCQJP7lJI/FbCh3/4b Sctw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eZ3BL18EyYjbz6lR6beZ2UCVFCt/tIvIP7u9i4MADmg=; b=VDUxIauNITiN0+zgAbQ/1v0UzoxY5fqqtM+eC5lV6PdFHHXcMJDLuetP51iI2oyG0h EjQp821vK5rtel4HXCgu8xpCmoNyKxPB4gLh1enqvjSbm0FycdCxG/en/WhFhhpFPz9x dX1DuemHpjojv/gh/1cDKLFRxEkzOdKUK92daFpFgzbIn0n8PW9qWlGb5+8zKg/pDb5q 2e+fxo80U7xbvsJzCt98eQ8f280GadKVW7HAwSYTzExEgPbHx5T9jt7Q4cWfhqCUtq/W Ob+8rSPnzGUxrlXMKkjUvT5uFUVvdgUtEguN5Fw05YJ3zXSOPytQko+2teNlFAmJ362G DM4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ov7si8240281ejb.409.2020.05.19.04.13.49; Tue, 19 May 2020 04:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgESLNn (ORCPT + 99 others); Tue, 19 May 2020 07:13:43 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:49137 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726505AbgESLNm (ORCPT ); Tue, 19 May 2020 07:13:42 -0400 Received: from callcc.thunk.org (pool-100-0-195-244.bstnma.fios.verizon.net [100.0.195.244]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 04JBDLpS006587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 May 2020 07:13:22 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 5513F420304; Tue, 19 May 2020 07:13:21 -0400 (EDT) Date: Tue, 19 May 2020 07:13:21 -0400 From: "Theodore Y. Ts'o" To: Eric Biggers Cc: linux-fscrypt@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mmc@vger.kernel.org, Satya Tangirala , Jaegeuk Kim , Paul Crowley Subject: Re: [PATCH] fscrypt: add support for IV_INO_LBLK_32 policies Message-ID: <20200519111321.GE2396055@mit.edu> References: <20200515204141.251098-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515204141.251098-1-ebiggers@kernel.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, May 15, 2020 at 01:41:41PM -0700, Eric Biggers wrote: > From: Eric Biggers > > The eMMC inline crypto standard will only specify 32 DUN bits (a.k.a. IV > bits), unlike UFS's 64. IV_INO_LBLK_64 is therefore not applicable, but > an encryption format which uses one key per policy and permits the > moving of encrypted file contents (as f2fs's garbage collector requires) > is still desirable. > > To support such hardware, add a new encryption format IV_INO_LBLK_32 > that makes the best use of the 32 bits: the IV is set to > 'SipHash-2-4(inode_number) + file_logical_block_number mod 2^32', where > the SipHash key is derived from the fscrypt master key. We hash only > the inode number and not also the block number, because we need to > maintain contiguity of DUNs to merge bios. > > Unlike with IV_INO_LBLK_64, with this format IV reuse is possible; this > is unavoidable given the size of the DUN. This means this format should > only be used where the requirements of the first paragraph apply. > However, the hash spreads out the IVs in the whole usable range, and the > use of a keyed hash makes it difficult for an attacker to determine > which files use which IVs. > > Besides the above differences, this flag works like IV_INO_LBLK_64 in > that on ext4 it is only allowed if the stable_inodes feature has been > enabled to prevent inode numbers and the filesystem UUID from changing. > > Signed-off-by: Eric Biggers Reviewed-by: Theodore Ts'o I kind of wish we had Kunit tests with test vectors, but that's for another commit I think. - Ted