Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\encrypted-keys\encrypted.c Create Date:2022-07-28 18:33:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Before returning data to userspace, encrypt decrypted data.

Proto:static int derived_key_encrypt(struct encrypted_key_payload *epayload, const u8 *derived_key, unsigned int derived_keylen)

Type:int

Parameter:

TypeParameterName
struct encrypted_key_payload *epayload
const u8 *derived_key
unsigned intderived_keylen
470  encrypted_datalen = undup - round up to the next specified multiple*@x: the value to up*@y: multiple to round up to* Rounds @x up to next multiple of @y. If @y will always be a power* of 2, consider using the faster round_up().( decrypted data length , blksize)
472  req = init_skcipher_req(derived_key, derived_keylen)
473  ret = PTR_ERR(req)
474  If IS_ERR(req) Then Go to out
476  dump_decrypted_data(epayload)
478  sg_init_table - Initialize SG table*@sgl: The SG table*@nents: Number of entries in table* Notes:* If this is part of a chained sg table, sg_mark_end() should be* used only on the last table part.
479  sg_set_buf - Set sg entry to point at given data*@sg: SG entry*@buf: Data*@buflen: Data length
481  sg_set_page - Set sg entry to point at given page*@sg: SG entry*@page: The page*@len: Length of data*@offset: Offset into page* Description:* Use this function to set an sg entry pointing at a page, never assign* the page directly
483  sg_init_table - Initialize SG table*@sgl: The SG table*@nents: Number of entries in table* Notes:* If this is part of a chained sg table, sg_mark_end() should be* used only on the last table part.
484  sg_set_buf - Set sg entry to point at given data*@sg: SG entry*@buf: Data*@buflen: Data length
486  memcpy(iv, datablob: iv , size of iv )
487  skcipher_request_set_crypt() - set data buffers*@req: request handle*@src: source scatter / gather list*@dst: destination scatter / gather list*@cryptlen: number of bytes to process from @src*@iv: IV for the cipher operation which must comply with the IV
488  ret = rypto_skcipher_encrypt() - encrypt plaintext*@req: reference to the skcipher_request handle that holds all information* needed to perform the cipher operation* Encrypt plaintext data using the skcipher_request handle
489  tfm = rypto_skcipher_reqtfm() - obtain cipher handle from request*@req: skcipher_request out of which the cipher handle is to be obtained* Return the crypto_skcipher handle when furnishing an skcipher_request* data structure.* Return: crypto_skcipher handle
490  skcipher_request_free() - zeroize and free request data structure*@req: request data structure cipher handle to be freed
491  rypto_free_skcipher() - zeroize and free cipher handle*@tfm: cipher handle to be freed
492  If ret < 0 Then pr_err("encrypted_key: failed to encrypt (%d)\n", ret)
494  Else dump_encrypted_data(epayload, encrypted_datalen)
496  out :
497  Return ret
Caller
NameDescribe
encrypted_readrypted_read - format and copy the encrypted data to userspace* The resulting datablob format is:* * On success, return to userspace the encrypted key datablob size.