diff options
author | Eric Biggers <ebiggers@google.com> | 2023-11-21 14:39:09 -0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2024-01-14 21:08:53 +0800 |
commit | c46ca4d1f6c0c45f9a3ea18bc31ba5ae89e02c70 (patch) | |
tree | b00f2d9d3ef1f0c6e63167cccdd4e3f75313dd1e | |
parent | 077698f5211d4b237de752655e0a2ff3d55d7fa0 (diff) |
generic: add test for custom crypto data unit sizev2024.01.14
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.
[zlang: add _wants_kernel_commit]
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-x | tests/generic/739 | 31 | ||||
-rw-r--r-- | tests/generic/739.out | 11 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/generic/739 b/tests/generic/739 new file mode 100755 index 00000000..0941dd31 --- /dev/null +++ b/tests/generic/739 @@ -0,0 +1,31 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2023 Google LLC +# +# FS QA Test No. 739 +# +# 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 +_wants_kernel_commit 5b1188847180 \ + "fscrypt: support crypto data unit size less than filesystem block size" + +# 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/739.out b/tests/generic/739.out new file mode 100644 index 00000000..00666050 --- /dev/null +++ b/tests/generic/739.out @@ -0,0 +1,11 @@ +QA output created by 739 + +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 |