From ba0f9e7b76996b87e908a06208e5c574732b3aac Mon Sep 17 00:00:00 2001 From: Michael Halcrow Date: Mon, 5 Nov 2007 14:51:04 -0800 Subject: [PATCH] --- yaml --- r: 73210 b: refs/heads/master c: 8a29f2b0288ba2a8fb302f9a639521ac9ff302e5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ecryptfs/crypto.c | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index ed325518e291..1948e5520036 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 778d1a2bd42ae862a6c6d20a1c3af5e45b3c1924 +refs/heads/master: 8a29f2b0288ba2a8fb302f9a639521ac9ff302e5 diff --git a/trunk/fs/ecryptfs/crypto.c b/trunk/fs/ecryptfs/crypto.c index 9ea4769fbb66..bbed2fd40fdc 100644 --- a/trunk/fs/ecryptfs/crypto.c +++ b/trunk/fs/ecryptfs/crypto.c @@ -115,11 +115,29 @@ static int ecryptfs_calculate_md5(char *dst, } crypt_stat->hash_tfm = desc.tfm; } - crypto_hash_init(&desc); - crypto_hash_update(&desc, &sg, len); - crypto_hash_final(&desc, dst); - mutex_unlock(&crypt_stat->cs_hash_tfm_mutex); + rc = crypto_hash_init(&desc); + if (rc) { + printk(KERN_ERR + "%s: Error initializing crypto hash; rc = [%d]\n", + __FUNCTION__, rc); + goto out; + } + rc = crypto_hash_update(&desc, &sg, len); + if (rc) { + printk(KERN_ERR + "%s: Error updating crypto hash; rc = [%d]\n", + __FUNCTION__, rc); + goto out; + } + rc = crypto_hash_final(&desc, dst); + if (rc) { + printk(KERN_ERR + "%s: Error finalizing crypto hash; rc = [%d]\n", + __FUNCTION__, rc); + goto out; + } out: + mutex_unlock(&crypt_stat->cs_hash_tfm_mutex); return rc; }