Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\crypto\policy.c Create Date:2022-07-28 20:24:13
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:scrypt_policy_from_context - convert an fscrypt_context to an fscrypt_policy* Given an fscrypt_context, build the corresponding fscrypt_policy.* Return: 0 on success, or -EINVAL if the fscrypt_context has an unrecognized* version number or size.

Proto:int fscrypt_policy_from_context(union fscrypt_policy *policy_u, const union fscrypt_context *ctx_u, int ctx_size)

Type:int

Parameter:

TypeParameterName
union fscrypt_policy *policy_u
const union fscrypt_context *ctx_u
intctx_size
203  memset(policy_u, 0, size of policy_u )
205  If ctx_size <= 0 || ctx_size != Return the size expected for the given fscrypt_context based on its version* number, or 0 if the context version is unrecognized. Then Return -EINVAL
209  Case version == FSCRYPT_CONTEXT_V1
210  ctx = v1
211  policy = v1
213  version = Legacy policy version; ad-hoc KDF and no key verification.* For new encrypted directories, use fscrypt_policy_v2 instead.* Careful: the .version field for this is actually 0, not 1.
214  contents_encryption_mode = contents_encryption_mode
216  filenames_encryption_mode = filenames_encryption_mode
218  flags = flags
219  memcpy(master_key_descriptor, master_key_descriptor, size of master_key_descriptor )
222  Return 0
224  Case version == FSCRYPT_CONTEXT_V2
225  ctx = v2
226  policy = v2
228  version = New policy version with HKDF and key verification (recommended).
229  contents_encryption_mode = contents_encryption_mode
231  filenames_encryption_mode = filenames_encryption_mode
233  flags = flags
234  memcpy(__reserved, __reserved, size of __reserved )
236  memcpy(master_key_identifier, master_key_identifier, size of master_key_identifier )
239  Return 0
243  Return -EINVAL