diff options
author | Michael Halcrow <mhalcrow@us.ibm.com> | 2006-10-30 22:07:16 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-31 08:07:00 -0800 |
commit | e5d9cbde6ce0001e49994df5fcdcbeff8be8037b (patch) | |
tree | aadfbeae4d48c56a0ca6e9612e87d7340dc3b1a1 /fs/ecryptfs/keystore.c | |
parent | 4a279ff1ea1cf325775ada983035123fcdc8e986 (diff) | |
download | kernel_goldelico_gta04-e5d9cbde6ce0001e49994df5fcdcbeff8be8037b.zip kernel_goldelico_gta04-e5d9cbde6ce0001e49994df5fcdcbeff8be8037b.tar.gz kernel_goldelico_gta04-e5d9cbde6ce0001e49994df5fcdcbeff8be8037b.tar.bz2 |
[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.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index ba45478..bc706d3 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, goto out; } } - if (password_s_ptr->session_key_encryption_key_bytes - < crypto_tfm_alg_min_keysize(tfm)) { - printk(KERN_WARNING "Session key encryption key is [%d] bytes; " - "minimum keysize for selected cipher is [%d] bytes.\n", - password_s_ptr->session_key_encryption_key_bytes, - crypto_tfm_alg_min_keysize(tfm)); - rc = -EINVAL; - goto out; - } if (tfm_mutex) mutex_lock(tfm_mutex); - crypto_cipher_setkey(tfm, password_s_ptr->session_key_encryption_key, - crypt_stat->key_size); + rc = crypto_cipher_setkey(tfm, + password_s_ptr->session_key_encryption_key, + crypt_stat->key_size); + if (rc < 0) { + printk(KERN_ERR "Error setting key for crypto context\n"); + rc = -EINVAL; + goto out_free_tfm; + } /* TODO: virt_to_scatterlist */ encrypted_session_key = (char *)__get_free_page(GFP_KERNEL); if (!encrypted_session_key) { |