mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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/[email protected] Reviewed-by: Theodore Ts'o <[email protected]> Signed-off-by: Eric Biggers <[email protected]>
This commit is contained in:
parent
e8a1b83895
commit
cc53008ea6
6 changed files with 60 additions and 15 deletions
|
|
@ -633,6 +633,17 @@ from a passphrase or other low-entropy user credential.
|
|||
FS_IOC_GET_ENCRYPTION_PWSALT is deprecated. Instead, prefer to
|
||||
generate and manage any needed salt(s) in userspace.
|
||||
|
||||
Getting a file's encryption nonce
|
||||
---------------------------------
|
||||
|
||||
Since Linux v5.7, the ioctl FS_IOC_GET_ENCRYPTION_NONCE is supported.
|
||||
On encrypted files and directories it gets the inode's 16-byte nonce.
|
||||
On unencrypted files and directories, it fails with ENODATA.
|
||||
|
||||
This ioctl can be useful for automated tests which verify that the
|
||||
encryption is being done correctly. It is not needed for normal use
|
||||
of fscrypt.
|
||||
|
||||
Adding keys
|
||||
-----------
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue