diff options
author | Eric Biggers <ebiggers@google.com> | 2020-07-08 23:57:22 +0200 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2020-07-21 02:26:33 +0200 |
commit | 1d6217a4f9905917ee63315c8ea3d63833792f51 (patch) | |
tree | 37cb1e743e5ae2c7b9fb063dcea047492c13a668 /fs/crypto/keysetup.c | |
parent | fscrypt: add comments that describe the HKDF info strings (diff) | |
download | linux-1d6217a4f9905917ee63315c8ea3d63833792f51.tar.xz linux-1d6217a4f9905917ee63315c8ea3d63833792f51.zip |
fscrypt: rename FS_KEY_DERIVATION_NONCE_SIZE
The name "FS_KEY_DERIVATION_NONCE_SIZE" is a bit outdated since due to
the addition of FSCRYPT_POLICY_FLAG_DIRECT_KEY, the file nonce may now
be used as a tweak instead of for key derivation. Also, we're now
prefixing the fscrypt constants with "FSCRYPT_" instead of "FS_".
Therefore, rename this constant to FSCRYPT_FILE_NONCE_SIZE.
Link: https://lore.kernel.org/r/20200708215722.147154-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/crypto/keysetup.c')
-rw-r--r-- | fs/crypto/keysetup.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/crypto/keysetup.c b/fs/crypto/keysetup.c index 99d3e0d07fc6..22a94b18fe70 100644 --- a/fs/crypto/keysetup.c +++ b/fs/crypto/keysetup.c @@ -211,7 +211,7 @@ int fscrypt_derive_dirhash_key(struct fscrypt_info *ci, int err; err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, HKDF_CONTEXT_DIRHASH_KEY, - ci->ci_nonce, FS_KEY_DERIVATION_NONCE_SIZE, + ci->ci_nonce, FSCRYPT_FILE_NONCE_SIZE, (u8 *)&ci->ci_dirhash_key, sizeof(ci->ci_dirhash_key)); if (err) @@ -292,8 +292,7 @@ static int fscrypt_setup_v2_file_key(struct fscrypt_info *ci, err = fscrypt_hkdf_expand(&mk->mk_secret.hkdf, HKDF_CONTEXT_PER_FILE_ENC_KEY, - ci->ci_nonce, - FS_KEY_DERIVATION_NONCE_SIZE, + ci->ci_nonce, FSCRYPT_FILE_NONCE_SIZE, derived_key, ci->ci_mode->keysize); if (err) return err; @@ -498,7 +497,7 @@ int fscrypt_get_encryption_info(struct inode *inode) } memcpy(crypt_info->ci_nonce, fscrypt_context_nonce(&ctx), - FS_KEY_DERIVATION_NONCE_SIZE); + FSCRYPT_FILE_NONCE_SIZE); if (!fscrypt_supported_policy(&crypt_info->ci_policy, inode)) { res = -EINVAL; |