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

Name:encrypted_key_decrypt

Proto:static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, const char *format, const char *hex_encoded_iv)

Type:int

Parameter:

TypeParameterName
struct encrypted_key_payload *epayload
const char *format
const char *hex_encoded_iv
680  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)
681  asciilen = ( ivsize + 1 + encrypted_datalen + HASH_SIZE) * 2
682  If strlen - Find the length of a string*@s: The string to be sized != asciilen Then Return -EINVAL
685  hex_encoded_data = hex_encoded_iv + 2 * ivsize + 2
686  ret = hex2bin - convert an ascii hexadecimal string to its binary representation*@dst: binary result*@src: ascii hexadecimal string*@count: result length* Return 0 on success, -EINVAL in case of bad input.
687  If ret < 0 Then Return -EINVAL
689  ret = hex2bin - convert an ascii hexadecimal string to its binary representation*@dst: binary result*@src: ascii hexadecimal string*@count: result length* Return 0 on success, -EINVAL in case of bad input.
691  If ret < 0 Then Return -EINVAL
694  hmac = datablob: format + length of datablob
695  ret = hex2bin - convert an ascii hexadecimal string to its binary representation*@dst: binary result*@src: ascii hexadecimal string*@count: result length* Return 0 on success, -EINVAL in case of bad input.
697  If ret < 0 Then Return -EINVAL
700  mkey = request_master_key(epayload, & master_key, & master_keylen)
701  If IS_ERR(mkey) Then Return PTR_ERR(mkey)
704  ret = verify HMAC before decrypting encrypted key
705  If ret < 0 Then
706  pr_err("encrypted_key: bad hmac (%d)\n", ret)
707  Go to out
710  ret = Derive authentication/encryption key from trusted key
711  If ret < 0 Then Go to out
714  ret = derived_key_decrypt(epayload, derived_key, sizeofderived_key)
715  If ret < 0 Then pr_err("encrypted_key: failed to decrypt key (%d)\n", ret)
717  out :
718  lease a read lock
719  key_put - Discard a reference to a key.*@key: The key to discard a reference from.* Discard a reference to a key, and when all the references are gone, we* schedule the cleanup task to come and pull it out of the tree in process
720  memzero_explicit - Fill a region of memory (e
721  Return ret
Caller
NameDescribe
encrypted_initrypted_init - initialize an encrypted key* For a new key, use a random number for both the iv and data* itself. For an old key, decrypt the hex encoded data.