summaryrefslogtreecommitdiff
path: root/include/uapi
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-03-14 13:50:49 -0700
committerEric Biggers <ebiggers@google.com>2020-04-01 09:49:08 -0700
commite9c80bd9a5a68801d02623a28406e2449a904a5e (patch)
tree90b653b9a8fcbe275e064564797612a73056c165 /include/uapi
parentc1a6370ee684266c191d773106bcd9895ed7e555 (diff)
UPSTREAM: fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl
Add an ioctl FS_IOC_GET_ENCRYPTION_NONCE which retrieves the nonce from an encrypted file or directory. The nonce is the 16-byte random value stored in the inode's encryption xattr. It is normally used together with the master key to derive the inode's actual encryption key. The nonces are needed by automated tests that verify the correctness of the ciphertext on-disk. Except for the IV_INO_LBLK_64 case, there's no way to replicate a file's ciphertext without knowing that file's nonce. The nonces aren't secret, and the existing ciphertext verification tests in xfstests retrieve them from disk using debugfs or dump.f2fs. But in environments that lack these debugging tools, getting the nonces by manually parsing the filesystem structure would be very hard. To make this important type of testing much easier, let's just add an ioctl that retrieves the nonce. Link: https://lore.kernel.org/r/20200314205052.93294-2-ebiggers@kernel.org Reviewed-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit e98ad464750c0894bc560d10503dae8ff90ccdac) Bug: 151100202 Change-Id: Ieef2c57b9257ae38eb2e5c1a018ca6f325bb62dd Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/fscrypt.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/fscrypt.h b/include/uapi/linux/fscrypt.h
index 0c9a8b81d357..320a6381576e 100644
--- a/include/uapi/linux/fscrypt.h
+++ b/include/uapi/linux/fscrypt.h
@@ -166,6 +166,7 @@ struct fscrypt_get_key_status_arg {
#define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
#define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
#define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
+#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
/**********************************************************************/