]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic: verify ciphertext with hardware-wrapped keys
authorEric Biggers <ebiggers@google.com>
Fri, 13 Dec 2024 05:28:39 +0000 (21:28 -0800)
committerZorro Lang <zlang@kernel.org>
Wed, 8 Jan 2025 11:11:16 +0000 (19:11 +0800)
Add two tests which verify that encrypted files are encrypted correctly
when a hardware-wrapped inline encryption key is used.  The two tests
are identical except that one uses FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64
and the other uses FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.  These cover both
of the settings where hardware-wrapped keys may be used.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/368 [new file with mode: 0755]
tests/generic/368.out [new file with mode: 0644]
tests/generic/369 [new file with mode: 0755]
tests/generic/369.out [new file with mode: 0644]

diff --git a/tests/generic/368 b/tests/generic/368
new file mode 100755 (executable)
index 0000000..38c149e
--- /dev/null
@@ -0,0 +1,24 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2024 Google LLC
+#
+# FS QA Test No. 368
+#
+# Verify the ciphertext for encryption policies that use a hardware-wrapped
+# inline encryption key, the IV_INO_LBLK_64 flag, and AES-256-XTS.
+#
+. ./common/preamble
+_begin_fstest auto quick encrypt
+
+. ./common/filter
+. ./common/encrypt
+
+# Hardware-wrapped keys require the inlinecrypt mount option.
+_require_scratch_inlinecrypt
+export MOUNT_OPTIONS="$MOUNT_OPTIONS -o inlinecrypt"
+
+_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-CTS-CBC \
+       v2 iv_ino_lblk_64 hw_wrapped_key
+
+status=0
+exit
diff --git a/tests/generic/368.out b/tests/generic/368.out
new file mode 100644 (file)
index 0000000..5041d28
--- /dev/null
@@ -0,0 +1,6 @@
+QA output created by 368
+
+Verifying ciphertext with parameters:
+       contents_encryption_mode: AES-256-XTS
+       filenames_encryption_mode: AES-256-CTS-CBC
+       options: v2 iv_ino_lblk_64 hw_wrapped_key
diff --git a/tests/generic/369 b/tests/generic/369
new file mode 100755 (executable)
index 0000000..f5b6d02
--- /dev/null
@@ -0,0 +1,24 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2024 Google LLC
+#
+# FS QA Test No. 369
+#
+# Verify the ciphertext for encryption policies that use a hardware-wrapped
+# inline encryption key, the IV_INO_LBLK_32 flag, and AES-256-XTS.
+#
+. ./common/preamble
+_begin_fstest auto quick encrypt
+
+. ./common/filter
+. ./common/encrypt
+
+# Hardware-wrapped keys require the inlinecrypt mount option.
+_require_scratch_inlinecrypt
+export MOUNT_OPTIONS="$MOUNT_OPTIONS -o inlinecrypt"
+
+_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-CTS-CBC \
+       v2 iv_ino_lblk_32 hw_wrapped_key
+
+status=0
+exit
diff --git a/tests/generic/369.out b/tests/generic/369.out
new file mode 100644 (file)
index 0000000..3dd14b8
--- /dev/null
@@ -0,0 +1,6 @@
+QA output created by 369
+
+Verifying ciphertext with parameters:
+       contents_encryption_mode: AES-256-XTS
+       filenames_encryption_mode: AES-256-CTS-CBC
+       options: v2 iv_ino_lblk_32 hw_wrapped_key