crypto.c (1809de7e7d37c585e01a1bcc583ea92b78fc759d) | crypto.c (09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a) |
---|---|
1/* 2 * linux/fs/ext4/crypto.c 3 * 4 * Copyright (C) 2015, Google, Inc. 5 * 6 * This contains encryption functions for ext4 7 * 8 * Written by Michael Halcrow, 2014. --- 269 unchanged lines hidden (view full) --- 278 ext4_crypt_complete, &ecr); 279 280 BUILD_BUG_ON(EXT4_XTS_TWEAK_SIZE < sizeof(index)); 281 memcpy(xts_tweak, &index, sizeof(index)); 282 memset(&xts_tweak[sizeof(index)], 0, 283 EXT4_XTS_TWEAK_SIZE - sizeof(index)); 284 285 sg_init_table(&dst, 1); | 1/* 2 * linux/fs/ext4/crypto.c 3 * 4 * Copyright (C) 2015, Google, Inc. 5 * 6 * This contains encryption functions for ext4 7 * 8 * Written by Michael Halcrow, 2014. --- 269 unchanged lines hidden (view full) --- 278 ext4_crypt_complete, &ecr); 279 280 BUILD_BUG_ON(EXT4_XTS_TWEAK_SIZE < sizeof(index)); 281 memcpy(xts_tweak, &index, sizeof(index)); 282 memset(&xts_tweak[sizeof(index)], 0, 283 EXT4_XTS_TWEAK_SIZE - sizeof(index)); 284 285 sg_init_table(&dst, 1); |
286 sg_set_page(&dst, dest_page, PAGE_CACHE_SIZE, 0); | 286 sg_set_page(&dst, dest_page, PAGE_SIZE, 0); |
287 sg_init_table(&src, 1); | 287 sg_init_table(&src, 1); |
288 sg_set_page(&src, src_page, PAGE_CACHE_SIZE, 0); 289 skcipher_request_set_crypt(req, &src, &dst, PAGE_CACHE_SIZE, | 288 sg_set_page(&src, src_page, PAGE_SIZE, 0); 289 skcipher_request_set_crypt(req, &src, &dst, PAGE_SIZE, |
290 xts_tweak); 291 if (rw == EXT4_DECRYPT) 292 res = crypto_skcipher_decrypt(req); 293 else 294 res = crypto_skcipher_encrypt(req); 295 if (res == -EINPROGRESS || res == -EBUSY) { 296 wait_for_completion(&ecr.completion); 297 res = ecr.res; --- 93 unchanged lines hidden (view full) --- 391 int ret, err = 0; 392 393#if 0 394 ext4_msg(inode->i_sb, KERN_CRIT, 395 "ext4_encrypted_zeroout ino %lu lblk %u len %u", 396 (unsigned long) inode->i_ino, lblk, len); 397#endif 398 | 290 xts_tweak); 291 if (rw == EXT4_DECRYPT) 292 res = crypto_skcipher_decrypt(req); 293 else 294 res = crypto_skcipher_encrypt(req); 295 if (res == -EINPROGRESS || res == -EBUSY) { 296 wait_for_completion(&ecr.completion); 297 res = ecr.res; --- 93 unchanged lines hidden (view full) --- 391 int ret, err = 0; 392 393#if 0 394 ext4_msg(inode->i_sb, KERN_CRIT, 395 "ext4_encrypted_zeroout ino %lu lblk %u len %u", 396 (unsigned long) inode->i_ino, lblk, len); 397#endif 398 |
399 BUG_ON(inode->i_sb->s_blocksize != PAGE_CACHE_SIZE); | 399 BUG_ON(inode->i_sb->s_blocksize != PAGE_SIZE); |
400 401 ctx = ext4_get_crypto_ctx(inode); 402 if (IS_ERR(ctx)) 403 return PTR_ERR(ctx); 404 405 ciphertext_page = alloc_bounce_page(ctx); 406 if (IS_ERR(ciphertext_page)) { 407 err = PTR_ERR(ciphertext_page); --- 116 unchanged lines hidden --- | 400 401 ctx = ext4_get_crypto_ctx(inode); 402 if (IS_ERR(ctx)) 403 return PTR_ERR(ctx); 404 405 ciphertext_page = alloc_bounce_page(ctx); 406 if (IS_ERR(ciphertext_page)) { 407 err = PTR_ERR(ciphertext_page); --- 116 unchanged lines hidden --- |