common/encrypt: check that contents encryption is usable
[xfstests-dev.git] / common / encrypt
index 13098d7fd3e8596decabbb8b66c386060c4fff45..06a56ed92a7dd5cf37a5e5fad2da102dc3c2352f 100644 (file)
@@ -98,7 +98,9 @@ _require_encryption_policy_support()
        # without kernel crypto API support.  E.g. a policy using Adiantum
        # encryption can be set on a kernel without CONFIG_CRYPTO_ADIANTUM.
        # But actually trying to use such an encrypted directory will fail.
-       if ! touch $dir/file; then
+       # To reliably check for availability of both the contents and filenames
+       # encryption modes, try creating a nonempty file.
+       if ! echo foo > $dir/file; then
                _notrun "encryption policy '$set_encpolicy_args' is unusable; probably missing kernel crypto API support"
        fi
        $KEYCTL_PROG clear @s