Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:quest_key_and_link - Request a key and cache it in a keyring.*@type: The type of key we want.*@description: The searchable description of the key.*@domain_tag: The domain in which the key operates.

Proto:struct key *request_key_and_link(struct key_type *type, const char *description, struct key_tag *domain_tag, const void *callout_info, size_t callout_len, void *aux, struct key *dest_keyring, unsigned long flags)

Type:struct key

Parameter:

TypeParameterName
struct key_type *type
const char *description
struct key_tag *domain_tag
const void *callout_info
size_tcallout_len
void *aux
struct key *dest_keyring
unsigned longflags
567  struct keyring_search_context ctx = {type = type, Domain of operation = domain_tag, description = description, desc_len = strlen - Find the length of a string*@s: The string to be sized, cred = current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.(), cmp = By default, we keys found by getting an exact match on their descriptions., Raw match data = description, Type of lookup for this search. = Direct lookup by description. , flags = (Override NO_STATE_CHECK | Ignore expired keys (intention to replace) | Search child keyrings also ), }
584  kenter("%s,%s,%p,%zu,%p,%p,%lx", name, description, callout_info, callout_len, aux, dest_keyring, flags)
588  If match_preparse Then
589  ret = match_preparse( & match_data)
590  If ret < 0 Then
591  key = ERR_PTR(ret)
592  Go to error
596  key = check_cached_key( & ctx)
597  If key Then Go to error_free
601  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
602  key_ref = Search the process keyrings attached to the supplied cred for the first* matching key in the manner of search_my_process_keyrings(), but also search* the keys attached to the assumed authorisation key using its credentials if* one is available.
603  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
605  If Not IS_ERR(key_ref) Then
606  If dest_keyring Then
609  If ret < 0 Then
611  key = ERR_PTR(ret)
612  Go to error_free
616  key = key_ref_to_ptr(key_ref)
617  If dest_keyring Then
619  If ret < 0 Then
627  cache_requested_key(key)
628  Else if PTR_ERR(key_ref) != -EAGAIN Then
629  key = ERR_CAST - Explicitly cast an error-valued pointer to another pointer type*@ptr: The pointer to cast.* Explicitly cast an error-valued pointer to another pointer type in such a* way as to make it clear that's what's going on.
630  Else
633  key = ERR_PTR( - ENOKEY)
634  If Not callout_info Then Go to error_free
637  key = Commence key construction.
641  error_free :
642  If match_free Then match_free( & match_data)
644  error :
645  kleave(" = %p", key)
646  Return key
Caller
NameDescribe
request_key_tagquest_key_tag - Request a key and wait for construction*@type: Type of key
request_key_with_auxdataquest_key_with_auxdata - Request a key with auxiliary data for the upcaller*@type: The type of key we want.*@description: The searchable description of the key.*@domain_tag: The domain in which the key operates.
SYSCALL_DEFINE4Search the process keyrings and keyring trees linked from those for a* matching key. Keyrings must have appropriate Search permission to be* searched.* If a key is found, it will be attached to the destination keyring if there's