aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Hansen <dave@linux.vnet.ibm.com>2009-08-27 12:47:07 -0400
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>2009-09-23 10:10:31 -0400
commit382684984e93039a3bbd83b04d341b0ceb831519 (patch)
tree039aa99f6651066a2aac7aec42b06da0a9b55402
parentaa06117f19944573cda0c4bee026c916b5256090 (diff)
ecryptfs: improved dependency checking and reporting
So, I compiled a 2.6.31-rc5 kernel with ecryptfs and loaded its module. When it came time to mount my filesystem, I got this in dmesg, and it refused to mount: [93577.776637] Unable to allocate crypto cipher with name [aes]; rc = [-2] [93577.783280] Error attempting to initialize key TFM cipher with name = [aes]; rc = [-2] [93577.791183] Error attempting to initialize cipher with name = [aes] and key size = [32]; rc = [-2] [93577.800113] Error parsing options; rc = [-22] I figured from the error message that I'd either forgotten to load "aes" or that my key size was bogus. Neither one of those was the case. In fact, I was missing the CRYPTO_ECB config option and the 'ecb' module. Unfortunately, there's no trace of 'ecb' in that error message. I've done two things to fix this. First, I've modified ecryptfs's Kconfig entry to select CRYPTO_ECB and CRYPTO_CBC. I also took CRYPTO out of the dependencies since the 'select' will take care of it for us. I've also modified the error messages to print a string that should contain both 'ecb' and 'aes' in my error case. That will give any future users a chance of finding the right modules and Kconfig options. I also wonder if we should: select CRYPTO_AES if !EMBEDDED since I think most ecryptfs users are using AES like me. Cc: ecryptfs-devel@lists.launchpad.net Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com> [tyhicks@linux.vnet.ibm.com: Removed extra newline, 80-char violation] Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
-rw-r--r--fs/ecryptfs/Kconfig4
-rw-r--r--fs/ecryptfs/crypto.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/ecryptfs/Kconfig b/fs/ecryptfs/Kconfig
index 0c754e64232b..8aadb99b7634 100644
--- a/fs/ecryptfs/Kconfig
+++ b/fs/ecryptfs/Kconfig
@@ -1,6 +1,8 @@
1config ECRYPT_FS 1config ECRYPT_FS
2 tristate "eCrypt filesystem layer support (EXPERIMENTAL)" 2 tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
3 depends on EXPERIMENTAL && KEYS && CRYPTO && NET 3 depends on EXPERIMENTAL && KEYS && NET
4 select CRYPTO_ECB
5 select CRYPTO_CBC
4 help 6 help
5 Encrypted filesystem that operates on the VFS layer. See 7 Encrypted filesystem that operates on the VFS layer. See
6 <file:Documentation/filesystems/ecryptfs.txt> to learn more about 8 <file:Documentation/filesystems/ecryptfs.txt> to learn more about
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 520783b205a1..931f715827ac 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1763,7 +1763,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
1763 if (IS_ERR(*key_tfm)) { 1763 if (IS_ERR(*key_tfm)) {
1764 rc = PTR_ERR(*key_tfm); 1764 rc = PTR_ERR(*key_tfm);
1765 printk(KERN_ERR "Unable to allocate crypto cipher with name " 1765 printk(KERN_ERR "Unable to allocate crypto cipher with name "
1766 "[%s]; rc = [%d]\n", cipher_name, rc); 1766 "[%s]; rc = [%d]\n", full_alg_name, rc);
1767 goto out; 1767 goto out;
1768 } 1768 }
1769 crypto_blkcipher_set_flags(*key_tfm, CRYPTO_TFM_REQ_WEAK_KEY); 1769 crypto_blkcipher_set_flags(*key_tfm, CRYPTO_TFM_REQ_WEAK_KEY);
@@ -1776,7 +1776,8 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
1776 rc = crypto_blkcipher_setkey(*key_tfm, dummy_key, *key_size); 1776 rc = crypto_blkcipher_setkey(*key_tfm, dummy_key, *key_size);
1777 if (rc) { 1777 if (rc) {
1778 printk(KERN_ERR "Error attempting to set key of size [%zd] for " 1778 printk(KERN_ERR "Error attempting to set key of size [%zd] for "
1779 "cipher [%s]; rc = [%d]\n", *key_size, cipher_name, rc); 1779 "cipher [%s]; rc = [%d]\n", *key_size, full_alg_name,
1780 rc);
1780 rc = -EINVAL; 1781 rc = -EINVAL;
1781 goto out; 1782 goto out;
1782 } 1783 }