Skip to content

Commit b7e072f

Browse files
committed
fscrypt: improve a few comments
Improve a few comments. These were extracted from the patch "fscrypt: add support for hardware-wrapped keys" (https://lore.kernel.org/r/[email protected]). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 7f595d6 commit b7e072f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

fs/crypto/fscrypt_private.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
#define FSCRYPT_FILE_NONCE_SIZE 16
2222

23+
/*
24+
* Minimum size of an fscrypt master key. Note: a longer key will be required
25+
* if ciphers with a 256-bit security strength are used. This is just the
26+
* absolute minimum, which applies when only 128-bit encryption is used.
27+
*/
2328
#define FSCRYPT_MIN_KEY_SIZE 16
2429

2530
#define FSCRYPT_CONTEXT_V1 1
@@ -413,7 +418,11 @@ struct fscrypt_master_key_secret {
413418
*/
414419
struct fscrypt_hkdf hkdf;
415420

416-
/* Size of the raw key in bytes. Set even if ->raw isn't set. */
421+
/*
422+
* Size of the raw key in bytes. This remains set even if ->raw was
423+
* zeroized due to no longer being needed. I.e. we still remember the
424+
* size of the key even if we don't need to remember the key itself.
425+
*/
417426
u32 size;
418427

419428
/* For v1 policy keys: the raw key. Wiped for v2 policy keys. */

fs/crypto/keysetup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key,
122122

123123
/*
124124
* Prepare the crypto transform object or blk-crypto key in @prep_key, given the
125-
* raw key, encryption mode, and flag indicating which encryption implementation
126-
* (fs-layer or blk-crypto) will be used.
125+
* raw key, encryption mode (@ci->ci_mode), flag indicating which encryption
126+
* implementation (fs-layer or blk-crypto) will be used (@ci->ci_inlinecrypt),
127+
* and IV generation method (@ci->ci_policy.flags).
127128
*/
128129
int fscrypt_prepare_key(struct fscrypt_prepared_key *prep_key,
129130
const u8 *raw_key, const struct fscrypt_info *ci)

0 commit comments

Comments
 (0)