keysetup_v1.c (112d6212c80a1c560757520bd822a41c0ad15c2c) keysetup_v1.c (4006d799d93b159fd834c50999265b5c534a71d5)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Key setup for v1 encryption policies
4 *
5 * Copyright 2015, 2019 Google LLC
6 */
7
8/*

--- 256 unchanged lines hidden (view full) ---

265
266 if (ci->ci_policy.v1.contents_encryption_mode !=
267 ci->ci_policy.v1.filenames_encryption_mode) {
268 fscrypt_warn(ci->ci_inode,
269 "Direct key mode not allowed with different contents and filenames modes");
270 return -EINVAL;
271 }
272
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Key setup for v1 encryption policies
4 *
5 * Copyright 2015, 2019 Google LLC
6 */
7
8/*

--- 256 unchanged lines hidden (view full) ---

265
266 if (ci->ci_policy.v1.contents_encryption_mode !=
267 ci->ci_policy.v1.filenames_encryption_mode) {
268 fscrypt_warn(ci->ci_inode,
269 "Direct key mode not allowed with different contents and filenames modes");
270 return -EINVAL;
271 }
272
273 /* ESSIV implies 16-byte IVs which implies !DIRECT_KEY */
274 if (WARN_ON(mode->needs_essiv))
275 return -EINVAL;
276
277 dk = fscrypt_get_direct_key(ci, raw_master_key);
278 if (IS_ERR(dk))
279 return PTR_ERR(dk);
280 ci->ci_direct_key = dk;
281 ci->ci_ctfm = dk->dk_ctfm;
282 return 0;
283}
284

--- 56 unchanged lines hidden ---
273 dk = fscrypt_get_direct_key(ci, raw_master_key);
274 if (IS_ERR(dk))
275 return PTR_ERR(dk);
276 ci->ci_direct_key = dk;
277 ci->ci_ctfm = dk->dk_ctfm;
278 return 0;
279}
280

--- 56 unchanged lines hidden ---