]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic: add tests for fscrypt policies with HCTR2
authorNathan Huckleberry <nhuck@google.com>
Wed, 3 Aug 2022 22:41:21 +0000 (15:41 -0700)
committerZorro Lang <zlang@kernel.org>
Fri, 5 Aug 2022 16:57:22 +0000 (00:57 +0800)
This patch adds fscrypt policy tests for filename encryption using
HCTR2.

More information on HCTR2 can be found here: "Length-preserving
encryption with HCTR2" https://ia.cr/2021/1441

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

diff --git a/tests/generic/693 b/tests/generic/693
new file mode 100755 (executable)
index 0000000..1596865
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+#
+# FS QA Test No. 693
+#
+# Verify ciphertext for v2 encryption policies that use AES-256-XTS to encrypt
+# file contents and AES-256-HCTR2 to encrypt file names.
+#
+# HCTR2 was introduced in kernel commit 6b2a51ff03bf ("fscrypt: Add HCTR2
+# support for filename encryption")
+#
+. ./common/preamble
+_begin_fstest auto quick encrypt
+
+# Import common functions.
+. ./common/filter
+. ./common/encrypt
+
+# real QA test starts here
+_supported_fs generic
+
+_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 v2
+_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 \
+       v2 iv_ino_lblk_32
+_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 \
+       v2 iv_ino_lblk_64
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/693.out b/tests/generic/693.out
new file mode 100644 (file)
index 0000000..91ff7f2
--- /dev/null
@@ -0,0 +1,16 @@
+QA output created by 693
+
+Verifying ciphertext with parameters:
+       contents_encryption_mode: AES-256-XTS
+       filenames_encryption_mode: AES-256-HCTR2
+       options: v2
+
+Verifying ciphertext with parameters:
+       contents_encryption_mode: AES-256-XTS
+       filenames_encryption_mode: AES-256-HCTR2
+       options: v2 iv_ino_lblk_32
+
+Verifying ciphertext with parameters:
+       contents_encryption_mode: AES-256-XTS
+       filenames_encryption_mode: AES-256-HCTR2
+       options: v2 iv_ino_lblk_64