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

Name:Derive authentication/encryption key from trusted key

Proto:static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, const u8 *master_key, size_t master_keylen)

Type:int

Parameter:

TypeParameterName
u8 *derived_key
enum derived_key_typekey_type
const u8 *master_key
size_tmaster_keylen
369  derived_buf_len = strlen - Find the length of a string*@s: The string to be sized + 1 + master_keylen
370  If derived_buf_len < HASH_SIZE Then derived_buf_len = HASH_SIZE
373  derived_buf = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
374  If Not derived_buf Then Return -ENOMEM
377  If key_type Then strcpy(derived_buf, "AUTH_KEY")
379  Else strcpy(derived_buf, "ENC_KEY")
382  memcpy(derived_buf + strlen - Find the length of a string*@s: The string to be sized + 1, master_key, master_keylen)
384  ret = calc_hash(hash_tfm, derived_key, derived_buf, derived_buf_len)
385  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
386  Return ret
Caller
NameDescribe
datablob_hmac_append
datablob_hmac_verifyverify HMAC before decrypting encrypted key
encrypted_key_decrypt
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.