aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/crypto.c')
-rw-r--r--fs/ext4/crypto.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index 38f7562489bb..edc053a81914 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -18,11 +18,9 @@
18 * Special Publication 800-38E and IEEE P1619/D16. 18 * Special Publication 800-38E and IEEE P1619/D16.
19 */ 19 */
20 20
21#include <crypto/hash.h> 21#include <crypto/skcipher.h>
22#include <crypto/sha.h>
23#include <keys/user-type.h> 22#include <keys/user-type.h>
24#include <keys/encrypted-type.h> 23#include <keys/encrypted-type.h>
25#include <linux/crypto.h>
26#include <linux/ecryptfs.h> 24#include <linux/ecryptfs.h>
27#include <linux/gfp.h> 25#include <linux/gfp.h>
28#include <linux/kernel.h> 26#include <linux/kernel.h>
@@ -261,21 +259,21 @@ static int ext4_page_crypto(struct inode *inode,
261 259
262{ 260{
263 u8 xts_tweak[EXT4_XTS_TWEAK_SIZE]; 261 u8 xts_tweak[EXT4_XTS_TWEAK_SIZE];
264 struct ablkcipher_request *req = NULL; 262 struct skcipher_request *req = NULL;
265 DECLARE_EXT4_COMPLETION_RESULT(ecr); 263 DECLARE_EXT4_COMPLETION_RESULT(ecr);
266 struct scatterlist dst, src; 264 struct scatterlist dst, src;
267 struct ext4_crypt_info *ci = EXT4_I(inode)->i_crypt_info; 265 struct ext4_crypt_info *ci = EXT4_I(inode)->i_crypt_info;
268 struct crypto_ablkcipher *tfm = ci->ci_ctfm; 266 struct crypto_skcipher *tfm = ci->ci_ctfm;
269 int res = 0; 267 int res = 0;
270 268
271 req = ablkcipher_request_alloc(tfm, GFP_NOFS); 269 req = skcipher_request_alloc(tfm, GFP_NOFS);
272 if (!req) { 270 if (!req) {
273 printk_ratelimited(KERN_ERR 271 printk_ratelimited(KERN_ERR
274 "%s: crypto_request_alloc() failed\n", 272 "%s: crypto_request_alloc() failed\n",
275 __func__); 273 __func__);
276 return -ENOMEM; 274 return -ENOMEM;
277 } 275 }
278 ablkcipher_request_set_callback( 276 skcipher_request_set_callback(
279 req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, 277 req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
280 ext4_crypt_complete, &ecr); 278 ext4_crypt_complete, &ecr);
281 279
@@ -288,21 +286,21 @@ static int ext4_page_crypto(struct inode *inode,
288 sg_set_page(&dst, dest_page, PAGE_CACHE_SIZE, 0); 286 sg_set_page(&dst, dest_page, PAGE_CACHE_SIZE, 0);
289 sg_init_table(&src, 1); 287 sg_init_table(&src, 1);
290 sg_set_page(&src, src_page, PAGE_CACHE_SIZE, 0); 288 sg_set_page(&src, src_page, PAGE_CACHE_SIZE, 0);
291 ablkcipher_request_set_crypt(req, &src, &dst, PAGE_CACHE_SIZE, 289 skcipher_request_set_crypt(req, &src, &dst, PAGE_CACHE_SIZE,
292 xts_tweak); 290 xts_tweak);
293 if (rw == EXT4_DECRYPT) 291 if (rw == EXT4_DECRYPT)
294 res = crypto_ablkcipher_decrypt(req); 292 res = crypto_skcipher_decrypt(req);
295 else 293 else
296 res = crypto_ablkcipher_encrypt(req); 294 res = crypto_skcipher_encrypt(req);
297 if (res == -EINPROGRESS || res == -EBUSY) { 295 if (res == -EINPROGRESS || res == -EBUSY) {
298 wait_for_completion(&ecr.completion); 296 wait_for_completion(&ecr.completion);
299 res = ecr.res; 297 res = ecr.res;
300 } 298 }
301 ablkcipher_request_free(req); 299 skcipher_request_free(req);
302 if (res) { 300 if (res) {
303 printk_ratelimited( 301 printk_ratelimited(
304 KERN_ERR 302 KERN_ERR
305 "%s: crypto_ablkcipher_encrypt() returned %d\n", 303 "%s: crypto_skcipher_encrypt() returned %d\n",
306 __func__, res); 304 __func__, res);
307 return res; 305 return res;
308 } 306 }