inline_crypt.c (29583dfcd2dd72c766422bd05c16f06c6b1fb356) | inline_crypt.c (fce3caea0f241f5d34855c82c399d5e0e2d91f07) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Inline encryption support for fscrypt 4 * 5 * Copyright 2019 Google LLC 6 */ 7 8/* --- 125 unchanged lines hidden (view full) --- 134 crypto_cfg.data_unit_size = sb->s_blocksize; 135 crypto_cfg.dun_bytes = fscrypt_get_dun_bytes(ci); 136 137 devs = fscrypt_get_devices(sb, &num_devs); 138 if (IS_ERR(devs)) 139 return PTR_ERR(devs); 140 141 for (i = 0; i < num_devs; i++) { | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Inline encryption support for fscrypt 4 * 5 * Copyright 2019 Google LLC 6 */ 7 8/* --- 125 unchanged lines hidden (view full) --- 134 crypto_cfg.data_unit_size = sb->s_blocksize; 135 crypto_cfg.dun_bytes = fscrypt_get_dun_bytes(ci); 136 137 devs = fscrypt_get_devices(sb, &num_devs); 138 if (IS_ERR(devs)) 139 return PTR_ERR(devs); 140 141 for (i = 0; i < num_devs; i++) { |
142 if (!blk_crypto_config_supported(bdev_get_queue(devs[i]), 143 &crypto_cfg)) | 142 if (!blk_crypto_config_supported(devs[i], &crypto_cfg)) |
144 goto out_free_devs; 145 } 146 147 fscrypt_log_blk_crypto_impl(ci->ci_mode, devs, num_devs, &crypto_cfg); 148 149 ci->ci_inlinecrypt = true; 150out_free_devs: 151 kfree(devs); --- 27 unchanged lines hidden (view full) --- 179 180 /* Start using blk-crypto on all the filesystem's block devices. */ 181 devs = fscrypt_get_devices(sb, &num_devs); 182 if (IS_ERR(devs)) { 183 err = PTR_ERR(devs); 184 goto fail; 185 } 186 for (i = 0; i < num_devs; i++) { | 143 goto out_free_devs; 144 } 145 146 fscrypt_log_blk_crypto_impl(ci->ci_mode, devs, num_devs, &crypto_cfg); 147 148 ci->ci_inlinecrypt = true; 149out_free_devs: 150 kfree(devs); --- 27 unchanged lines hidden (view full) --- 178 179 /* Start using blk-crypto on all the filesystem's block devices. */ 180 devs = fscrypt_get_devices(sb, &num_devs); 181 if (IS_ERR(devs)) { 182 err = PTR_ERR(devs); 183 goto fail; 184 } 185 for (i = 0; i < num_devs; i++) { |
187 err = blk_crypto_start_using_key(blk_key, 188 bdev_get_queue(devs[i])); | 186 err = blk_crypto_start_using_key(devs[i], blk_key); |
189 if (err) 190 break; 191 } 192 kfree(devs); 193 if (err) { 194 fscrypt_err(inode, "error %d starting to use blk-crypto", err); 195 goto fail; 196 } --- 22 unchanged lines hidden (view full) --- 219 220 if (!blk_key) 221 return; 222 223 /* Evict the key from all the filesystem's block devices. */ 224 devs = fscrypt_get_devices(sb, &num_devs); 225 if (!IS_ERR(devs)) { 226 for (i = 0; i < num_devs; i++) | 187 if (err) 188 break; 189 } 190 kfree(devs); 191 if (err) { 192 fscrypt_err(inode, "error %d starting to use blk-crypto", err); 193 goto fail; 194 } --- 22 unchanged lines hidden (view full) --- 217 218 if (!blk_key) 219 return; 220 221 /* Evict the key from all the filesystem's block devices. */ 222 devs = fscrypt_get_devices(sb, &num_devs); 223 if (!IS_ERR(devs)) { 224 for (i = 0; i < num_devs; i++) |
227 blk_crypto_evict_key(bdev_get_queue(devs[i]), blk_key); | 225 blk_crypto_evict_key(devs[i], blk_key); |
228 kfree(devs); 229 } 230 kfree_sensitive(blk_key); 231} 232 233bool __fscrypt_inode_uses_inline_crypto(const struct inode *inode) 234{ 235 return inode->i_crypt_info->ci_inlinecrypt; --- 248 unchanged lines hidden --- | 226 kfree(devs); 227 } 228 kfree_sensitive(blk_key); 229} 230 231bool __fscrypt_inode_uses_inline_crypto(const struct inode *inode) 232{ 233 return inode->i_crypt_info->ci_inlinecrypt; --- 248 unchanged lines hidden --- |