|
@@ -198,9 +198,9 @@ EXPORT_SYMBOL(fscrypt_has_permitted_context);
|
|
|
* @parent: Parent inode from which the context is inherited.
|
|
|
* @child: Child inode that inherits the context from @parent.
|
|
|
* @fs_data: private data given by FS.
|
|
|
- * @preload: preload child i_crypt_info
|
|
|
+ * @preload: preload child i_crypt_info if true
|
|
|
*
|
|
|
- * Return: Zero on success, non-zero otherwise
|
|
|
+ * Return: 0 on success, -errno on failure
|
|
|
*/
|
|
|
int fscrypt_inherit_context(struct inode *parent, struct inode *child,
|
|
|
void *fs_data, bool preload)
|
|
@@ -221,19 +221,11 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
|
|
|
return -ENOKEY;
|
|
|
|
|
|
ctx.format = FS_ENCRYPTION_CONTEXT_FORMAT_V1;
|
|
|
- if (fscrypt_dummy_context_enabled(parent)) {
|
|
|
- ctx.contents_encryption_mode = FS_ENCRYPTION_MODE_AES_256_XTS;
|
|
|
- ctx.filenames_encryption_mode = FS_ENCRYPTION_MODE_AES_256_CTS;
|
|
|
- ctx.flags = 0;
|
|
|
- memset(ctx.master_key_descriptor, 0x42, FS_KEY_DESCRIPTOR_SIZE);
|
|
|
- res = 0;
|
|
|
- } else {
|
|
|
- ctx.contents_encryption_mode = ci->ci_data_mode;
|
|
|
- ctx.filenames_encryption_mode = ci->ci_filename_mode;
|
|
|
- ctx.flags = ci->ci_flags;
|
|
|
- memcpy(ctx.master_key_descriptor, ci->ci_master_key,
|
|
|
- FS_KEY_DESCRIPTOR_SIZE);
|
|
|
- }
|
|
|
+ ctx.contents_encryption_mode = ci->ci_data_mode;
|
|
|
+ ctx.filenames_encryption_mode = ci->ci_filename_mode;
|
|
|
+ ctx.flags = ci->ci_flags;
|
|
|
+ memcpy(ctx.master_key_descriptor, ci->ci_master_key,
|
|
|
+ FS_KEY_DESCRIPTOR_SIZE);
|
|
|
get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE);
|
|
|
res = parent->i_sb->s_cop->set_context(child, &ctx,
|
|
|
sizeof(ctx), fs_data);
|