Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp715123rdf; Tue, 21 Nov 2023 14:39:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEipb11n6l2xJfJudR42eFZr/JTMY70NWl49QWKARHYnd+xAcoOHWFZSdfeW81AarVowHWC X-Received: by 2002:a05:620a:371c:b0:778:8f26:6846 with SMTP id de28-20020a05620a371c00b007788f266846mr5936046qkb.37.1700606392394; Tue, 21 Nov 2023 14:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700606392; cv=none; d=google.com; s=arc-20160816; b=v8YDtNkXXbw9HKjyQ1YAeKLhl3CrWZaMSR0wx6DbxUq3gPFEvMCq94B2s4y37iX9ov 5QauLy8IdEjgoGpX0Rvpr50mbKC4SIonJLdy2yw3eryiS1WNPPpTATchsTzTVRunCJSE 1mT9FbOjUuENbKb/6KGwFRhKgnzc9CN55qOBi8VDPO8Ly6awYIwxdElOjMkbdz2GlmFf c+DlXWQwjdLmjJQhSMDXxfnClCtiS9oViYegVSP5RxYQXY5P4rQmhXTE/5olIF0XkB+C hPW32/4kTbTeO796g+ErYQdmny4gnajxT6XAUHQA0KTACYq8LprmR/NqJ0qp+k2JhGwq iVKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mqLFPZR1LPtWg/nVwC6DAX3Nhoma2+TW04u1JpDE9lQ=; fh=gvial6qLvcAsOAQbq5rZqsZzavosyo15VQ19VqtaZLk=; b=rGfLCtWj6noJkZdbG8VP0JvRpsrDEbQxzwPx+TATLfMpGyPe+fg9n1u2WVnIw3TE8W acC3nrdrlhooY4SRMUTyeBGRyXDc6eDLxzByd0FGXWzoPS18TBlX2qBuFr7EQnj6lwU3 XM0SPuCBVHI8jD7Dvm9G6mBmxBOfIHuAdgbNiMXbj7Q4eykZ5+Xv+od+7tEXSz2DHbne fzk44nikF1N998OJlf05ppRGZe+Nt8nldtCwcXX55OZkeqen0g8qjbaZTq5j8VlQlw8g WRUdrSAO0lhYd69g0CRhOhmy1ypqwbzhs/dvdyzP6NtRZ4Ge5lttwPbrnv29XNoQjxSZ B0NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OZWBWzwc; spf=pass (google.com: domain of linux-ext4+bounces-73-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-73-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bb32-20020a05622a1b2000b004236df1a455si2673716qtb.41.2023.11.21.14.39.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:39:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-73-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OZWBWzwc; spf=pass (google.com: domain of linux-ext4+bounces-73-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-73-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 29D331C20F48 for ; Tue, 21 Nov 2023 22:39:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 247625647C; Tue, 21 Nov 2023 22:39:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OZWBWzwc" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83B0D5812C; Tue, 21 Nov 2023 22:39:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE78CC4339A; Tue, 21 Nov 2023 22:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700606377; bh=umCuFGN2fvdZ+2kf5o7EsnbD7X97WCaVkuR4lIaN3mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OZWBWzwcrEm26xDQ8TxD0Pk8ybINPhnrBWu3ilH4q/c+4hP8SkZv/XzEMw3pTYdj8 PGIeuI/gcG5SMi85/TUma9ccqq/teob0v8p9dfIfP8a4UgUKXDdtdJmWcZUPmFjFGS UGGYugXbAhTRLnxpo/Tf/rj/f1K+oc2B6DBm7WykpaSFfnwobc9MGTyAOuZGkSF3nF JSe26wy0TrSB9f0lRIr6JjfuZO5h8sSi7DCxF42QpoC9I0EzshGrsUUrqTaIizjq0E hJMiCf9Mh9v0Sq0AGbkDWH10rosJt8ZPyqgnCOaoTLmJB6BSGfK0ftt2vuuaIui76T P9myy1fNhtYXA== From: Eric Biggers To: fstests@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Daniel Rosenberg Subject: [PATCH v2 4/4] generic: add test for custom crypto data unit size Date: Tue, 21 Nov 2023 14:39:09 -0800 Message-ID: <20231121223909.4617-5-ebiggers@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231121223909.4617-1-ebiggers@kernel.org> References: <20231121223909.4617-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Eric Biggers Add a test that verifies the on-disk format of encrypted files that use a crypto data unit size that differs from the filesystem block size. This tests the functionality that was introduced in Linux 6.7 by kernel commit 5b1188847180 ("fscrypt: support crypto data unit size less than filesystem block size"). This depends on the xfsprogs patch "xfs_io/encrypt: support specifying crypto data unit size" (https://lore.kernel.org/r/20231013062639.141468-1-ebiggers@kernel.org) which adds the '-s' option to the set_encpolicy command of xfs_io. As usual, the test skips itself when any prerequisite isn't met. Signed-off-by: Eric Biggers --- tests/generic/900 | 29 +++++++++++++++++++++++++++++ tests/generic/900.out | 11 +++++++++++ 2 files changed, 40 insertions(+) create mode 100755 tests/generic/900 create mode 100644 tests/generic/900.out diff --git a/tests/generic/900 b/tests/generic/900 new file mode 100755 index 00000000..8d1b5766 --- /dev/null +++ b/tests/generic/900 @@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2023 Google LLC +# +# FS QA Test No. generic/900 +# +# Verify the on-disk format of encrypted files that use a crypto data unit size +# that differs from the filesystem block size. This tests the functionality +# that was introduced in Linux 6.7 by kernel commit 5b1188847180 +# ("fscrypt: support crypto data unit size less than filesystem block size"). +# +. ./common/preamble +_begin_fstest auto quick encrypt + +. ./common/filter +. ./common/encrypt + +_supported_fs generic + +# For now, just test 512-byte and 1024-byte data units. Filesystems accept +# power-of-2 sizes between 512 and the filesystem block size, inclusively. +# Testing 512 and 1024 ensures this test will run for any FS block size >= 1024 +# (provided that the filesystem supports sub-block data units at all). +_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-CTS-CBC v2 log2_dusize=9 +_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-CTS-CBC v2 log2_dusize=10 + +# success, all done +status=0 +exit diff --git a/tests/generic/900.out b/tests/generic/900.out new file mode 100644 index 00000000..3259f08c --- /dev/null +++ b/tests/generic/900.out @@ -0,0 +1,11 @@ +QA output created by 900 + +Verifying ciphertext with parameters: + contents_encryption_mode: AES-256-XTS + filenames_encryption_mode: AES-256-CTS-CBC + options: v2 log2_dusize=9 + +Verifying ciphertext with parameters: + contents_encryption_mode: AES-256-XTS + filenames_encryption_mode: AES-256-CTS-CBC + options: v2 log2_dusize=10 -- 2.42.1