aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/keystore.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2006-10-31 01:07:16 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-31 11:07:00 -0500
commite5d9cbde6ce0001e49994df5fcdcbeff8be8037b (patch)
treeaadfbeae4d48c56a0ca6e9612e87d7340dc3b1a1 /fs/ecryptfs/keystore.c
parent4a279ff1ea1cf325775ada983035123fcdc8e986 (diff)
[PATCH] eCryptfs: Clean up crypto initialization
Clean up the crypto initialization code; let the crypto API take care of the key size checks. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ecryptfs/keystore.c')
-rw-r--r--fs/ecryptfs/keystore.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index ba454785a0c5..bc706d33559a 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -493,19 +493,16 @@ static int decrypt_session_key(struct ecryptfs_auth_tok *auth_tok,
493 goto out; 493 goto out;
494 } 494 }
495 } 495 }
496 if (password_s_ptr->session_key_encryption_key_bytes
497 < crypto_tfm_alg_min_keysize(tfm)) {
498 printk(KERN_WARNING "Session key encryption key is [%d] bytes; "
499 "minimum keysize for selected cipher is [%d] bytes.\n",
500 password_s_ptr->session_key_encryption_key_bytes,
501 crypto_tfm_alg_min_keysize(tfm));
502 rc = -EINVAL;
503 goto out;
504 }
505 if (tfm_mutex) 496 if (tfm_mutex)
506 mutex_lock(tfm_mutex); 497 mutex_lock(tfm_mutex);
507 crypto_cipher_setkey(tfm, password_s_ptr->session_key_encryption_key, 498 rc = crypto_cipher_setkey(tfm,
508 crypt_stat->key_size); 499 password_s_ptr->session_key_encryption_key,
500 crypt_stat->key_size);
501 if (rc < 0) {
502 printk(KERN_ERR "Error setting key for crypto context\n");
503 rc = -EINVAL;
504 goto out_free_tfm;
505 }
509 /* TODO: virt_to_scatterlist */ 506 /* TODO: virt_to_scatterlist */
510 encrypted_session_key = (char *)__get_free_page(GFP_KERNEL); 507 encrypted_session_key = (char *)__get_free_page(GFP_KERNEL);
511 if (!encrypted_session_key) { 508 if (!encrypted_session_key) {