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:58
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rypted_update - update the master key description* Change the master key description for an existing encrypted key.* The next read will return an encrypted datablob using the new* master key description.* On success, return 0. Otherwise return errno.

Proto:static int encrypted_update(struct key *key, struct key_preparsed_payload *prep)

Type:int

Parameter:

TypeParameterName
struct key *key
struct key_preparsed_payload *prep
856  epayload = data[0]
859  char * new_master_desc = NULL
860  const char * format = NULL
861  datalen = Raw datalen
862  ret = 0
864  If key_is_negative(key) Then Return -ENOKEY
866  If datalen <= 0 || datalen > 32767 || Not Raw data Then Return -EINVAL
869  buf = Allocation memory
870  If Not buf Then Return -ENOMEM
873  buf[datalen] = 0
874  memcpy(buf, Raw data , datalen)
875  ret = datablob_parse - parse the keyctl data* datablob format:* new [] * load [] * * update * Tokenizes a copy of the
876  If ret < 0 Then Go to out
879  ret = valid_master_desc - verify the 'key-type:desc' of a new/updated master-key* key-type:= "trusted:" | "user:"* desc:= master-key description* Verify that 'key-type' is valid and that 'desc' exists. On key update,
880  If ret < 0 Then Go to out
883  new_epayload = Allocate memory for decrypted key and datablob.
885  If IS_ERR(new_epayload) Then
886  ret = PTR_ERR(new_epayload)
887  Go to out
890  __ekey_init(new_epayload, datablob: format , new_master_desc, datablob: decrypted key length )
893  memcpy( datablob: iv , datablob: iv , ivsize)
894  memcpy( payload data + datablob + hmac , payload data + datablob + hmac , payload data length )
897  rcu_assign_keypointer(key, new_epayload)
898  Post an RCU callback to be invoked after the end of an RCU grace* period. But since we have but one CPU, that would be after any* quiescent state.
899  out :
900  kzfree - like kfree but zero memory*@p: object to free memory of* The memory of the object @p points to is zeroed before freed.* If @p is %NULL, kzfree() does nothing.* Note: this function zeroes the whole allocated buffer which can be a good
901  Return ret