aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-05-01 14:43:32 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-05-04 11:44:41 -0400
commit6f9d696f016f5b42f6c6e8c9f723f8d3380e5903 (patch)
treec7eef0e01504b1514d9c389d1101757737845f9a
parent90fce086ed59caefa457dffd587b00caeab9116d (diff)
fscrypt: correct collision claim for digested names
As I noted on the mailing list, it's easier than I originally thought to create intentional collisions in the digested names. Unfortunately it's not too easy to solve this, so for now just fix the comment to not lie. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--include/linux/fscrypt_supp.h22
1 files changed, 9 insertions, 13 deletions
diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h
index e12c224a0d1e..cd4e82c17304 100644
--- a/include/linux/fscrypt_supp.h
+++ b/include/linux/fscrypt_supp.h
@@ -81,20 +81,16 @@ extern int fscrypt_fname_usr_to_disk(struct inode *, const struct qstr *,
81 * followed by the second-to-last ciphertext block of the filename. Due to the 81 * followed by the second-to-last ciphertext block of the filename. Due to the
82 * use of the CBC-CTS encryption mode, the second-to-last ciphertext block 82 * use of the CBC-CTS encryption mode, the second-to-last ciphertext block
83 * depends on the full plaintext. (Note that ciphertext stealing causes the 83 * depends on the full plaintext. (Note that ciphertext stealing causes the
84 * last two blocks to appear "flipped".) This makes collisions very unlikely: 84 * last two blocks to appear "flipped".) This makes accidental collisions very
85 * just a 1 in 2^128 chance for two filenames to collide even if they share the 85 * unlikely: just a 1 in 2^128 chance for two filenames to collide even if they
86 * same filesystem-specific hashes. 86 * share the same filesystem-specific hashes.
87 * 87 *
88 * This scheme isn't strictly immune to intentional collisions because it's 88 * However, this scheme isn't immune to intentional collisions, which can be
89 * basically like a CBC-MAC, which isn't secure on variable-length inputs. 89 * created by anyone able to create arbitrary plaintext filenames and view them
90 * However, generating a CBC-MAC collision requires the ability to choose 90 * without the key. Making the "digest" be a real cryptographic hash like
91 * arbitrary ciphertext, which won't normally be possible with filename 91 * SHA-256 over the full ciphertext would prevent this, although it would be
92 * encryption since it would require write access to the raw disk. 92 * less efficient and harder to implement, especially since the filesystem would
93 * 93 * need to calculate it for each directory entry examined during a search.
94 * Taking a real cryptographic hash like SHA-256 over the full ciphertext would
95 * be better in theory but would be less efficient and more complicated to
96 * implement, especially since the filesystem would need to calculate it for
97 * each directory entry examined during a search.
98 */ 94 */
99struct fscrypt_digested_name { 95struct fscrypt_digested_name {
100 u32 hash; 96 u32 hash;