mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
0ea2b67b09
Add a test which tests adding a key to a filesystem's fscrypt keyring
via an "fscrypt-provisioning" keyring key. This is an alternative to
the normal method where the raw key is given directly.
For more details, see kernel commit 93edd392cad7 ("fscrypt: support
passing a keyring key to FS_IOC_ADD_ENCRYPTION_KEY").
This test depends on an xfs_io patch which adds the '-k' option to the
'add_enckey' command, e.g.:
xfs_io -c "add_enckey -k KEY_ID" MOUNTPOINT
This test is skipped if the needed kernel or xfs_io support is absent.
This has been tested on ext4, f2fs, and ubifs.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
74 lines
1.9 KiB
Plaintext
74 lines
1.9 KiB
Plaintext
QA output created by 593
|
|
|
|
# ==========================
|
|
# Test with policy version 1
|
|
# ==========================
|
|
|
|
# Adding key to filesystem
|
|
Added encryption key with descriptor 0000111122223333
|
|
|
|
# Creating encrypted file
|
|
|
|
# Removing key from filesystem
|
|
Removed encryption key with descriptor 0000111122223333
|
|
cat: SCRATCH_MNT/dir/file: No such file or directory
|
|
|
|
# Adding fscrypt-provisioning key
|
|
|
|
# Adding key to filesystem via fscrypt-provisioning key
|
|
Added encryption key with descriptor 0000111122223333
|
|
|
|
# Reading encrypted file
|
|
contents
|
|
|
|
# Cleaning up
|
|
|
|
# ==========================
|
|
# Test with policy version 2
|
|
# ==========================
|
|
|
|
# Adding key to filesystem
|
|
Added encryption key with identifier 69b2f6edeee720cce0577937eb8a6751
|
|
|
|
# Creating encrypted file
|
|
|
|
# Removing key from filesystem
|
|
Removed encryption key with identifier 69b2f6edeee720cce0577937eb8a6751
|
|
cat: SCRATCH_MNT/dir/file: No such file or directory
|
|
|
|
# Adding fscrypt-provisioning key
|
|
|
|
# Adding key to filesystem via fscrypt-provisioning key
|
|
Added encryption key with identifier 69b2f6edeee720cce0577937eb8a6751
|
|
|
|
# Reading encrypted file
|
|
contents
|
|
|
|
# Cleaning up
|
|
|
|
# ================
|
|
# Validation tests
|
|
# ================
|
|
|
|
# Adding an invalid fscrypt-provisioning key fails
|
|
# ... bad type
|
|
add_key: Invalid argument
|
|
# ... bad type
|
|
add_key: Invalid argument
|
|
# ... raw key too small
|
|
add_key: Invalid argument
|
|
# ... raw key too large
|
|
add_key: Invalid argument
|
|
|
|
# keyctl_read() doesn't work on fscrypt-provisioning keys
|
|
keyctl_read_alloc: Operation not supported
|
|
|
|
# Only keys with the correct fscrypt_provisioning_key_payload::type field can be added
|
|
# ... keyring key is v1, filesystem wants v2 key
|
|
Error adding encryption key: Key was rejected by service
|
|
# ... keyring key is v2, filesystem wants v1 key
|
|
Error adding encryption key: Key was rejected by service
|
|
|
|
# Only keys of type fscrypt-provisioning can be added
|
|
Error adding encryption key: Key was rejected by service
|