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_new_context_from_policy - create a new fscrypt_context from a policy* Create an fscrypt_context for an inode that is being assigned the given* encryption policy. A new nonce is randomly generated.* Return: the size of the new context in bytes.

Proto:static int fscrypt_new_context_from_policy(union fscrypt_context *ctx_u, const union fscrypt_policy *policy_u)

Type:int

Parameter:

TypeParameterName
union fscrypt_context *ctx_u
const union fscrypt_policy *policy_u
149  memset(ctx_u, 0, size of ctx_u )
152  Case 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.
153  policy = v1
154  ctx = v1
156  FSCRYPT_CONTEXT_V1 = FSCRYPT_CONTEXT_V1
157  contents_encryption_mode = contents_encryption_mode
159  filenames_encryption_mode = filenames_encryption_mode
161  flags = flags
162  memcpy(master_key_descriptor, master_key_descriptor, size of master_key_descriptor )
165  get_random_bytes(nonce, size of nonce )
166  Return size of ctx
168  Case version == New policy version with HKDF and key verification (recommended).
169  policy = v2
170  ctx = v2
172  FSCRYPT_CONTEXT_V2 = FSCRYPT_CONTEXT_V2
173  contents_encryption_mode = contents_encryption_mode
175  filenames_encryption_mode = filenames_encryption_mode
177  flags = flags
178  memcpy(master_key_identifier, master_key_identifier, size of master_key_identifier )
181  get_random_bytes(nonce, size of nonce )
182  Return size of ctx
185  BUG()