diff options
| -rw-r--r-- | fs/ecryptfs/crypto.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 9ea4769fbb66..bbed2fd40fdc 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -115,11 +115,29 @@ static int ecryptfs_calculate_md5(char *dst, | |||
| 115 | } | 115 | } |
| 116 | crypt_stat->hash_tfm = desc.tfm; | 116 | crypt_stat->hash_tfm = desc.tfm; |
| 117 | } | 117 | } |
| 118 | crypto_hash_init(&desc); | 118 | rc = crypto_hash_init(&desc); |
| 119 | crypto_hash_update(&desc, &sg, len); | 119 | if (rc) { |
| 120 | crypto_hash_final(&desc, dst); | 120 | printk(KERN_ERR |
| 121 | mutex_unlock(&crypt_stat->cs_hash_tfm_mutex); | 121 | "%s: Error initializing crypto hash; rc = [%d]\n", |
| 122 | __FUNCTION__, rc); | ||
| 123 | goto out; | ||
| 124 | } | ||
| 125 | rc = crypto_hash_update(&desc, &sg, len); | ||
| 126 | if (rc) { | ||
| 127 | printk(KERN_ERR | ||
| 128 | "%s: Error updating crypto hash; rc = [%d]\n", | ||
| 129 | __FUNCTION__, rc); | ||
| 130 | goto out; | ||
| 131 | } | ||
| 132 | rc = crypto_hash_final(&desc, dst); | ||
| 133 | if (rc) { | ||
| 134 | printk(KERN_ERR | ||
| 135 | "%s: Error finalizing crypto hash; rc = [%d]\n", | ||
| 136 | __FUNCTION__, rc); | ||
| 137 | goto out; | ||
| 138 | } | ||
| 122 | out: | 139 | out: |
| 140 | mutex_unlock(&crypt_stat->cs_hash_tfm_mutex); | ||
| 123 | return rc; | 141 | return rc; |
| 124 | } | 142 | } |
| 125 | 143 | ||
