diff mbox series

[RFC,v2,2/2] generic: add tests for fscrypt policies with HCTR2

Message ID 20220505193809.579026-3-nhuck@google.com (mailing list archive)
State New, archived
Headers show
Series generic: test HCTR2 filename encryption | expand

Commit Message

Nathan Huckleberry May 5, 2022, 7:38 p.m. UTC
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>
---
 tests/generic/900     | 24 ++++++++++++++++++++++++
 tests/generic/900.out |  6 ++++++
 tests/generic/901     | 26 ++++++++++++++++++++++++++
 tests/generic/901.out |  6 ++++++
 tests/generic/902     | 26 ++++++++++++++++++++++++++
 tests/generic/902.out |  6 ++++++
 6 files changed, 94 insertions(+)
 create mode 100755 tests/generic/900
 create mode 100644 tests/generic/900.out
 create mode 100755 tests/generic/901
 create mode 100644 tests/generic/901.out
 create mode 100755 tests/generic/902
 create mode 100644 tests/generic/902.out

Comments

Dave Chinner May 5, 2022, 9:45 p.m. UTC | #1
On Thu, May 05, 2022 at 02:38:09PM -0500, Nathan Huckleberry wrote:
> 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

One test for all three verifications would be better - less tests to
run, less tests to maintain. Especially as these are effectively
one-line tests with a clear golden output which tells us exactly
which verification failed...

Cheers,

Dave.
diff mbox series

Patch

diff --git a/tests/generic/900 b/tests/generic/900
new file mode 100755
index 00000000..a3a9cead
--- /dev/null
+++ b/tests/generic/900
@@ -0,0 +1,24 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+#
+# FS QA Test No. generic/900
+#
+# Verify ciphertext for v2 encryption policies that use AES-256-XTS to encrypt
+# file contents and AES-256-HCTR2 to encrypt file names.
+#
+. ./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
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/900.out b/tests/generic/900.out
new file mode 100644
index 00000000..2e5d1b27
--- /dev/null
+++ b/tests/generic/900.out
@@ -0,0 +1,6 @@ 
+QA output created by 900
+
+Verifying ciphertext with parameters:
+	contents_encryption_mode: AES-256-XTS
+	filenames_encryption_mode: AES-256-HCTR2
+	options: v2
diff --git a/tests/generic/901 b/tests/generic/901
new file mode 100755
index 00000000..7fc63d8f
--- /dev/null
+++ b/tests/generic/901
@@ -0,0 +1,26 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+#
+# FS QA Test No. 901
+#
+# Verify ciphertext for v2 encryption policies that use the IV_INO_LBLK_32 flag
+# and use AES-256-XTS to encrypt file contents and AES-256-HCTR2 to encrypt
+# file names.
+#
+. ./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 iv_ino_lblk_32
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/901.out b/tests/generic/901.out
new file mode 100644
index 00000000..2a06addb
--- /dev/null
+++ b/tests/generic/901.out
@@ -0,0 +1,6 @@ 
+QA output created by 901
+
+Verifying ciphertext with parameters:
+	contents_encryption_mode: AES-256-XTS
+	filenames_encryption_mode: AES-256-HCTR2
+	options: v2 iv_ino_lblk_32
diff --git a/tests/generic/902 b/tests/generic/902
new file mode 100755
index 00000000..82863d87
--- /dev/null
+++ b/tests/generic/902
@@ -0,0 +1,26 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+#
+# FS QA Test No. 902
+#
+# Verify ciphertext for v2 encryption policies that use the IV_INO_LBLK_64 flag
+# and use AES-256-XTS to encrypt file contents and AES-256-HCTR2 to encrypt
+# file names.
+#
+. ./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 iv_ino_lblk_64
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/902.out b/tests/generic/902.out
new file mode 100644
index 00000000..41df9f99
--- /dev/null
+++ b/tests/generic/902.out
@@ -0,0 +1,6 @@ 
+QA output created by 902
+
+Verifying ciphertext with parameters:
+	contents_encryption_mode: AES-256-XTS
+	filenames_encryption_mode: AES-256-HCTR2
+	options: v2 iv_ino_lblk_64