€•JŒsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ&/translations/zh_CN/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/zh_TW/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/it_IT/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ja_JP/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ko_KR/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/pt_BR/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/sp_SP/security/keys/core”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒKernel Key Retention Service”h]”hŒKernel Key Retention Service”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ@/var/lib/git/docbuild/linux/Documentation/security/keys/core.rst”h´KubhŒ paragraph”“”)�”}”(hŒ·This service allows cryptographic keys, authentication tokens, cross-domain user mappings, and similar to be cached in the kernel for the use of filesystems and other kernel services.”h]”hŒ·This service allows cryptographic keys, authentication tokens, cross-domain user mappings, and similar to be cached in the kernel for the use of filesystems and other kernel services.”…”�”}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒÇKeyrings are permitted; these are a special type of key that can hold links to other keys. Processes each have three standard keyring subscriptions that a kernel service can search for relevant keys.”h]”hŒÇKeyrings are permitted; these are a special type of key that can hold links to other keys. Processes each have three standard keyring subscriptions that a kernel service can search for relevant keys.”…”�”}”(hhÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhÌ)�”}”(hŒ1The key service can be configured on by enabling:”h]”hŒ1The key service can be configured on by enabling:”…”�”}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhŒ block_quote”“”)�”}”(hŒG"Security options"/"Enable access key retention support" (CONFIG_KEYS) ”h]”hÌ)�”}”(hŒF"Security options"/"Enable access key retention support" (CONFIG_KEYS)”h]”hŒN“Security optionsâ€�/â€�Enable access key retention supportâ€� (CONFIG_KEYS)”…”�”}”(hhýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khhùubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´Khh·h²hubhÌ)�”}”(hŒ)This document has the following sections:”h]”hŒ)This document has the following sections:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒtopic”“”)�”}”(hhh]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hhh]”hÌ)�”}”(hhh]”hŒ reference”“”)�”}”(hhh]”hŒ Key Overview”…”�”}”(hj3h²hh³Nh´Nubah}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œrefid”Œ key-overview”uh1j1hj.ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒKey Service Overview”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”Œid2”ah ]”h"]”h$]”h&]”Œrefid”Œkey-service-overview”uh1j1hjRubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjOubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒKey Access Permissions”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”Œid3”ah ]”h"]”h$]”h&]”Œrefid”Œkey-access-permissions”uh1j1hjtubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjqubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒSELinux Support”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”Œid4”ah ]”h"]”h$]”h&]”Œrefid”Œselinux-support”uh1j1hj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj“ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒNew ProcFS Files”…”�”}”(hj»h²hh³Nh´Nubah}”(h]”Œid5”ah ]”h"]”h$]”h&]”Œrefid”Œnew-procfs-files”uh1j1hj¸ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒUserspace System Call Interface”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”Œid6”ah ]”h"]”h$]”h&]”Œrefid”Œuserspace-system-call-interface”uh1j1hjÚubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj×ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒKernel Services”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”Œid7”ah ]”h"]”h$]”h&]”Œrefid”Œkernel-services”uh1j1hjüubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjùubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒ#Notes On Accessing Payload Contents”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”Œid8”ah ]”h"]”h$]”h&]”Œrefid”Œ#notes-on-accessing-payload-contents”uh1j1hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒDefining a Key Type”…”�”}”(hjCh²hh³Nh´Nubah}”(h]”Œid9”ah ]”h"]”h$]”h&]”Œrefid”Œdefining-a-key-type”uh1j1hj@ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj=ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒRequest-Key Callback Service”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”Œid10”ah ]”h"]”h$]”h&]”Œrefid”Œrequest-key-callback-service”uh1j1hjbubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj_ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubj*)�”}”(hhh]”hÌ)�”}”(hhh]”j2)�”}”(hhh]”hŒGarbage Collection”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”Œid11”ah ]”h"]”h$]”h&]”Œrefid”Œgarbage-collection”uh1j1hj„ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËhj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj&ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j$hj!h²hh³Nh´Nubah}”(h]”Œcontents”ah ]”(Œcontents”Œlocal”eh"]”Œcontents”ah$]”h&]”uh1jh³hÊh´Khh·h²hubh¶)�”}”(hhh]”(h»)�”}”(hŒ Key Overview”h]”hŒ Key Overview”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefid”j<uh1hºhj³h²hh³hÊh´KubhÌ)�”}”(hŒ–In this context, keys represent units of cryptographic data, authentication tokens, keyrings, etc.. These are represented in the kernel by struct key.”h]”hŒ–In this context, keys represent units of cryptographic data, authentication tokens, keyrings, etc.. These are represented in the kernel by struct key.”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj³h²hubhÌ)�”}”(hŒ$Each key has a number of attributes:”h]”hŒ$Each key has a number of attributes:”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj³h²hubhø)�”}”(hX; - A serial number. - A type. - A description (for matching a key in a search). - Access control information. - An expiry time. - A payload. - State. * Each key is issued a serial number of type key_serial_t that is unique for the lifetime of that key. All serial numbers are positive non-zero 32-bit integers. Userspace programs can use a key's serial numbers as a way to gain access to it, subject to permission checking. * Each key is of a defined "type". Types must be registered inside the kernel by a kernel service (such as a filesystem) before keys of that type can be added or used. Userspace programs cannot define new types directly. Key types are represented in the kernel by struct key_type. This defines a number of operations that can be performed on a key of that type. Should a type be removed from the system, all the keys of that type will be invalidated. * Each key has a description. This should be a printable string. The key type provides an operation to perform a match between the description on a key and a criterion string. * Each key has an owner user ID, a group ID and a permissions mask. These are used to control what a process may do to a key from userspace, and whether a kernel service will be able to find the key. * Each key can be set to expire at a specific time by the key type's instantiation function. Keys can also be immortal. * Each key can have a payload. This is a quantity of data that represent the actual "key". In the case of a keyring, this is a list of keys to which the keyring links; in the case of a user-defined key, it's an arbitrary blob of data. Having a payload is not required; and the payload can, in fact, just be a value stored in the struct key itself. When a key is instantiated, the key type's instantiation function is called with a blob of data, and that then creates the key's payload in some way. Similarly, when userspace wants to read back the contents of the key, if permitted, another key type operation will be called to convert the key's attached payload back into a blob of data. * Each key can be in one of a number of basic states: * Uninstantiated. The key exists, but does not have any data attached. Keys being requested from userspace will be in this state. * Instantiated. This is the normal state. The key is fully formed, and has data attached. * Negative. This is a relatively short-lived state. The key acts as a note saying that a previous call out to userspace failed, and acts as a throttle on key lookups. A negative key can be updated to a normal state. * Expired. Keys can have lifetimes set. If their lifetime is exceeded, they traverse to this state. An expired key can be updated back to a normal state. * Revoked. A key is put in this state by userspace action. It can't be found or operated upon (apart from by unlinking it). * Dead. The key's type was unregistered, and so the key is now useless. ”h]”(hø)�”}”(hŒ–- A serial number. - A type. - A description (for matching a key in a search). - Access control information. - An expiry time. - A payload. - State. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒA serial number.”h]”hÌ)�”}”(hjîh]”hŒA serial number.”…”�”}”(hjðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjìubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒA type.”h]”hÌ)�”}”(hjh]”hŒA type.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒ/A description (for matching a key in a search).”h]”hÌ)�”}”(hjh]”hŒ/A description (for matching a key in a search).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒAccess control information.”h]”hÌ)�”}”(hj3h]”hŒAccess control information.”…”�”}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K!hj1ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒAn expiry time.”h]”hÌ)�”}”(hjJh]”hŒAn expiry time.”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K"hjHubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒ A payload.”h]”hÌ)�”}”(hjah]”hŒ A payload.”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K#hj_ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubj*)�”}”(hŒState. ”h]”hÌ)�”}”(hŒState.”h]”hŒState.”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K$hjvubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjéubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j$h³hÊh´Khjåubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´Khjáubj%)�”}”(hhh]”(j*)�”}”(hXEach key is issued a serial number of type key_serial_t that is unique for the lifetime of that key. All serial numbers are positive non-zero 32-bit integers. Userspace programs can use a key's serial numbers as a way to gain access to it, subject to permission checking. ”h]”(hÌ)�”}”(hŒžEach key is issued a serial number of type key_serial_t that is unique for the lifetime of that key. All serial numbers are positive non-zero 32-bit integers.”h]”hŒžEach key is issued a serial number of type key_serial_t that is unique for the lifetime of that key. All serial numbers are positive non-zero 32-bit integers.”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K'hjŸubhÌ)�”}”(hŒpUserspace programs can use a key's serial numbers as a way to gain access to it, subject to permission checking.”h]”hŒrUserspace programs can use a key’s serial numbers as a way to gain access to it, subject to permission checking.”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K+hjŸubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjœubj*)�”}”(hXÃEach key is of a defined "type". Types must be registered inside the kernel by a kernel service (such as a filesystem) before keys of that type can be added or used. Userspace programs cannot define new types directly. Key types are represented in the kernel by struct key_type. This defines a number of operations that can be performed on a key of that type. Should a type be removed from the system, all the keys of that type will be invalidated. ”h]”(hÌ)�”}”(hŒÚEach key is of a defined "type". Types must be registered inside the kernel by a kernel service (such as a filesystem) before keys of that type can be added or used. Userspace programs cannot define new types directly.”h]”hŒÞEach key is of a defined “typeâ€�. Types must be registered inside the kernel by a kernel service (such as a filesystem) before keys of that type can be added or used. Userspace programs cannot define new types directly.”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K.hjÅubhÌ)�”}”(hŒŒKey types are represented in the kernel by struct key_type. This defines a number of operations that can be performed on a key of that type.”h]”hŒŒKey types are represented in the kernel by struct key_type. This defines a number of operations that can be performed on a key of that type.”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K2hjÅubhÌ)�”}”(hŒXShould a type be removed from the system, all the keys of that type will be invalidated.”h]”hŒXShould a type be removed from the system, all the keys of that type will be invalidated.”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K5hjÅubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjœubj*)�”}”(hŒ®Each key has a description. This should be a printable string. The key type provides an operation to perform a match between the description on a key and a criterion string. ”h]”hÌ)�”}”(hŒ­Each key has a description. This should be a printable string. The key type provides an operation to perform a match between the description on a key and a criterion string.”h]”hŒ­Each key has a description. This should be a printable string. The key type provides an operation to perform a match between the description on a key and a criterion string.”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K8hjùubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjœubj*)�”}”(hŒÆEach key has an owner user ID, a group ID and a permissions mask. These are used to control what a process may do to a key from userspace, and whether a kernel service will be able to find the key. ”h]”hÌ)�”}”(hŒÅEach key has an owner user ID, a group ID and a permissions mask. These are used to control what a process may do to a key from userspace, and whether a kernel service will be able to find the key.”h]”hŒÅEach key has an owner user ID, a group ID and a permissions mask. These are used to control what a process may do to a key from userspace, and whether a kernel service will be able to find the key.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K“hjubhÌ)�”}”(hXaThe session-specific keyring is persistent across clone, fork, vfork and execve, even when the latter executes a set-UID or set-GID binary. A process can, however, replace its current session keyring with a new one by using PR_JOIN_SESSION_KEYRING. It is permitted to request an anonymous new one, or to attempt to create or join one of a specific name.”h]”hXaThe session-specific keyring is persistent across clone, fork, vfork and execve, even when the latter executes a set-UID or set-GID binary. A process can, however, replace its current session keyring with a new one by using PR_JOIN_SESSION_KEYRING. It is permitted to request an anonymous new one, or to attempt to create or join one of a specific name.”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K˜hjubhÌ)�”}”(hŒ\The ownership of the thread keyring changes when the real UID and GID of the thread changes.”h]”hŒ\The ownership of the thread keyring changes when the real UID and GID of the thread changes.”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kžhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hXáEach user ID resident in the system holds two special keyrings: a user specific keyring and a default user session keyring. The default session keyring is initialised with a link to the user-specific keyring. When a process changes its real UID, if it used to have no session key, it will be subscribed to the default session key for the new UID. If a process attempts to access its session key when it doesn't have one, it will be subscribed to the default for its current UID. ”h]”(hÌ)�”}”(hŒÐEach user ID resident in the system holds two special keyrings: a user specific keyring and a default user session keyring. The default session keyring is initialised with a link to the user-specific keyring.”h]”hŒÐEach user ID resident in the system holds two special keyrings: a user specific keyring and a default user session keyring. The default session keyring is initialised with a link to the user-specific keyring.”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¡hjnubhÌ)�”}”(hŒ‰When a process changes its real UID, if it used to have no session key, it will be subscribed to the default session key for the new UID.”h]”hŒ‰When a process changes its real UID, if it used to have no session key, it will be subscribed to the default session key for the new UID.”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¥hjnubhÌ)�”}”(hŒƒIf a process attempts to access its session key when it doesn't have one, it will be subscribed to the default for its current UID.”h]”hŒ…If a process attempts to access its session key when it doesn’t have one, it will be subscribed to the default for its current UID.”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¨hjnubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hXwEach user has two quotas against which the keys they own are tracked. One limits the total number of keys and keyrings, the other limits the total amount of description and payload space that can be consumed. The user can view information on this and other statistics through procfs files. The root user may also alter the quota limits through sysctl files (see the section "New procfs files"). Process-specific and thread-specific keyrings are not counted towards a user's quota. If a system call that modifies a key or keyring in some way would put the user over quota, the operation is refused and error EDQUOT is returned. ”h]”(hÌ)�”}”(hŒÐEach user has two quotas against which the keys they own are tracked. One limits the total number of keys and keyrings, the other limits the total amount of description and payload space that can be consumed.”h]”hŒÐEach user has two quotas against which the keys they own are tracked. One limits the total number of keys and keyrings, the other limits the total amount of description and payload space that can be consumed.”…”�”}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K«hj¢ubhÌ)�”}”(hŒºThe user can view information on this and other statistics through procfs files. The root user may also alter the quota limits through sysctl files (see the section "New procfs files").”h]”hŒ¾The user can view information on this and other statistics through procfs files. The root user may also alter the quota limits through sysctl files (see the section “New procfs filesâ€�).”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¯hj¢ubhÌ)�”}”(hŒUProcess-specific and thread-specific keyrings are not counted towards a user's quota.”h]”hŒWProcess-specific and thread-specific keyrings are not counted towards a user’s quota.”…”�”}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K³hj¢ubhÌ)�”}”(hŒ‘If a system call that modifies a key or keyring in some way would put the user over quota, the operation is refused and error EDQUOT is returned.”h]”hŒ‘If a system call that modifies a key or keyring in some way would put the user over quota, the operation is refused and error EDQUOT is returned.”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¶hj¢ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hŒiThere's a system call interface by which userspace programs can create and manipulate keys and keyrings. ”h]”hÌ)�”}”(hŒhThere's a system call interface by which userspace programs can create and manipulate keys and keyrings.”h]”hŒjThere’s a system call interface by which userspace programs can create and manipulate keys and keyrings.”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¹hjäubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hŒUThere's a kernel interface by which services can register types and search for keys. ”h]”hÌ)�”}”(hŒTThere's a kernel interface by which services can register types and search for keys.”h]”hŒVThere’s a kernel interface by which services can register types and search for keys.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¼hjüubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hŒŒThere's a way for the a search done from the kernel to call back to userspace to request a key that can't be found in a process's keyrings. ”h]”hÌ)�”}”(hŒ‹There's a way for the a search done from the kernel to call back to userspace to request a key that can't be found in a process's keyrings.”h]”hŒ‘There’s a way for the a search done from the kernel to call back to userspace to request a key that can’t be found in a process’s keyrings.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¿hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubj*)�”}”(hŒcAn optional filesystem is available through which the key database can be viewed and manipulated. ”h]”hÌ)�”}”(hŒaAn optional filesystem is available through which the key database can be viewed and manipulated.”h]”hŒaAn optional filesystem is available through which the key database can be viewed and manipulated.”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÂhj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjƒubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´Krhjubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´Krhj`h²hubeh}”(h]”jdah ]”h"]”Œkey service overview”ah$]”h&]”uh1hµhh·h²hh³hÊh´Knubh¶)�”}”(hhh]”(h»)�”}”(hŒKey Access Permissions”h]”hŒKey Access Permissions”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄj€uh1hºhjWh²hh³hÊh´KÇubhÌ)�”}”(hŒåKeys have an owner user ID, a group access ID, and a permissions mask. The mask has up to eight bits each for possessor, user, group and other access. Only six of each set of eight bits are defined. These permissions granted are:”h]”hŒåKeys have an owner user ID, a group access ID, and a permissions mask. The mask has up to eight bits each for possessor, user, group and other access. Only six of each set of eight bits are defined. These permissions granted are:”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÉhjWh²hubhø)�”}”(hX * View This permits a key or keyring's attributes to be viewed - including key type and description. * Read This permits a key's payload to be viewed or a keyring's list of linked keys. * Write This permits a key's payload to be instantiated or updated, or it allows a link to be added to or removed from a keyring. * Search This permits keyrings to be searched and keys to be found. Searches can only recurse into nested keyrings that have search permission set. * Link This permits a key or keyring to be linked to. To create a link from a keyring to a key, a process must have Write permission on the keyring and Link permission on the key. * Set Attribute This permits a key's UID, GID and permissions mask to be changed. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒdView This permits a key or keyring's attributes to be viewed - including key type and description. ”h]”(hÌ)�”}”(hŒView”h]”hŒView”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÍhj}ubhÌ)�”}”(hŒ]This permits a key or keyring's attributes to be viewed - including key type and description.”h]”hŒ_This permits a key or keyring’s attributes to be viewed - including key type and description.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÏhj}ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubj*)�”}”(hŒTRead This permits a key's payload to be viewed or a keyring's list of linked keys. ”h]”(hÌ)�”}”(hŒRead”h]”hŒRead”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÒhj£ubhÌ)�”}”(hŒMThis permits a key's payload to be viewed or a keyring's list of linked keys.”h]”hŒQThis permits a key’s payload to be viewed or a keyring’s list of linked keys.”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÔhj£ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubj*)�”}”(hŒ�Write This permits a key's payload to be instantiated or updated, or it allows a link to be added to or removed from a keyring. ”h]”(hÌ)�”}”(hŒWrite”h]”hŒWrite”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K×hjÉubhÌ)�”}”(hŒyThis permits a key's payload to be instantiated or updated, or it allows a link to be added to or removed from a keyring.”h]”hŒ{This permits a key’s payload to be instantiated or updated, or it allows a link to be added to or removed from a keyring.”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÙhjÉubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubj*)�”}”(hŒ“Search This permits keyrings to be searched and keys to be found. Searches can only recurse into nested keyrings that have search permission set. ”h]”(hÌ)�”}”(hŒSearch”h]”hŒSearch”…”�”}”(hjóh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÜhjïubhÌ)�”}”(hŒŠThis permits keyrings to be searched and keys to be found. Searches can only recurse into nested keyrings that have search permission set.”h]”hŒŠThis permits keyrings to be searched and keys to be found. Searches can only recurse into nested keyrings that have search permission set.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÞhjïubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubj*)�”}”(hŒ³Link This permits a key or keyring to be linked to. To create a link from a keyring to a key, a process must have Write permission on the keyring and Link permission on the key. ”h]”(hÌ)�”}”(hŒLink”h]”hŒLink”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KáhjubhÌ)�”}”(hŒ¬This permits a key or keyring to be linked to. To create a link from a keyring to a key, a process must have Write permission on the keyring and Link permission on the key.”h]”hŒ¬This permits a key or keyring to be linked to. To create a link from a keyring to a key, a process must have Write permission on the keyring and Link permission on the key.”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kãhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubj*)�”}”(hŒQSet Attribute This permits a key's UID, GID and permissions mask to be changed. ”h]”(hÌ)�”}”(hŒ Set Attribute”h]”hŒ Set Attribute”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kçhj;ubhÌ)�”}”(hŒAThis permits a key's UID, GID and permissions mask to be changed.”h]”hŒCThis permits a key’s UID, GID and permissions mask to be changed.”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kéhj;ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjzubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´KÍhjvubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´KÍhjWh²hubhÌ)�”}”(hŒ…For changing the ownership, group ID or permissions mask, being the owner of the key or having the sysadmin capability is sufficient.”h]”hŒ…For changing the ownership, group ID or permissions mask, being the owner of the key or having the sysadmin capability is sufficient.”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KëhjWh²hubeh}”(h]”j†ah ]”h"]”Œkey access permissions”ah$]”h&]”uh1hµhh·h²hh³hÊh´KÇubh¶)�”}”(hhh]”(h»)�”}”(hŒSELinux Support”h]”hŒSELinux Support”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄj¢uh1hºhj‚h²hh³hÊh´KðubhÌ)�”}”(hX”The security class "key" has been added to SELinux so that mandatory access controls can be applied to keys created within various contexts. This support is preliminary, and is likely to change quite significantly in the near future. Currently, all of the basic permissions explained above are provided in SELinux as well; SELinux is simply invoked after all basic permission checks have been performed.”h]”hX˜The security class “keyâ€� has been added to SELinux so that mandatory access controls can be applied to keys created within various contexts. This support is preliminary, and is likely to change quite significantly in the near future. Currently, all of the basic permissions explained above are provided in SELinux as well; SELinux is simply invoked after all basic permission checks have been performed.”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kòhj‚h²hubhÌ)�”}”(hXÙThe value of the file /proc/self/attr/keycreate influences the labeling of newly-created keys. If the contents of that file correspond to an SELinux security context, then the key will be assigned that context. Otherwise, the key will be assigned the current context of the task that invoked the key creation request. Tasks must be granted explicit permission to assign a particular context to newly-created keys, using the "create" permission in the key security class.”h]”hXÝThe value of the file /proc/self/attr/keycreate influences the labeling of newly-created keys. If the contents of that file correspond to an SELinux security context, then the key will be assigned that context. Otherwise, the key will be assigned the current context of the task that invoked the key creation request. Tasks must be granted explicit permission to assign a particular context to newly-created keys, using the “createâ€� permission in the key security class.”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kùhj‚h²hubhÌ)�”}”(hX"The default keyrings associated with users will be labeled with the default context of the user if and only if the login programs have been instrumented to properly initialize keycreate during the login process. Otherwise, they will be labeled with the context of the login program itself.”h]”hX"The default keyrings associated with users will be labeled with the default context of the user if and only if the login programs have been instrumented to properly initialize keycreate during the login process. Otherwise, they will be labeled with the context of the login program itself.”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj‚h²hubhÌ)�”}”(hŒÉNote, however, that the default keyrings associated with the root user are labeled with the default kernel context, since they are created early in the boot process, before root has a chance to log in.”h]”hŒÉNote, however, that the default keyrings associated with the root user are labeled with the default kernel context, since they are created early in the boot process, before root has a chance to log in.”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj‚h²hubhÌ)�”}”(hŒ£The keyrings associated with new threads are each labeled with the context of their associated thread, and both session and process keyrings are handled similarly.”h]”hŒ£The keyrings associated with new threads are each labeled with the context of their associated thread, and both session and process keyrings are handled similarly.”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj‚h²hubeh}”(h]”j¨ah ]”h"]”Œselinux support”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kðubh¶)�”}”(hhh]”(h»)�”}”(hŒNew ProcFS Files”h]”hŒNew ProcFS Files”…”�”}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄjÄuh1hºhjàh²hh³hÊh´MubhÌ)�”}”(hŒoTwo files have been added to procfs by which an administrator can find out about the status of the key service:”h]”hŒoTwo files have been added to procfs by which an administrator can find out about the status of the key service:”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhjàh²hubhø)�”}”(hXô* /proc/keys This lists the keys that are currently viewable by the task reading the file, giving information about their type, description and permissions. It is not possible to view the payload of the key this way, though some information about it may be given. The only keys included in the list are those that grant View permission to the reading process whether or not it possesses them. Note that LSM security checks are still performed, and may further filter out keys that the current process is not authorised to view. The contents of the file look like this:: SERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY 00000001 I----- 39 perm 1f3f0000 0 0 keyring _uid_ses.0: 1/4 00000002 I----- 2 perm 1f3f0000 0 0 keyring _uid.0: empty 00000007 I----- 1 perm 1f3f0000 0 0 keyring _pid.1: empty 0000018d I----- 1 perm 1f3f0000 0 0 keyring _pid.412: empty 000004d2 I--Q-- 1 perm 1f3f0000 32 -1 keyring _uid.32: 1/4 000004d3 I--Q-- 3 perm 1f3f0000 32 -1 keyring _uid_ses.32: empty 00000892 I--QU- 1 perm 1f000000 0 0 user metal:copper: 0 00000893 I--Q-N 1 35s 1f3f0000 0 0 user metal:silver: 0 00000894 I--Q-- 1 10h 003f0000 0 0 user metal:gold: 0 The flags are:: I Instantiated R Revoked D Dead Q Contributes to user's quota U Under construction by callback to userspace N Negative key * /proc/key-users This file lists the tracking data for each user that has at least one key on the system. Such data includes quota information and statistics:: [root@andromeda root]# cat /proc/key-users 0: 46 45/45 1/100 13/10000 29: 2 2/2 2/100 40/10000 32: 2 2/2 2/100 40/10000 38: 2 2/2 2/100 40/10000 The format of each line is:: : User ID to which this applies Structure refcount / Total number of keys and number instantiated / Key count quota / Key size quota ”h]”j%)�”}”(hhh]”(j*)�”}”(hX/proc/keys This lists the keys that are currently viewable by the task reading the file, giving information about their type, description and permissions. It is not possible to view the payload of the key this way, though some information about it may be given. The only keys included in the list are those that grant View permission to the reading process whether or not it possesses them. Note that LSM security checks are still performed, and may further filter out keys that the current process is not authorised to view. The contents of the file look like this:: SERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY 00000001 I----- 39 perm 1f3f0000 0 0 keyring _uid_ses.0: 1/4 00000002 I----- 2 perm 1f3f0000 0 0 keyring _uid.0: empty 00000007 I----- 1 perm 1f3f0000 0 0 keyring _pid.1: empty 0000018d I----- 1 perm 1f3f0000 0 0 keyring _pid.412: empty 000004d2 I--Q-- 1 perm 1f3f0000 32 -1 keyring _uid.32: 1/4 000004d3 I--Q-- 3 perm 1f3f0000 32 -1 keyring _uid_ses.32: empty 00000892 I--QU- 1 perm 1f000000 0 0 user metal:copper: 0 00000893 I--Q-N 1 35s 1f3f0000 0 0 user metal:silver: 0 00000894 I--Q-- 1 10h 003f0000 0 0 user metal:gold: 0 The flags are:: I Instantiated R Revoked D Dead Q Contributes to user's quota U Under construction by callback to userspace N Negative key ”h]”(hÌ)�”}”(hŒ /proc/keys”h]”hŒ /proc/keys”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj ubhÌ)�”}”(hŒúThis lists the keys that are currently viewable by the task reading the file, giving information about their type, description and permissions. It is not possible to view the payload of the key this way, though some information about it may be given.”h]”hŒúThis lists the keys that are currently viewable by the task reading the file, giving information about their type, description and permissions. It is not possible to view the payload of the key this way, though some information about it may be given.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj ubhÌ)�”}”(hXThe only keys included in the list are those that grant View permission to the reading process whether or not it possesses them. Note that LSM security checks are still performed, and may further filter out keys that the current process is not authorised to view.”h]”hXThe only keys included in the list are those that grant View permission to the reading process whether or not it possesses them. Note that LSM security checks are still performed, and may further filter out keys that the current process is not authorised to view.”…”�”}”(hj& h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj ubhÌ)�”}”(hŒ)The contents of the file look like this::”h]”hŒ(The contents of the file look like this:”…”�”}”(hj4 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M!hj ubhŒ literal_block”“”)�”}”(hXâSERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY 00000001 I----- 39 perm 1f3f0000 0 0 keyring _uid_ses.0: 1/4 00000002 I----- 2 perm 1f3f0000 0 0 keyring _uid.0: empty 00000007 I----- 1 perm 1f3f0000 0 0 keyring _pid.1: empty 0000018d I----- 1 perm 1f3f0000 0 0 keyring _pid.412: empty 000004d2 I--Q-- 1 perm 1f3f0000 32 -1 keyring _uid.32: 1/4 000004d3 I--Q-- 3 perm 1f3f0000 32 -1 keyring _uid_ses.32: empty 00000892 I--QU- 1 perm 1f000000 0 0 user metal:copper: 0 00000893 I--Q-N 1 35s 1f3f0000 0 0 user metal:silver: 0 00000894 I--Q-- 1 10h 003f0000 0 0 user metal:gold: 0”h]”hXâSERIAL FLAGS USAGE EXPY PERM UID GID TYPE DESCRIPTION: SUMMARY 00000001 I----- 39 perm 1f3f0000 0 0 keyring _uid_ses.0: 1/4 00000002 I----- 2 perm 1f3f0000 0 0 keyring _uid.0: empty 00000007 I----- 1 perm 1f3f0000 0 0 keyring _pid.1: empty 0000018d I----- 1 perm 1f3f0000 0 0 keyring _pid.412: empty 000004d2 I--Q-- 1 perm 1f3f0000 32 -1 keyring _uid.32: 1/4 000004d3 I--Q-- 3 perm 1f3f0000 32 -1 keyring _uid_ses.32: empty 00000892 I--QU- 1 perm 1f000000 0 0 user metal:copper: 0 00000893 I--Q-N 1 35s 1f3f0000 0 0 user metal:silver: 0 00000894 I--Q-- 1 10h 003f0000 0 0 user metal:gold: 0”…”�”}”hjD sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jB h³hÊh´M#hj ubhÌ)�”}”(hŒThe flags are::”h]”hŒThe flags are:”…”�”}”(hjT h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M.hj ubjC )�”}”(hŒžI Instantiated R Revoked D Dead Q Contributes to user's quota U Under construction by callback to userspace N Negative key”h]”hŒžI Instantiated R Revoked D Dead Q Contributes to user's quota U Under construction by callback to userspace N Negative key”…”�”}”hjb sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M0hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj ubj*)�”}”(hXv/proc/key-users This file lists the tracking data for each user that has at least one key on the system. Such data includes quota information and statistics:: [root@andromeda root]# cat /proc/key-users 0: 46 45/45 1/100 13/10000 29: 2 2/2 2/100 40/10000 32: 2 2/2 2/100 40/10000 38: 2 2/2 2/100 40/10000 The format of each line is:: : User ID to which this applies Structure refcount / Total number of keys and number instantiated / Key count quota / Key size quota ”h]”(hÌ)�”}”(hŒ/proc/key-users”h]”hŒ/proc/key-users”…”�”}”(hjz h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hjv ubhÌ)�”}”(hŒ�This file lists the tracking data for each user that has at least one key on the system. Such data includes quota information and statistics::”h]”hŒŽThis file lists the tracking data for each user that has at least one key on the system. Such data includes quota information and statistics:”…”�”}”(hjˆ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M:hjv ubjC )�”}”(hŒ [root@andromeda root]# cat /proc/key-users 0: 46 45/45 1/100 13/10000 29: 2 2/2 2/100 40/10000 32: 2 2/2 2/100 40/10000 38: 2 2/2 2/100 40/10000”h]”hŒ [root@andromeda root]# cat /proc/key-users 0: 46 45/45 1/100 13/10000 29: 2 2/2 2/100 40/10000 32: 2 2/2 2/100 40/10000 38: 2 2/2 2/100 40/10000”…”�”}”hj– sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M=hjv ubhÌ)�”}”(hŒThe format of each line is::”h]”hŒThe format of each line is:”…”�”}”(hj¤ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MChjv ubjC )�”}”(hŒô: User ID to which this applies Structure refcount / Total number of keys and number instantiated / Key count quota / Key size quota”h]”hŒô: User ID to which this applies Structure refcount / Total number of keys and number instantiated / Key count quota / Key size quota”…”�”}”hj² sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MEhjv ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´Mhjÿubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´Mhjàh²hubhÌ)�”}”(hŒcFour new sysctl files have been added also for the purpose of controlling the quota limits on keys:”h]”hŒcFour new sysctl files have been added also for the purpose of controlling the quota limits on keys:”…”�”}”(hjÒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MLhjàh²hubhø)�”}”(hXî* /proc/sys/kernel/keys/root_maxkeys /proc/sys/kernel/keys/root_maxbytes These files hold the maximum number of keys that root may have and the maximum total number of bytes of data that root may have stored in those keys. * /proc/sys/kernel/keys/maxkeys /proc/sys/kernel/keys/maxbytes These files hold the maximum number of keys that each non-root user may have and the maximum total number of bytes of data that each of those users may have stored in their keys. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒÞ/proc/sys/kernel/keys/root_maxkeys /proc/sys/kernel/keys/root_maxbytes These files hold the maximum number of keys that root may have and the maximum total number of bytes of data that root may have stored in those keys. ”h]”(hÌ)�”}”(hŒF/proc/sys/kernel/keys/root_maxkeys /proc/sys/kernel/keys/root_maxbytes”h]”hŒF/proc/sys/kernel/keys/root_maxkeys /proc/sys/kernel/keys/root_maxbytes”…”�”•}”(hjë h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MOhjç ubhÌ)�”}”(hŒ•These files hold the maximum number of keys that root may have and the maximum total number of bytes of data that root may have stored in those keys.”h]”hŒ•These files hold the maximum number of keys that root may have and the maximum total number of bytes of data that root may have stored in those keys.”…”�”}”(hjù h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MRhjç ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjä ubj*)�”}”(hŒñ/proc/sys/kernel/keys/maxkeys /proc/sys/kernel/keys/maxbytes These files hold the maximum number of keys that each non-root user may have and the maximum total number of bytes of data that each of those users may have stored in their keys. ”h]”(hÌ)�”}”(hŒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¤hj: ubjC )�”}”(hŒ«key_serial_t request_key(const char *type, const char *description, const char *callout_info, key_serial_t dest_keyring);”h]”hŒ«key_serial_t request_key(const char *type, const char *description, const char *callout_info, key_serial_t dest_keyring);”…”�”}”hjL sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M§hj: ubhÌ)�”}”(hŒÚThis function searches all the process's keyrings in the order thread, process, session for a matching key. This works very much like KEYCTL_SEARCH, including the optional attachment of the discovered key to a keyring.”h]”hŒÜThis function searches all the process’s keyrings in the order thread, process, session for a matching key. This works very much like KEYCTL_SEARCH, including the optional attachment of the discovered key to a keyring.”…”�”}”(hjZ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M«hj: ubhÌ)�”}”(hŒÆIf a key cannot be found, and if callout_info is not NULL, then /sbin/request-key will be invoked in an attempt to obtain a key. The callout_info string will be passed as an argument to the program.”h]”hŒÆIf a key cannot be found, and if callout_info is not NULL, then /sbin/request-key will be invoked in an attempt to obtain a key. The callout_info string will be passed as an argument to the program.”…”�”}”(hjh h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M°hj: ubhÌ)�”}”(hŒ“To link a key into the destination keyring the key must grant link permission on the key to the caller and the keyring must grant write permission.”h]”hŒ“To link a key into the destination keyring the key must grant link permission on the key to the caller and the keyring must grant write permission.”…”�”}”(hjv h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M´hj: ubhÌ)�”}”(hŒ5See also Documentation/security/keys/request-key.rst.”h]”hŒ5See also Documentation/security/keys/request-key.rst.”…”�”}”(hj„ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¸hj: ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¡ ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M{hj� ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M{hjT h²hubhÌ)�”}”(hŒ!The keyctl syscall functions are:”h]”hŒ!The keyctl syscall functions are:”…”�”}”(hj¤ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M»hjT h²hubhø)�”}”(hXœc* Map a special key ID to a real key ID for this process:: key_serial_t keyctl(KEYCTL_GET_KEYRING_ID, key_serial_t id, int create); The special key specified by "id" is looked up (with the key being created if necessary) and the ID of the key or keyring thus found is returned if it exists. If the key does not yet exist, the key will be created if "create" is non-zero; and the error ENOKEY will be returned if "create" is zero. * Replace the session keyring this process subscribes to with a new one:: key_serial_t keyctl(KEYCTL_JOIN_SESSION_KEYRING, const char *name); If name is NULL, an anonymous keyring is created attached to the process as its session keyring, displacing the old session keyring. If name is not NULL, if a keyring of that name exists, the process attempts to attach it as the session keyring, returning an error if that is not permitted; otherwise a new keyring of that name is created and attached as the session keyring. To attach to a named keyring, the keyring must have search permission for the process's ownership. The ID of the new session keyring is returned if successful. * Update the specified key:: long keyctl(KEYCTL_UPDATE, key_serial_t key, const void *payload, size_t plen); This will try to update the specified key with the given payload, or it will return error EOPNOTSUPP if that function is not supported by the key type. The process must also have permission to write to the key to be able to update it. The payload is of length plen, and may be absent or empty as for add_key(). * Revoke a key:: long keyctl(KEYCTL_REVOKE, key_serial_t key); This makes a key unavailable for further operations. Further attempts to use the key will be met with error EKEYREVOKED, and the key will no longer be findable. * Change the ownership of a key:: long keyctl(KEYCTL_CHOWN, key_serial_t key, uid_t uid, gid_t gid); This function permits a key's owner and group ID to be changed. Either one of uid or gid can be set to -1 to suppress that change. Only the superuser can change a key's owner to something other than the key's current owner. Similarly, only the superuser can change a key's group ID to something other than the calling process's group ID or one of its group list members. * Change the permissions mask on a key:: long keyctl(KEYCTL_SETPERM, key_serial_t key, key_perm_t perm); This function permits the owner of a key or the superuser to change the permissions mask on a key. Only bits the available bits are permitted; if any other bits are set, error EINVAL will be returned. * Describe a key:: long keyctl(KEYCTL_DESCRIBE, key_serial_t key, char *buffer, size_t buflen); This function returns a summary of the key's attributes (but not its payload data) as a string in the buffer provided. Unless there's an error, it always returns the amount of data it could produce, even if that's too big for the buffer, but it won't copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place. A process must have view permission on the key for this function to be successful. If successful, a string is placed in the buffer in the following format:: ;;;; Where type and description are strings, uid and gid are decimal, and perm is hexadecimal. A NUL character is included at the end of the string if the buffer is sufficiently big. This can be parsed with:: sscanf(buffer, "%[^;];%d;%d;%o;%s", type, &uid, &gid, &mode, desc); * Clear out a keyring:: long keyctl(KEYCTL_CLEAR, key_serial_t keyring); This function clears the list of keys attached to a keyring. The calling process must have write permission on the keyring, and it must be a keyring (or else error ENOTDIR will result). This function can also be used to clear special kernel keyrings if they are appropriately marked if the user has CAP_SYS_ADMIN capability. The DNS resolver cache keyring is an example of this. * Link a key into a keyring:: long keyctl(KEYCTL_LINK, key_serial_t keyring, key_serial_t key); This function creates a link from the keyring to the key. The process must have write permission on the keyring and must have link permission on the key. Should the keyring not be a keyring, error ENOTDIR will result; and if the keyring is full, error ENFILE will result. The link procedure checks the nesting of the keyrings, returning ELOOP if it appears too deep or EDEADLK if the link would introduce a cycle. Any links within the keyring to keys that match the new key in terms of type and description will be discarded from the keyring as the new one is added. * Move a key from one keyring to another:: long keyctl(KEYCTL_MOVE, key_serial_t id, key_serial_t from_ring_id, key_serial_t to_ring_id, unsigned int flags); Move the key specified by "id" from the keyring specified by "from_ring_id" to the keyring specified by "to_ring_id". If the two keyrings are the same, nothing is done. "flags" can have KEYCTL_MOVE_EXCL set in it to cause the operation to fail with EEXIST if a matching key exists in the destination keyring, otherwise such a key will be replaced. A process must have link permission on the key for this function to be successful and write permission on both keyrings. Any errors that can occur from KEYCTL_LINK also apply on the destination keyring here. * Unlink a key or keyring from another keyring:: long keyctl(KEYCTL_UNLINK, key_serial_t keyring, key_serial_t key); This function looks through the keyring for the first link to the specified key, and removes it if found. Subsequent links to that key are ignored. The process must have write permission on the keyring. If the keyring is not a keyring, error ENOTDIR will result; and if the key is not present, error ENOENT will be the result. * Search a keyring tree for a key:: key_serial_t keyctl(KEYCTL_SEARCH, key_serial_t keyring, const char *type, const char *description, key_serial_t dest_keyring); This searches the keyring tree headed by the specified keyring until a key is found that matches the type and description criteria. Each keyring is checked for keys before recursion into its children occurs. The process must have search permission on the top level keyring, or else error EACCES will result. Only keyrings that the process has search permission on will be recursed into, and only keys and keyrings for which a process has search permission can be matched. If the specified keyring is not a keyring, ENOTDIR will result. If the search succeeds, the function will attempt to link the found key into the destination keyring if one is supplied (non-zero ID). All the constraints applicable to KEYCTL_LINK apply in this case too. Error ENOKEY, EKEYREVOKED or EKEYEXPIRED will be returned if the search fails. On success, the resulting key ID will be returned. * Read the payload data from a key:: long keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, size_t buflen); This function attempts to read the payload data from the specified key into the buffer. The process must have read permission on the key to succeed. The returned data will be processed for presentation by the key type. For instance, a keyring will return an array of key_serial_t entries representing the IDs of all the keys to which it is subscribed. The user defined key type will return its data as is. If a key type does not implement this function, error EOPNOTSUPP will result. If the specified buffer is too small, then the size of the buffer required will be returned. Note that in this case, the contents of the buffer may have been overwritten in some undefined way. Otherwise, on success, the function will return the amount of data copied into the buffer. * Instantiate a partially constructed key:: long keyctl(KEYCTL_INSTANTIATE, key_serial_t key, const void *payload, size_t plen, key_serial_t keyring); long keyctl(KEYCTL_INSTANTIATE_IOV, key_serial_t key, const struct iovec *payload_iov, unsigned ioc, key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the invoked process returns, or else the key will be marked negative automatically. The process must have write access on the key to be able to instantiate it, and the key must be uninstantiated. If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too. The payload and plen arguments describe the payload data as for add_key(). The payload_iov and ioc arguments describe the payload data in an iovec array instead of a single buffer. * Negatively instantiate a partially constructed key:: long keyctl(KEYCTL_NEGATE, key_serial_t key, unsigned timeout, key_serial_t keyring); long keyctl(KEYCTL_REJECT, key_serial_t key, unsigned timeout, unsigned error, key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call mark the key as negative before the invoked process returns if it is unable to fulfill the request. The process must have write access on the key to be able to instantiate it, and the key must be uninstantiated. If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too. If the key is rejected, future searches for it will return the specified error code until the rejected key expires. Negating the key is the same as rejecting the key with ENOKEY as the error code. * Set the default request-key destination keyring:: long keyctl(KEYCTL_SET_REQKEY_KEYRING, int reqkey_defl); This sets the default keyring to which implicitly requested keys will be attached for this thread. reqkey_defl should be one of these constants:: CONSTANT VALUE NEW DEFAULT KEYRING ====================================== ====== ======================= KEY_REQKEY_DEFL_NO_CHANGE -1 No change KEY_REQKEY_DEFL_DEFAULT 0 Default[1] KEY_REQKEY_DEFL_THREAD_KEYRING 1 Thread keyring KEY_REQKEY_DEFL_PROCESS_KEYRING 2 Process keyring KEY_REQKEY_DEFL_SESSION_KEYRING 3 Session keyring KEY_REQKEY_DEFL_USER_KEYRING 4 User keyring KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 User session keyring KEY_REQKEY_DEFL_GROUP_KEYRING 6 Group keyring The old default will be returned if successful and error EINVAL will be returned if reqkey_defl is not one of the above values. The default keyring can be overridden by the keyring indicated to the request_key() system call. Note that this setting is inherited across fork/exec. [1] The default is: the thread keyring if there is one, otherwise the process keyring if there is one, otherwise the session keyring if there is one, otherwise the user default session keyring. * Set the timeout on a key:: long keyctl(KEYCTL_SET_TIMEOUT, key_serial_t key, unsigned timeout); This sets or clears the timeout on a key. The timeout can be 0 to clear the timeout or a number of seconds to set the expiry time that far into the future. The process must have attribute modification access on a key to set its timeout. Timeouts may not be set with this function on negative, revoked or expired keys. * Assume the authority granted to instantiate a key:: long keyctl(KEYCTL_ASSUME_AUTHORITY, key_serial_t key); This assumes or divests the authority required to instantiate the specified key. Authority can only be assumed if the thread has the authorisation key associated with the specified key in its keyrings somewhere. Once authority is assumed, searches for keys will also search the requester's keyrings using the requester's security label, UID, GID and groups. If the requested authority is unavailable, error EPERM will be returned, likewise if the authority has been revoked because the target key is already instantiated. If the specified key is 0, then any assumed authority will be divested. The assumed authoritative key is inherited across fork and exec. * Get the LSM security context attached to a key:: long keyctl(KEYCTL_GET_SECURITY, key_serial_t key, char *buffer, size_t buflen) This function returns a string that represents the LSM security context attached to a key in the buffer provided. Unless there's an error, it always returns the amount of data it could produce, even if that's too big for the buffer, but it won't copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place. A NUL character is included at the end of the string if the buffer is sufficiently big. This is included in the returned count. If no LSM is in force then an empty string will be returned. A process must have view permission on the key for this function to be successful. * Install the calling process's session keyring on its parent:: long keyctl(KEYCTL_SESSION_TO_PARENT); This functions attempts to install the calling process's session keyring on to the calling process's parent, replacing the parent's current session keyring. The calling process must have the same ownership as its parent, the keyring must have the same ownership as the calling process, the calling process must have LINK permission on the keyring and the active LSM module mustn't deny permission, otherwise error EPERM will be returned. Error ENOMEM will be returned if there was insufficient memory to complete the operation, otherwise 0 will be returned to indicate success. The keyring will be replaced next time the parent process leaves the kernel and resumes executing userspace. * Invalidate a key:: long keyctl(KEYCTL_INVALIDATE, key_serial_t key); This function marks a key as being invalidated and then wakes up the garbage collector. The garbage collector immediately removes invalidated keys from all keyrings and deletes the key when its reference count reaches zero. Keys that are marked invalidated become invisible to normal key operations immediately, though they are still visible in /proc/keys until deleted (they're marked with an 'i' flag). A process must have search permission on the key for this function to be successful. * Compute a Diffie-Hellman shared secret or public key:: long keyctl(KEYCTL_DH_COMPUTE, struct keyctl_dh_params *params, char *buffer, size_t buflen, struct keyctl_kdf_params *kdf); The params struct contains serial numbers for three keys:: - The prime, p, known to both parties - The local private key - The base integer, which is either a shared generator or the remote public key The value computed is:: result = base ^ private (mod prime) If the base is the shared generator, the result is the local public key. If the base is the remote public key, the result is the shared secret. If the parameter kdf is NULL, the following applies: - The buffer length must be at least the length of the prime, or zero. - If the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned. The kdf parameter allows the caller to apply a key derivation function (KDF) on the Diffie-Hellman computation where only the result of the KDF is returned to the caller. The KDF is characterized with struct keyctl_kdf_params as follows: - ``char *hashname`` specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF). - ``char *otherinfo`` specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used. This function will return error EOPNOTSUPP if the key type is not supported, error ENOKEY if the key could not be found, or error EACCES if the key is not readable by the caller. In addition, the function will return EMSGSIZE when the parameter kdf is non-NULL and either the buffer length or the OtherInfo length exceeds the allowed length. * Restrict keyring linkage:: long keyctl(KEYCTL_RESTRICT_KEYRING, key_serial_t keyring, const char *type, const char *restriction); An existing keyring can restrict linkage of additional keys by evaluating the contents of the key according to a restriction scheme. "keyring" is the key ID for an existing keyring to apply a restriction to. It may be empty or may already have keys linked. Existing linked keys will remain in the keyring even if the new restriction would reject them. "type" is a registered key type. "restriction" is a string describing how key linkage is to be restricted. The format varies depending on the key type, and the string is passed to the lookup_restriction() function for the requested type. It may specify a method and relevant data for the restriction such as signature verification or constraints on key payload. If the requested key type is later unregistered, no keys may be added to the keyring after the key type is removed. To apply a keyring restriction the process must have Set Attribute permission and the keyring must not be previously restricted. One application of restricted keyrings is to verify X.509 certificate chains or individual certificate signatures using the asymmetric key type. See Documentation/crypto/asymmetric-keys.rst for specific restrictions applicable to the asymmetric key type. * Query an asymmetric key:: long keyctl(KEYCTL_PKEY_QUERY, key_serial_t key_id, unsigned long reserved, const char *params, struct keyctl_pkey_query *info); Get information about an asymmetric key. Specific algorithms and encodings may be queried by using the ``params`` argument. This is a string containing a space- or tab-separated string of key-value pairs. Currently supported keys include ``enc`` and ``hash``. The information is returned in the keyctl_pkey_query struct:: __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; __u32 __spare[10]; ``supported_ops`` contains a bit mask of flags indicating which ops are supported. This is constructed from a bitwise-OR of:: KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY} ``key_size`` indicated the size of the key in bits. ``max_*_size`` indicate the maximum sizes in bytes of a blob of data to be signed, a signature blob, a blob to be encrypted and a blob to be decrypted. ``__spare[]`` must be set to 0. This is intended for future use to hand over one or more passphrases needed unlock a key. If successful, 0 is returned. If the key is not an asymmetric key, EOPNOTSUPP is returned. * Encrypt, decrypt, sign or verify a blob using an asymmetric key:: long keyctl(KEYCTL_PKEY_ENCRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_DECRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_SIGN, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_VERIFY, const struct keyctl_pkey_params *params, const char *info, const void *in, const void *in2); Use an asymmetric key to perform a public-key cryptographic operation a blob of data. For encryption and verification, the asymmetric key may only need the public parts to be available, but for decryption and signing the private parts are required also. The parameter block pointed to by params contains a number of integer values:: __s32 key_id; __u32 in_len; __u32 out_len; __u32 in2_len; ``key_id`` is the ID of the asymmetric key to be used. ``in_len`` and ``in2_len`` indicate the amount of data in the in and in2 buffers and ``out_len`` indicates the size of the out buffer as appropriate for the above operations. For a given operation, the in and out buffers are used as follows:: Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== KEYCTL_PKEY_ENCRYPT Raw data Encrypted data - KEYCTL_PKEY_DECRYPT Encrypted data Raw data - KEYCTL_PKEY_SIGN Raw data Signature - KEYCTL_PKEY_VERIFY Raw data - Signature ``info`` is a string of key=value pairs that supply supplementary information. These include: ``enc=`` The encoding of the encrypted/signature blob. This can be "pkcs1" for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; "pss" for "RSASSA-PSS"; "oaep" for "RSAES-OAEP". If omitted or is "raw", the raw output of the encryption function is specified. ``hash=`` If the data buffer contains the output of a hash function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. "hash=sha256". The ``__spare[]`` space in the parameter block must be set to 0. This is intended, amongst other things, to allow the passing of passphrases required to unlock a key. If successful, encrypt, decrypt and sign all return the amount of data written into the output buffer. Verification returns 0 on success. * Watch a key or keyring for changes:: long keyctl(KEYCTL_WATCH_KEY, key_serial_t key, int queue_fd, const struct watch_notification_filter *filter); This will set or remove a watch for changes on the specified key or keyring. "key" is the ID of the key to be watched. "queue_fd" is a file descriptor referring to an open pipe which manages the buffer into which notifications will be delivered. "filter" is either NULL to remove a watch or a filter specification to indicate what events are required from the key. See Documentation/core-api/watch_queue.rst for more information. Note that only one watch may be emplaced for any particular { key, queue_fd } combination. Notification records look like:: struct key_notification { struct watch_notification watch; __u32 key_id; __u32 aux; }; In this, watch::type will be "WATCH_TYPE_KEY_NOTIFY" and subtype will be one of:: NOTIFY_KEY_INSTANTIATED NOTIFY_KEY_UPDATED NOTIFY_KEY_LINKED NOTIFY_KEY_UNLINKED NOTIFY_KEY_CLEARED NOTIFY_KEY_REVOKED NOTIFY_KEY_INVALIDATED NOTIFY_KEY_SETATTR Where these indicate a key being instantiated/rejected, updated, a link being made in a keyring, a link being removed from a keyring, a keyring being cleared, a key being revoked, a key being invalidated or a key having one of its attributes changed (user, group, perm, timeout, restriction). If a watched key is deleted, a basic watch_notification will be issued with "type" set to WATCH_TYPE_META and "subtype" set to watch_meta_removal_notification. The watchpoint ID will be set in the "info" field. This needs to be configured by enabling: "Provide key/keyring change notifications" (KEY_NOTIFICATIONS) ”h]”j%)�”}”(hhh]”(j*)�”}”(hXÊMap a special key ID to a real key ID for this process:: key_serial_t keyctl(KEYCTL_GET_KEYRING_ID, key_serial_t id, int create); The special key specified by "id" is looked up (with the key being created if necessary) and the ID of the key or keyring thus found is returned if it exists. If the key does not yet exist, the key will be created if "create" is non-zero; and the error ENOKEY will be returned if "create" is zero. ”h]”(hÌ)�”}”(hŒ8Map a special key ID to a real key ID for this process::”h]”hŒ7Map a special key ID to a real key ID for this process:”…”�”}”(hj½ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M½hj¹ ubjC )�”}”(hŒ\key_serial_t keyctl(KEYCTL_GET_KEYRING_ID, key_serial_t id, int create);”h]”hŒ\key_serial_t keyctl(KEYCTL_GET_KEYRING_ID, key_serial_t id, int create);”…”�”}”hjË sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M¿hj¹ ubhÌ)�”}”(hŒžThe special key specified by "id" is looked up (with the key being created if necessary) and the ID of the key or keyring thus found is returned if it exists.”h]”hŒ¢The special key specified by “idâ€� is looked up (with the key being created if necessary) and the ID of the key or keyring thus found is returned if it exists.”…”�”}”(hjÙ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÂhj¹ ubhÌ)�”}”(hŒŠIf the key does not yet exist, the key will be created if "create" is non-zero; and the error ENOKEY will be returned if "create" is zero.”h]”hŒ’If the key does not yet exist, the key will be created if “createâ€� is non-zero; and the error ENOKEY will be returned if “createâ€� is zero.”…”�”}”(hjç h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÆhj¹ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX­Replace the session keyring this process subscribes to with a new one:: key_serial_t keyctl(KEYCTL_JOIN_SESSION_KEYRING, const char *name); If name is NULL, an anonymous keyring is created attached to the process as its session keyring, displacing the old session keyring. If name is not NULL, if a keyring of that name exists, the process attempts to attach it as the session keyring, returning an error if that is not permitted; otherwise a new keyring of that name is created and attached as the session keyring. To attach to a named keyring, the keyring must have search permission for the process's ownership. The ID of the new session keyring is returned if successful. ”h]”(hÌ)�”}”(hŒGReplace the session keyring this process subscribes to with a new one::”h]”hŒFReplace the session keyring this process subscribes to with a new one:”…”�”}”(hjÿ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÊhjû ubjC )�”}”(hŒCkey_serial_t keyctl(KEYCTL_JOIN_SESSION_KEYRING, const char *name);”h]”hŒCkey_serial_t keyctl(KEYCTL_JOIN_SESSION_KEYRING, const char *name);”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MÌhjû ubhÌ)�”}”(hŒ„If name is NULL, an anonymous keyring is created attached to the process as its session keyring, displacing the old session keyring.”h]”hŒ„If name is NULL, an anonymous keyring is created attached to the process as its session keyring, displacing the old session keyring.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÎhjû ubhÌ)�”}”(hŒòIf name is not NULL, if a keyring of that name exists, the process attempts to attach it as the session keyring, returning an error if that is not permitted; otherwise a new keyring of that name is created and attached as the session keyring.”h]”hŒòIf name is not NULL, if a keyring of that name exists, the process attempts to attach it as the session keyring, returning an error if that is not permitted; otherwise a new keyring of that name is created and attached as the session keyring.”…”�”}”(hj) h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÑhjû ubhÌ)�”}”(hŒbTo attach to a named keyring, the keyring must have search permission for the process's ownership.”h]”hŒdTo attach to a named keyring, the keyring must have search permission for the process’s ownership.”…”�”}”(hj7 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÖhjû ubhÌ)�”}”(hŒ;;;; Where type and description are strings, uid and gid are decimal, and perm is hexadecimal. A NUL character is included at the end of the string if the buffer is sufficiently big. This can be parsed with:: sscanf(buffer, "%[^;];%d;%d;%o;%s", type, &uid, &gid, &mode, desc); ”h]”(hÌ)�”}”(hŒDescribe a key::”h]”hŒDescribe a key:”…”�”}”(hjW h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hjS ubjC )�”}”(hŒXlong keyctl(KEYCTL_DESCRIBE, key_serial_t key, char *buffer, size_t buflen);”h]”hŒXlong keyctl(KEYCTL_DESCRIBE, key_serial_t key, char *buffer, size_t buflen);”…”�”}”hje sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M hjS ubhÌ)�”}”(hŒvThis function returns a summary of the key's attributes (but not its payload data) as a string in the buffer provided.”h]”hŒxThis function returns a summary of the key’s attributes (but not its payload data) as a string in the buffer provided.”…”�”}”(hjs h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjS ubhÌ)�”}”(hŒæUnless there's an error, it always returns the amount of data it could produce, even if that's too big for the buffer, but it won't copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place.”h]”hŒìUnless there’s an error, it always returns the amount of data it could produce, even if that’s too big for the buffer, but it won’t copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place.”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjS ubhÌ)�”}”(hŒRA process must have view permission on the key for this function to be successful.”h]”hŒRA process must have view permission on the key for this function to be successful.”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjS ubhÌ)�”}”(hŒIIf successful, a string is placed in the buffer in the following format::”h]”hŒHIf successful, a string is placed in the buffer in the following format:”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjS ubjC )�”}”(hŒ';;;;”h]”hŒ';;;;”…”�”}”hj« sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MhjS ubhÌ)�”}”(hŒ±Where type and description are strings, uid and gid are decimal, and perm is hexadecimal. A NUL character is included at the end of the string if the buffer is sufficiently big.”h]”hŒ±Where type and description are strings, uid and gid are decimal, and perm is hexadecimal. A NUL character is included at the end of the string if the buffer is sufficiently big.”…”�”}”(hj¹ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjS ubhÌ)�”}”(hŒThis can be parsed with::”h]”hŒThis can be parsed with:”…”�”}”(hjÇ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M#hjS ubjC )�”}”(hŒCsscanf(buffer, "%[^;];%d;%d;%o;%s", type, &uid, &gid, &mode, desc);”h]”hŒCsscanf(buffer, "%[^;];%d;%d;%o;%s", type, &uid, &gid, &mode, desc);”…”�”}”hjÕ sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M%hjS ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXÊClear out a keyring:: long keyctl(KEYCTL_CLEAR, key_serial_t keyring); This function clears the list of keys attached to a keyring. The calling process must have write permission on the keyring, and it must be a keyring (or else error ENOTDIR will result). This function can also be used to clear special kernel keyrings if they are appropriately marked if the user has CAP_SYS_ADMIN capability. The DNS resolver cache keyring is an example of this. ”h]”(hÌ)�”}”(hŒClear out a keyring::”h]”hŒClear out a keyring:”…”�”}”(hjí h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M(hjé ubjC )�”}”(hŒ0long keyctl(KEYCTL_CLEAR, key_serial_t keyring);”h]”hŒ0long keyctl(KEYCTL_CLEAR, key_serial_t keyring);”…”�”}”hjû sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M*hjé ubhÌ)�”}”(hŒ¹This function clears the list of keys attached to a keyring. The calling process must have write permission on the keyring, and it must be a keyring (or else error ENOTDIR will result).”h]”hŒ¹This function clears the list of keys attached to a keyring. The calling process must have write permission on the keyring, and it must be a keyring (or else error ENOTDIR will result).”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M,hjé ubhÌ)�”}”(hŒÁThis function can also be used to clear special kernel keyrings if they are appropriately marked if the user has CAP_SYS_ADMIN capability. The DNS resolver cache keyring is an example of this.”h]”hŒÁThis function can also be used to clear special kernel keyrings if they are appropriately marked if the user has CAP_SYS_ADMIN capability. The DNS resolver cache keyring is an example of this.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M0hjé ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXžLink a key into a keyring:: long keyctl(KEYCTL_LINK, key_serial_t keyring, key_serial_t key); This function creates a link from the keyring to the key. The process must have write permission on the keyring and must have link permission on the key. Should the keyring not be a keyring, error ENOTDIR will result; and if the keyring is full, error ENFILE will result. The link procedure checks the nesting of the keyrings, returning ELOOP if it appears too deep or EDEADLK if the link would introduce a cycle. Any links within the keyring to keys that match the new key in terms of type and description will be discarded from the keyring as the new one is added. ”h]”(hÌ)�”}”(hŒLink a key into a keyring::”h]”hŒLink a key into a keyring:”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M5hj+ubjC )�”}”(hŒAlong keyctl(KEYCTL_LINK, key_serial_t keyring, key_serial_t key);”h]”hŒAlong keyctl(KEYCTL_LINK, key_serial_t keyring, key_serial_t key);”…”�”}”hj=sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M7hj+ubhÌ)�”}”(hŒ™This function creates a link from the keyring to the key. The process must have write permission on the keyring and must have link permission on the key.”h]”hŒ™This function creates a link from the keyring to the key. The process must have write permission on the keyring and must have link permission on the key.”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M9hj+ubhÌ)�”}”(hŒuShould the keyring not be a keyring, error ENOTDIR will result; and if the keyring is full, error ENFILE will result.”h]”hŒuShould the keyring not be a keyring, error ENOTDIR will result; and if the keyring is full, error ENFILE will result.”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M=hj+ubhÌ)�”}”(hŒ�The link procedure checks the nesting of the keyrings, returning ELOOP if it appears too deep or EDEADLK if the link would introduce a cycle.”h]”hŒ�The link procedure checks the nesting of the keyrings, returning ELOOP if it appears too deep or EDEADLK if the link would introduce a cycle.”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M@hj+ubhÌ)�”}”(hŒ˜Any links within the keyring to keys that match the new key in terms of type and description will be discarded from the keyring as the new one is added.”h]”hŒ˜Any links within the keyring to keys that match the new key in terms of type and description will be discarded from the keyring as the new one is added.”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MChj+ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXMove a key from one keyring to another:: long keyctl(KEYCTL_MOVE, key_serial_t id, key_serial_t from_ring_id, key_serial_t to_ring_id, unsigned int flags); Move the key specified by "id" from the keyring specified by "from_ring_id" to the keyring specified by "to_ring_id". If the two keyrings are the same, nothing is done. "flags" can have KEYCTL_MOVE_EXCL set in it to cause the operation to fail with EEXIST if a matching key exists in the destination keyring, otherwise such a key will be replaced. A process must have link permission on the key for this function to be successful and write permission on both keyrings. Any errors that can occur from KEYCTL_LINK also apply on the destination keyring here. ”h]”(hÌ)�”}”(hŒ(Move a key from one keyring to another::”h]”hŒ'Move a key from one keyring to another:”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MHhj‰ubjC )�”}”(hŒ¢long keyctl(KEYCTL_MOVE, key_serial_t id, key_serial_t from_ring_id, key_serial_t to_ring_id, unsigned int flags);”h]”hŒ¢long keyctl(KEYCTL_MOVE, key_serial_t id, key_serial_t from_ring_id, key_serial_t to_ring_id, unsigned int flags);”…”�”}”hj›sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MJhj‰ubhÌ)�”}”(hŒ©Move the key specified by "id" from the keyring specified by "from_ring_id" to the keyring specified by "to_ring_id". If the two keyrings are the same, nothing is done.”h]”hŒµMove the key specified by “idâ€� from the keyring specified by “from_ring_idâ€� to the keyring specified by “to_ring_idâ€�. If the two keyrings are the same, nothing is done.”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MPhj‰ubhÌ)�”}”(hŒ²"flags" can have KEYCTL_MOVE_EXCL set in it to cause the operation to fail with EEXIST if a matching key exists in the destination keyring, otherwise such a key will be replaced.”h]”hŒ¶â€œflagsâ€� can have KEYCTL_MOVE_EXCL set in it to cause the operation to fail with EEXIST if a matching key exists in the destination keyring, otherwise such a key will be replaced.”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MThj‰ubhÌ)�”}”(hŒÐA process must have link permission on the key for this function to be successful and write permission on both keyrings. Any errors that can occur from KEYCTL_LINK also apply on the destination keyring here.”h]”hŒÐA process must have link permission on the key for this function to be successful and write permission on both keyrings. Any errors that can occur from KEYCTL_LINK also apply on the destination keyring here.”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MXhj‰ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXÁUnlink a key or keyring from another keyring:: long keyctl(KEYCTL_UNLINK, key_serial_t keyring, key_serial_t key); This function looks through the keyring for the first link to the specified key, and removes it if found. Subsequent links to that key are ignored. The process must have write permission on the keyring. If the keyring is not a keyring, error ENOTDIR will result; and if the key is not present, error ENOENT will be the result. ”h]”(hÌ)�”}”(hŒ.Unlink a key or keyring from another keyring::”h]”hŒ-Unlink a key or keyring from another keyring:”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M]hjÙubjC )�”}”(hŒClong keyctl(KEYCTL_UNLINK, key_serial_t keyring, key_serial_t key);”h]”hŒClong keyctl(KEYCTL_UNLINK, key_serial_t keyring, key_serial_t key);”…”�”}”hjësbah}”(h]”h ]”h"]”•h$]”h&]”jR jS uh1jB h³hÊh´M_hjÙubhÌ)�”}”(hŒÊThis function looks through the keyring for the first link to the specified key, and removes it if found. Subsequent links to that key are ignored. The process must have write permission on the keyring.”h]”hŒÊThis function looks through the keyring for the first link to the specified key, and removes it if found. Subsequent links to that key are ignored. The process must have write permission on the keyring.”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MahjÙubhÌ)�”}”(hŒ{If the keyring is not a keyring, error ENOTDIR will result; and if the key is not present, error ENOENT will be the result.”h]”hŒ{If the keyring is not a keyring, error ENOTDIR will result; and if the key is not present, error ENOENT will be the result.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MehjÙubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX@Search a keyring tree for a key:: key_serial_t keyctl(KEYCTL_SEARCH, key_serial_t keyring, const char *type, const char *description, key_serial_t dest_keyring); This searches the keyring tree headed by the specified keyring until a key is found that matches the type and description criteria. Each keyring is checked for keys before recursion into its children occurs. The process must have search permission on the top level keyring, or else error EACCES will result. Only keyrings that the process has search permission on will be recursed into, and only keys and keyrings for which a process has search permission can be matched. If the specified keyring is not a keyring, ENOTDIR will result. If the search succeeds, the function will attempt to link the found key into the destination keyring if one is supplied (non-zero ID). All the constraints applicable to KEYCTL_LINK apply in this case too. Error ENOKEY, EKEYREVOKED or EKEYEXPIRED will be returned if the search fails. On success, the resulting key ID will be returned. ”h]”(hÌ)�”}”(hŒ!Search a keyring tree for a key::”h]”hŒ Search a keyring tree for a key:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MihjubjC )�”}”(hŒ§key_serial_t keyctl(KEYCTL_SEARCH, key_serial_t keyring, const char *type, const char *description, key_serial_t dest_keyring);”h]”hŒ§key_serial_t keyctl(KEYCTL_SEARCH, key_serial_t keyring, const char *type, const char *description, key_serial_t dest_keyring);”…”�”}”hj-sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MkhjubhÌ)�”}”(hŒÏThis searches the keyring tree headed by the specified keyring until a key is found that matches the type and description criteria. Each keyring is checked for keys before recursion into its children occurs.”h]”hŒÏThis searches the keyring tree headed by the specified keyring until a key is found that matches the type and description criteria. Each keyring is checked for keys before recursion into its children occurs.”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MohjubhÌ)�”}”(hXGThe process must have search permission on the top level keyring, or else error EACCES will result. Only keyrings that the process has search permission on will be recursed into, and only keys and keyrings for which a process has search permission can be matched. If the specified keyring is not a keyring, ENOTDIR will result.”h]”hXGThe process must have search permission on the top level keyring, or else error EACCES will result. Only keyrings that the process has search permission on will be recursed into, and only keys and keyrings for which a process has search permission can be matched. If the specified keyring is not a keyring, ENOTDIR will result.”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MshjubhÌ)�”}”(hŒÌIf the search succeeds, the function will attempt to link the found key into the destination keyring if one is supplied (non-zero ID). All the constraints applicable to KEYCTL_LINK apply in this case too.”h]”hŒÌIf the search succeeds, the function will attempt to link the found key into the destination keyring if one is supplied (non-zero ID). All the constraints applicable to KEYCTL_LINK apply in this case too.”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MyhjubhÌ)�”}”(hŒ�Error ENOKEY, EKEYREVOKED or EKEYEXPIRED will be returned if the search fails. On success, the resulting key ID will be returned.”h]”hŒ�Error ENOKEY, EKEYREVOKED or EKEYEXPIRED will be returned if the search fails. On success, the resulting key ID will be returned.”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M}hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXˆRead the payload data from a key:: long keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, size_t buflen); This function attempts to read the payload data from the specified key into the buffer. The process must have read permission on the key to succeed. The returned data will be processed for presentation by the key type. For instance, a keyring will return an array of key_serial_t entries representing the IDs of all the keys to which it is subscribed. The user defined key type will return its data as is. If a key type does not implement this function, error EOPNOTSUPP will result. If the specified buffer is too small, then the size of the buffer required will be returned. Note that in this case, the contents of the buffer may have been overwritten in some undefined way. Otherwise, on success, the function will return the amount of data copied into the buffer. ”h]”(hÌ)�”}”(hŒ"Read the payload data from a key::”h]”hŒ!Read the payload data from a key:”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hjyubjC )�”}”(hŒXlong keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, size_t buflen);”h]”hŒXlong keyctl(KEYCTL_READ, key_serial_t keyring, char *buffer, size_t buflen);”…”�”}”hj‹sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MƒhjyubhÌ)�”}”(hŒ”This function attempts to read the payload data from the specified key into the buffer. The process must have read permission on the key to succeed.”h]”hŒ”This function attempts to read the payload data from the specified key into the buffer. The process must have read permission on the key to succeed.”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M†hjyubhÌ)�”}”(hXNThe returned data will be processed for presentation by the key type. For instance, a keyring will return an array of key_serial_t entries representing the IDs of all the keys to which it is subscribed. The user defined key type will return its data as is. If a key type does not implement this function, error EOPNOTSUPP will result.”h]”hXNThe returned data will be processed for presentation by the key type. For instance, a keyring will return an array of key_serial_t entries representing the IDs of all the keys to which it is subscribed. The user defined key type will return its data as is. If a key type does not implement this function, error EOPNOTSUPP will result.”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŠhjyubhÌ)�”}”(hŒÁIf the specified buffer is too small, then the size of the buffer required will be returned. Note that in this case, the contents of the buffer may have been overwritten in some undefined way.”h]”hŒÁIf the specified buffer is too small, then the size of the buffer required will be returned. Note that in this case, the contents of the buffer may have been overwritten in some undefined way.”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hjyubhÌ)�”}”(hŒZOtherwise, on success, the function will return the amount of data copied into the buffer.”h]”hŒZOtherwise, on success, the function will return the amount of data copied into the buffer.”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M”hjyubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXInstantiate a partially constructed key:: long keyctl(KEYCTL_INSTANTIATE, key_serial_t key, const void *payload, size_t plen, key_serial_t keyring); long keyctl(KEYCTL_INSTANTIATE_IOV, key_serial_t key, const struct iovec *payload_iov, unsigned ioc, key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the invoked process returns, or else the key will be marked negative automatically. The process must have write access on the key to be able to instantiate it, and the key must be uninstantiated. If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too. The payload and plen arguments describe the payload data as for add_key(). The payload_iov and ioc arguments describe the payload data in an iovec array instead of a single buffer. ”h]”(hÌ)�”}”(hŒ)Instantiate a partially constructed key::”h]”hŒ(Instantiate a partially constructed key:”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M—hj×ubjC )�”}”(hXlong keyctl(KEYCTL_INSTANTIATE, key_serial_t key, const void *payload, size_t plen, key_serial_t keyring); long keyctl(KEYCTL_INSTANTIATE_IOV, key_serial_t key, const struct iovec *payload_iov, unsigned ioc, key_serial_t keyring);”h]”hXlong keyctl(KEYCTL_INSTANTIATE, key_serial_t key, const void *payload, size_t plen, key_serial_t keyring); long keyctl(KEYCTL_INSTANTIATE_IOV, key_serial_t key, const struct iovec *payload_iov, unsigned ioc, key_serial_t keyring);”…”�”}”hjésbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M™hj×ubhÌ)�”}”(hŒâIf the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the invoked process returns, or else the key will be marked negative automatically.”h]”hŒâIf the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call to supply data for the key before the invoked process returns, or else the key will be marked negative automatically.”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj×ubhÌ)�”}”(hŒoThe process must have write access on the key to be able to instantiate it, and the key must be uninstantiated.”h]”hŒoThe process must have write access on the key to be able to instantiate it, and the key must be uninstantiated.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¥hj×ubhÌ)�”}”(hŒ If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too.”h]”hŒ If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¨hj×ubhÌ)�”}”(hŒJThe payload and plen arguments describe the payload data as for add_key().”h]”hŒJThe payload and plen arguments describe the payload data as for add_key().”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¬hj×ubhÌ)�”}”(hŒiThe payload_iov and ioc arguments describe the payload data in an iovec array instead of a single buffer.”h]”hŒiThe payload_iov and ioc arguments describe the payload data in an iovec array instead of a single buffer.”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M®hj×ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXÃNegatively instantiate a partially constructed key:: long keyctl(KEYCTL_NEGATE, key_serial_t key, unsigned timeout, key_serial_t keyring); long keyctl(KEYCTL_REJECT, key_serial_t key, unsigned timeout, unsigned error, key_serial_t keyring); If the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call mark the key as negative before the invoked process returns if it is unable to fulfill the request. The process must have write access on the key to be able to instantiate it, and the key must be uninstantiated. If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too. If the key is rejected, future searches for it will return the specified error code until the rejected key expires. Negating the key is the same as rejecting the key with ENOKEY as the error code. ”h]”(hÌ)�”}”(hŒ4Negatively instantiate a partially constructed key::”h]”hŒ3Negatively instantiate a partially constructed key:”…”�”}”(hjGh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M²hjCubjC )�”}”(hŒÓlong keyctl(KEYCTL_NEGATE, key_serial_t key, unsigned timeout, key_serial_t keyring); long keyctl(KEYCTL_REJECT, key_serial_t key, unsigned timeout, unsigned error, key_serial_t keyring);”h]”hŒÓlong keyctl(KEYCTL_NEGATE, key_serial_t key, unsigned timeout, key_serial_t keyring); long keyctl(KEYCTL_REJECT, key_serial_t key, unsigned timeout, unsigned error, key_serial_t keyring);”…”�”}”hjUsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M´hjCubhÌ)�”}”(hŒÐIf the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call mark the key as negative before the invoked process returns if it is unable to fulfill the request.”h]”hŒÐIf the kernel calls back to userspace to complete the instantiation of a key, userspace should use this call mark the key as negative before the invoked process returns if it is unable to fulfill the request.”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¹hjCubhÌ)�”}”(hŒoThe process must have write access on the key to be able to instantiate it, and the key must be uninstantiated.”h]”hŒoThe process must have write access on the key to be able to instantiate it, and the key must be uninstantiated.”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M½hjCubhÌ)�”}”(hŒ If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too.”h]”hŒ If a keyring is specified (non-zero), the key will also be linked into that keyring, however all the constraints applying in KEYCTL_LINK apply in this case too.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÀhjCubhÌ)�”}”(hŒÅIf the key is rejected, future searches for it will return the specified error code until the rejected key expires. Negating the key is the same as rejecting the key with ENOKEY as the error code.”h]”hŒÅIf the key is rejected, future searches for it will return the specified error code until the rejected key expires. Negating the key is the same as rejecting the key with ENOKEY as the error code.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÄhjCubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXSet the default request-key destination keyring:: long keyctl(KEYCTL_SET_REQKEY_KEYRING, int reqkey_defl); This sets the default keyring to which implicitly requested keys will be attached for this thread. reqkey_defl should be one of these constants:: CONSTANT VALUE NEW DEFAULT KEYRING ====================================== ====== ======================= KEY_REQKEY_DEFL_NO_CHANGE -1 No change KEY_REQKEY_DEFL_DEFAULT 0 Default[1] KEY_REQKEY_DEFL_THREAD_KEYRING 1 Thread keyring KEY_REQKEY_DEFL_PROCESS_KEYRING 2 Process keyring KEY_REQKEY_DEFL_SESSION_KEYRING 3 Session keyring KEY_REQKEY_DEFL_USER_KEYRING 4 User keyring KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 User session keyring KEY_REQKEY_DEFL_GROUP_KEYRING 6 Group keyring The old default will be returned if successful and error EINVAL will be returned if reqkey_defl is not one of the above values. The default keyring can be overridden by the keyring indicated to the request_key() system call. Note that this setting is inherited across fork/exec. [1] The default is: the thread keyring if there is one, otherwise the process keyring if there is one, otherwise the session keyring if there is one, otherwise the user default session keyring. ”h]”(hÌ)�”}”(hŒ1Set the default request-key destination keyring::”h]”hŒ0Set the default request-key destination keyring:”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÉhj¡ubjC )�”}”(hŒ8long keyctl(KEYCTL_SET_REQKEY_KEYRING, int reqkey_defl);”h]”hŒ8long keyctl(KEYCTL_SET_REQKEY_KEYRING, int reqkey_defl);”…”�”}”hj³sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MËhj¡ubhÌ)�”}”(hŒ‘This sets the default keyring to which implicitly requested keys will be attached for this thread. reqkey_defl should be one of these constants::”h]”hŒ�This sets the default keyring to which implicitly requested keys will be attached for this thread. reqkey_defl should be one of these constants:”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÍhj¡ubjC )�”}”(hXCONSTANT VALUE NEW DEFAULT KEYRING ====================================== ====== ======================= KEY_REQKEY_DEFL_NO_CHANGE -1 No change KEY_REQKEY_DEFL_DEFAULT 0 Default[1] KEY_REQKEY_DEFL_THREAD_KEYRING 1 Thread keyring KEY_REQKEY_DEFL_PROCESS_KEYRING 2 Process keyring KEY_REQKEY_DEFL_SESSION_KEYRING 3 Session keyring KEY_REQKEY_DEFL_USER_KEYRING 4 User keyring KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 User session keyring KEY_REQKEY_DEFL_GROUP_KEYRING 6 Group keyring”h]”hXCONSTANT VALUE NEW DEFAULT KEYRING ====================================== ====== ======================= KEY_REQKEY_DEFL_NO_CHANGE -1 No change KEY_REQKEY_DEFL_DEFAULT 0 Default[1] KEY_REQKEY_DEFL_THREAD_KEYRING 1 Thread keyring KEY_REQKEY_DEFL_PROCESS_KEYRING 2 Process keyring KEY_REQKEY_DEFL_SESSION_KEYRING 3 Session keyring KEY_REQKEY_DEFL_USER_KEYRING 4 User keyring KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 User session keyring KEY_REQKEY_DEFL_GROUP_KEYRING 6 Group keyring”…”�”}”hjÏsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MÐhj¡ubhÌ)�”}”(hŒThe old default will be returned if successful and error EINVAL will be returned if reqkey_defl is not one of the above values.”h]”hŒThe old default will be returned if successful and error EINVAL will be returned if reqkey_defl is not one of the above values.”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÛhj¡ubhÌ)�”}”(hŒ`The default keyring can be overridden by the keyring indicated to the request_key() system call.”h]”hŒ`The default keyring can be overridden by the keyring indicated to the request_key() system call.”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÞhj¡ubhÌ)�”}”(hŒ5Note that this setting is inherited across fork/exec.”h]”hŒ5Note that this setting is inherited across fork/exec.”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Máhj¡ubhÌ)�”}”(hŒÁ[1] The default is: the thread keyring if there is one, otherwise the process keyring if there is one, otherwise the session keyring if there is one, otherwise the user default session keyring.”h]”hŒÁ[1] The default is: the thread keyring if there is one, otherwise the process keyring if there is one, otherwise the session keyring if there is one, otherwise the user default session keyring.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mãhj¡ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX¥Set the timeout on a key:: long keyctl(KEYCTL_SET_TIMEOUT, key_serial_t key, unsigned timeout); This sets or clears the timeout on a key. The timeout can be 0 to clear the timeout or a number of seconds to set the expiry time that far into the future. The process must have attribute modification access on a key to set its timeout. Timeouts may not be set with this function on negative, revoked or expired keys. ”h]”(hÌ)�”}”(hŒSet the timeout on a key::”h]”hŒSet the timeout on a key:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MèhjubjC )�”}”(hŒDlong keyctl(KEYCTL_SET_TIMEOUT, key_serial_t key, unsigned timeout);”h]”hŒDlong keyctl(KEYCTL_SET_TIMEOUT, key_serial_t key, unsigned timeout);”…”�”}”hj-sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MêhjubhÌ)�”}”(hŒ›This sets or clears the timeout on a key. The timeout can be 0 to clear the timeout or a number of seconds to set the expiry time that far into the future.”h]”hŒ›This sets or clears the timeout on a key. The timeout can be 0 to clear the timeout or a number of seconds to set the expiry time that far into the future.”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MìhjubhÌ)�”}”(hŒ¡The process must have attribute modification access on a key to set its timeout. Timeouts may not be set with this function on negative, revoked or expired keys.”h]”hŒ¡The process must have attribute modification access on a key to set its timeout. Timeouts may not be set with this function on negative, revoked or expired keys.”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mðhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX Assume the authority granted to instantiate a key:: long keyctl(KEYCTL_ASSUME_AUTHORITY, key_serial_t key); This assumes or divests the authority required to instantiate the specified key. Authority can only be assumed if the thread has the authorisation key associated with the specified key in its keyrings somewhere. Once authority is assumed, searches for keys will also search the requester's keyrings using the requester's security label, UID, GID and groups. If the requested authority is unavailable, error EPERM will be returned, likewise if the authority has been revoked because the target key is already instantiated. If the specified key is 0, then any assumed authority will be divested. The assumed authoritative key is inherited across fork and exec. ”h]”(hÌ)�”}”(hŒ3Assume the authority granted to instantiate a key::”h]”hŒ2Assume the authority granted to instantiate a key:”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mõhj]ubjC )�”}”(hŒ7long keyctl(KEYCTL_ASSUME_AUTHORITY, key_serial_t key);”h]”hŒ7long keyctl(KEYCTL_ASSUME_AUTHORITY, key_serial_t key);”…”�”}”hjosbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M÷hj]ubhÌ)�”}”(hŒÓThis assumes or divests the authority required to instantiate the specified key. Authority can only be assumed if the thread has the authorisation key associated with the specified key in its keyrings somewhere.”h]”hŒÓThis assumes or divests the authority required to instantiate the specified key. Authority can only be assumed if the thread has the authorisation key associated with the specified key in its keyrings somewhere.”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mùhj]ubhÌ)�”}”(hŒ‘Once authority is assumed, searches for keys will also search the requester's keyrings using the requester's security label, UID, GID and groups.”h]”hŒ•Once authority is assumed, searches for keys will also search the requester’s keyrings using the requester’s security label, UID, GID and groups.”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mþhj]ubhÌ)�”}”(hŒ£If the requested authority is unavailable, error EPERM will be returned, likewise if the authority has been revoked because the target key is already instantiated.”h]”hŒ£If the requested authority is unavailable, error EPERM will be returned, likewise if the authority has been revoked because the target key is already instantiated.”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj]ubhÌ)�”}”(hŒGIf the specified key is 0, then any assumed authority will be divested.”h]”hŒGIf the specified key is 0, then any assumed authority will be divested.”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj]ubhÌ)�”}”(hŒ@The assumed authoritative key is inherited across fork and exec.”h]”hŒ@The assumed authoritative key is inherited across fork and exec.”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj]ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXGet the LSM security context attached to a key:: long keyctl(KEYCTL_GET_SECURITY, key_serial_t key, char *buffer, size_t buflen) This function returns a string that represents the LSM security context attached to a key in the buffer provided. Unless there's an error, it always returns the amount of data it could produce, even if that's too big for the buffer, but it won't copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place. A NUL character is included at the end of the string if the buffer is sufficiently big. This is included in the returned count. If no LSM is in force then an empty string will be returned. A process must have view permission on the key for this function to be successful. ”h]”(hÌ)�”}”(hŒ0Get the LSM security context attached to a key::”h]”hŒ/Get the LSM security context attached to a key:”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hjÉubjC )�”}”(hŒ[long keyctl(KEYCTL_GET_SECURITY, key_serial_t key, char *buffer, size_t buflen)”h]”hŒ[long keyctl(KEYCTL_GET_SECURITY, key_serial_t key, char *buffer, size_t buflen)”…”�”}”hjÛsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M hjÉubhÌ)�”}”(hŒqThis function returns a string that represents the LSM security context attached to a key in the buffer provided.”h]”hŒqThis function returns a string that represents the LSM security context attached to a key in the buffer provided.”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÉubhÌ)�”}”(hŒæUnless there's an error, it always returns the amount of data it could produce, even if that's too big for the buffer, but it won't copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place.”h]”hŒìUnless there’s an error, it always returns the amount of data it could produce, even if that’s too big for the buffer, but it won’t copy more than requested to userspace. If the buffer pointer is NULL then no copy will take place.”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÉubhÌ)�”}”(hŒ¾A NUL character is included at the end of the string if the buffer is sufficiently big. This is included in the returned count. If no LSM is in force then an empty string will be returned.”h]”hŒ¾A NUL character is included at the end of the string if the buffer is sufficiently big. This is included in the returned count. If no LSM is in force then an empty string will be returned.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÉubhÌ)�”}”(hŒRA process must have view permission on the key for this function to be successful.”h]”hŒRA process must have view permission on the key for this function to be successful.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÉubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXInstall the calling process's session keyring on its parent:: long keyctl(KEYCTL_SESSION_TO_PARENT); This functions attempts to install the calling process's session keyring on to the calling process's parent, replacing the parent's current session keyring. The calling process must have the same ownership as its parent, the keyring must have the same ownership as the calling process, the calling process must have LINK permission on the keyring and the active LSM module mustn't deny permission, otherwise error EPERM will be returned. Error ENOMEM will be returned if there was insufficient memory to complete the operation, otherwise 0 will be returned to indicate success. The keyring will be replaced next time the parent process leaves the kernel and resumes executing userspace. ”h]”(hÌ)�”}”(hŒ=Install the calling process's session keyring on its parent::”h]”hŒ>Install the calling process’s session keyring on its parent:”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj'ubjC )�”}”(hŒ&long keyctl(KEYCTL_SESSION_TO_PARENT);”h]”hŒ&long keyctl(KEYCTL_SESSION_TO_PARENT);”…”�”}”hj9sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M"hj'ubhÌ)�”}”(hŒœThis functions attempts to install the calling process's session keyring on to the calling process's parent, replacing the parent's current session keyring.”h]”hŒ¢This functions attempts to install the calling process’s session keyring on to the calling process’s parent, replacing the parent’s current session keyring.”…”�”}”(hjGh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M$hj'ubhÌ)�”}”(hXThe calling process must have the same ownership as its parent, the keyring must have the same ownership as the calling process, the calling process must have LINK permission on the keyring and the active LSM module mustn't deny permission, otherwise error EPERM will be returned.”h]”hXThe calling process must have the same ownership as its parent, the keyring must have the same ownership as the calling process, the calling process must have LINK permission on the keyring and the active LSM module mustn’t deny permission, otherwise error EPERM will be returned.”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M(hj'ubhÌ)�”}”(hŒ‹Error ENOMEM will be returned if there was insufficient memory to complete the operation, otherwise 0 will be returned to indicate success.”h]”hŒ‹Error ENOMEM will be returned if there was insufficient memory to complete the operation, otherwise 0 will be returned to indicate success.”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M-hj'ubhÌ)�”}”(hŒlThe keyring will be replaced next time the parent process leaves the kernel and resumes executing userspace.”h]”hŒlThe keyring will be replaced next time the parent process leaves the kernel and resumes executing userspace.”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M0hj'ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX7Invalidate a key:: long keyctl(KEYCTL_INVALIDATE, key_serial_t key); This function marks a key as being invalidated and then wakes up the garbage collector. The garbage collector immediately removes invalidated keys from all keyrings and deletes the key when its reference count reaches zero. Keys that are marked invalidated become invisible to normal key operations immediately, though they are still visible in /proc/keys until deleted (they're marked with an 'i' flag). A process must have search permission on the key for this function to be successful. ”h]”(hÌ)�”}”(hŒInvalidate a key::”h]”hŒInvalidate a key:”…”�”}”(hj‰h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M4hj…ubjC )�”}”(hŒ1long keyctl(KEYCTL_INVALIDATE, key_serial_t key);”h]”hŒ1long keyctl(KEYCTL_INVALIDATE, key_serial_t key);”…”�”}”hj—sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M6hj…ubhÌ)�”}”(hŒàThis function marks a key as being invalidated and then wakes up the garbage collector. The garbage collector immediately removes invalidated keys from all keyrings and deletes the key when its reference count reaches zero.”h]”hŒàThis function marks a key as being invalidated and then wakes up the garbage collector. The garbage collector immediately removes invalidated keys from all keyrings and deletes the key when its reference count reaches zero.”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hj…ubhÌ)�”}”(hŒ´Keys that are marked invalidated become invisible to normal key operations immediately, though they are still visible in /proc/keys until deleted (they're marked with an 'i' flag).”h]”hŒºKeys that are marked invalidated become invisible to normal key operations immediately, though they are still visible in /proc/keys until deleted (they’re marked with an ‘i’ flag).”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M=hj…ubhÌ)�”}”(hŒTA process must have search permission on the key for this function to be successful.”h]”hŒTA process must have search permission on the key for this function to be successful.”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MAhj…ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXQCompute a Diffie-Hellman shared secret or public key:: long keyctl(KEYCTL_DH_COMPUTE, struct keyctl_dh_params *params, char *buffer, size_t buflen, struct keyctl_kdf_params *kdf); The params struct contains serial numbers for three keys:: - The prime, p, known to both parties - The local private key - The base integer, which is either a shared generator or the remote public key The value computed is:: result = base ^ private (mod prime) If the base is the shared generator, the result is the local public key. If the base is the remote public key, the result is the shared secret. If the parameter kdf is NULL, the following applies: - The buffer length must be at least the length of the prime, or zero. - If the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned. The kdf parameter allows the caller to apply a key derivation function (KDF) on the Diffie-Hellman computation where only the result of the KDF is returned to the caller. The KDF is characterized with struct keyctl_kdf_params as follows: - ``char *hashname`` specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF). - ``char *otherinfo`` specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used. This function will return error EOPNOTSUPP if the key type is not supported, error ENOKEY if the key could not be found, or error EACCES if the key is not readable by the caller. In addition, the function will return EMSGSIZE when the parameter kdf is non-NULL and either the buffer length or the OtherInfo length exceeds the allowed length. ”h]”(hÌ)�”}”(hŒ6Compute a Diffie-Hellman shared secret or public key::”h]”hŒ5Compute a Diffie-Hellman shared secret or public key:”…”�”}”(hjÙh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MDhjÕubjC )�”}”(hŒˆlong keyctl(KEYCTL_DH_COMPUTE, struct keyctl_dh_params *params, char *buffer, size_t buflen, struct keyctl_kdf_params *kdf);”h]”hŒˆlong keyctl(KEYCTL_DH_COMPUTE, struct keyctl_dh_params *params, char *buffer, size_t buflen, struct keyctl_kdf_params *kdf);”…”�”}”hjçsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MFhjÕubhÌ)�”}”(hŒ:The params struct contains serial numbers for three keys::”h]”hŒ9The params struct contains serial numbers for three keys:”…”�”}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MIhjÕubjC )�”}”(hŒ�- The prime, p, known to both parties - The local private key - The base integer, which is either a shared generator or the remote public key”h]”hŒ�- The prime, p, known to both parties - The local private key - The base integer, which is either a shared generator or the remote public key”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MKhjÕubhÌ)�”}”(hŒThe value computed is::”h]”hŒThe value computed is:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MPhjÕubjC )�”}”(hŒ#result = base ^ private (mod prime)”h]”hŒ#result = base ^ private (mod prime)”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MRhjÕubhÌ)�”}”(hŒ�If the base is the shared generator, the result is the local public key. If the base is the remote public key, the result is the shared secret.”h]”hŒ�If the base is the shared generator, the result is the local public key. If the base is the remote public key, the result is the shared secret.”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MThjÕubhÌ)�”}”(hŒ4If the parameter kdf is NULL, the following applies:”h]”hŒ4If the parameter kdf is NULL, the following applies:”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MXhjÕubhø)�”}”(hX&- The buffer length must be at least the length of the prime, or zero. - If the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒEThe buffer length must be at least the length of the prime, or zero. ”h]”hÌ)�”}”(hŒDThe buffer length must be at least the length of the prime, or zero.”h]”hŒDThe buffer length must be at least the length of the prime, or zero.”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MZhjPubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjMubj*)�”}”(hŒÖIf the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned. ”h]”hÌ)�”}”(hŒÕIf the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned.”h]”hŒÕIf the buffer length is nonzero, the length of the result is returned when it is successfully calculated and copied in to the buffer. When the buffer length is zero, the minimum required buffer length is returned.”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M\hjhubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjMubeh}”(h]”h ]”h"]”h$]”h&]”j”j•uh1j$h³hÊh´MZhjIubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´MZhjÕubhÌ)�”}”(hŒíThe kdf parameter allows the caller to apply a key derivation function (KDF) on the Diffie-Hellman computation where only the result of the KDF is returned to the caller. The KDF is characterized with struct keyctl_kdf_params as follows:”h]”hŒíThe kdf parameter allows the caller to apply a key derivation function (KDF) on the Diffie-Hellman computation where only the result of the KDF is returned to the caller. The KDF is characterized with struct keyctl_kdf_params as follows:”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MahjÕubhø)�”}”(hX- ``char *hashname`` specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF). - ``char *otherinfo`` specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒë``char *hashname`` specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF). ”h]”hÌ)�”}”(hŒê``char *hashname`` specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF).”h]”(hŒliteral”“”)�”}”(hŒ``char *hashname``”h]”hŒchar *hashname”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj¥ubhŒØ specifies the NUL terminated string identifying the hash used from the kernel crypto API and applied for the KDF operation. The KDF implementation complies with SP800-56A as well as with SP800-108 (the counter KDF).”…”�”}”(hj¥h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mfhj¡ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjžubj*)�”}”(hX``char *otherinfo`` specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used. ”h]”hÌ)�”}”(hX``char *otherinfo`` specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used.”h]”(jª)�”}”(hŒ``char *otherinfo``”h]”hŒchar *otherinfo”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjÍubhŒñ specifies the OtherInfo data as documented in SP800-56A section 5.8.1.2. The length of the buffer is given with otherinfolen. The format of OtherInfo is defined by the caller. The otherinfo pointer may be NULL if no OtherInfo shall be used.”…”�”}”(hjÍh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MkhjÉubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hjžubeh}”(h]”h ]”h"]”h$]”h&]”j”j•uh1j$h³hÊh´Mfhjšubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´MfhjÕubhÌ)�”}”(hXUThis function will return error EOPNOTSUPP if the key type is not supported, error ENOKEY if the key could not be found, or error EACCES if the key is not readable by the caller. In addition, the function will return EMSGSIZE when the parameter kdf is non-NULL and either the buffer length or the OtherInfo length exceeds the allowed length.”h]”hXUThis function will return error EOPNOTSUPP if the key type is not supported, error ENOKEY if the key could not be found, or error EACCES if the key is not readable by the caller. In addition, the function will return EMSGSIZE when the parameter kdf is non-NULL and either the buffer length or the OtherInfo length exceeds the allowed length.”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MphjÕubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX[Restrict keyring linkage:: long keyctl(KEYCTL_RESTRICT_KEYRING, key_serial_t keyring, const char *type, const char *restriction); An existing keyring can restrict linkage of additional keys by evaluating the contents of the key according to a restriction scheme. "keyring" is the key ID for an existing keyring to apply a restriction to. It may be empty or may already have keys linked. Existing linked keys will remain in the keyring even if the new restriction would reject them. "type" is a registered key type. "restriction" is a string describing how key linkage is to be restricted. The format varies depending on the key type, and the string is passed to the lookup_restriction() function for the requested type. It may specify a method and relevant data for the restriction such as signature verification or constraints on key payload. If the requested key type is later unregistered, no keys may be added to the keyring after the key type is removed. To apply a keyring restriction the process must have Set Attribute permission and the keyring must not be previously restricted. One application of restricted keyrings is to verify X.509 certificate chains or individual certificate signatures using the asymmetric key type. See Documentation/crypto/asymmetric-keys.rst for specific restrictions applicable to the asymmetric key type. ”h]”(hÌ)�”}”(hŒRestrict keyring linkage::”h]”hŒRestrict keyring linkage:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MxhjubjC )�”}”(hŒrlong keyctl(KEYCTL_RESTRICT_KEYRING, key_serial_t keyring, const char *type, const char *restriction);”h]”hŒrlong keyctl(KEYCTL_RESTRICT_KEYRING, key_serial_t keyring, const char *type, const char *restriction);”…”�”}”hj!sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MzhjubhÌ)�”}”(hŒ„An existing keyring can restrict linkage of additional keys by evaluating the contents of the key according to a restriction scheme.”h]”hŒ„An existing keyring can restrict linkage of additional keys by evaluating the contents of the key according to a restriction scheme.”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M}hjubhÌ)�”}”(hŒÚ"keyring" is the key ID for an existing keyring to apply a restriction to. It may be empty or may already have keys linked. Existing linked keys will remain in the keyring even if the new restriction would reject them.”h]”hŒÞ“keyringâ€� is the key ID for an existing keyring to apply a restriction to. It may be empty or may already have keys linked. Existing linked keys will remain in the keyring even if the new restriction would reject them.”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M€hjubhÌ)�”}”(hŒ "type" is a registered key type.”h]”hŒ$“typeâ€� is a registered key type.”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M„hjubhÌ)�”}”(hX½"restriction" is a string describing how key linkage is to be restricted. The format varies depending on the key type, and the string is passed to the lookup_restriction() function for the requested type. It may specify a method and relevant data for the restriction such as signature verification or constraints on key payload. If the requested key type is later unregistered, no keys may be added to the keyring after the key type is removed.”h]”hXÁ“restrictionâ€� is a string describing how key linkage is to be restricted. The format varies depending on the key type, and the string is passed to the lookup_restriction() function for the requested type. It may specify a method and relevant data for the restriction such as signature verification or constraints on key payload. If the requested key type is later unregistered, no keys may be added to the keyring after the key type is removed.”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M†hjubhÌ)�”}”(hŒ€To apply a keyring restriction the process must have Set Attribute permission and the keyring must not be previously restricted.”h]”hŒ€To apply a keyring restriction the process must have Set Attribute permission and the keyring must not be previously restricted.”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŽhjubhÌ)�”}”(hŒþOne application of restricted keyrings is to verify X.509 certificate chains or individual certificate signatures using the asymmetric key type. See Documentation/crypto/asymmetric-keys.rst for specific restrictions applicable to the asymmetric key type.”h]”hŒþOne application of restricted keyrings is to verify X.509 certificate chains or individual certificate signatures using the asymmetric key type. See Documentation/crypto/asymmetric-keys.rst for specific restrictions applicable to the asymmetric key type.”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‘hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXQuery an asymmetric key:: long keyctl(KEYCTL_PKEY_QUERY, key_serial_t key_id, unsigned long reserved, const char *params, struct keyctl_pkey_query *info); Get information about an asymmetric key. Specific algorithms and encodings may be queried by using the ``params`` argument. This is a string containing a space- or tab-separated string of key-value pairs. Currently supported keys include ``enc`` and ``hash``. The information is returned in the keyctl_pkey_query struct:: __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; __u32 __spare[10]; ``supported_ops`` contains a bit mask of flags indicating which ops are supported. This is constructed from a bitwise-OR of:: KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY} ``key_size`` indicated the size of the key in bits. ``max_*_size`` indicate the maximum sizes in bytes of a blob of data to be signed, a signature blob, a blob to be encrypted and a blob to be decrypted. ``__spare[]`` must be set to 0. This is intended for future use to hand over one or more passphrases needed unlock a key. If successful, 0 is returned. If the key is not an asymmetric key, EOPNOTSUPP is returned. ”h]”(hÌ)�”}”(hŒQuery an asymmetric key::”h]”hŒQuery an asymmetric key:”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M—hj‰ubjC )�”}”(hŒ¤long keyctl(KEYCTL_PKEY_QUERY, key_serial_t key_id, unsigned long reserved, const char *params, struct keyctl_pkey_query *info);”h]”hŒ¤long keyctl(KEYCTL_PKEY_QUERY, key_serial_t key_id, unsigned long reserved, const char *params, struct keyctl_pkey_query *info);”…”�”}”hj›sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M™hj‰ubhÌ)�”}”(hXDGet information about an asymmetric key. Specific algorithms and encodings may be queried by using the ``params`` argument. This is a string containing a space- or tab-separated string of key-value pairs. Currently supported keys include ``enc`` and ``hash``. The information is returned in the keyctl_pkey_query struct::”h]”(hŒhGet information about an asymmetric key. Specific algorithms and encodings may be queried by using the ”…”�”}”(hj©h²hh³Nh´Nubjª)�”}”(hŒ ``params``”h]”hŒparams”…”�”}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj©ubhŒ~ argument. This is a string containing a space- or tab-separated string of key-value pairs. Currently supported keys include ”…”�”}”(hj©h²hh³Nh´Nubjª)�”}”(hŒ``enc``”h]”hŒenc”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj©ubhŒ and ”…”�”}”(hj©h²hh³Nh´Nubjª)�”}”(hŒ``hash``”h]”hŒhash”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj©ubhŒ?. The information is returned in the keyctl_pkey_query struct:”…”�”}”(hj©h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mžhj‰ubjC )�”}”(hŒ–__u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; __u32 __spare[10];”h]”hŒ–__u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; __u32 __spare[10];”…”�”}”hjísbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M¤hj‰ubhÌ)�”}”(hŒ~``supported_ops`` contains a bit mask of flags indicating which ops are supported. This is constructed from a bitwise-OR of::”h]”(jª)�”}”(hŒ``supported_ops``”h]”hŒ supported_ops”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjûubhŒl contains a bit mask of flags indicating which ops are supported. This is constructed from a bitwise-OR of:”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¬hj‰ubjC )�”}”(hŒ-KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY}”h]”hŒ-KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY}”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M¯hj‰ubhÌ)�”}”(hŒ3``key_size`` indicated the size of the key in bits.”h]”(jª)�”}”(hŒ ``key_size``”h]”hŒkey_size”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj%ubhŒ' indicated the size of the key in bits.”…”�”}”(hj%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M±hj‰ubhÌ)�”}”(hŒ—``max_*_size`` indicate the maximum sizes in bytes of a blob of data to be signed, a signature blob, a blob to be encrypted and a blob to be decrypted.”h]”(jª)�”}”(hŒ``max_*_size``”h]”hŒ max_*_size”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjAubhŒ‰ indicate the maximum sizes in bytes of a blob of data to be signed, a signature blob, a blob to be encrypted and a blob to be decrypted.”…”�”}”(hjAh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M³hj‰ubhÌ)�”}”(hŒz``__spare[]`` must be set to 0. This is intended for future use to hand over one or more passphrases needed unlock a key.”h]”(jª)�”}”(hŒ ``__spare[]``”h]”hŒ __spare[]”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj]ubhŒm must be set to 0. This is intended for future use to hand over one or more passphrases needed unlock a key.”…”�”}”(hj]h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M·hj‰ubhÌ)�”}”(hŒ[If successful, 0 is returned. If the key is not an asymmetric key, EOPNOTSUPP is returned.”h]”hŒ[If successful, 0 is returned. If the key is not an asymmetric key, EOPNOTSUPP is returned.”…”�”}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mºhj‰ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hX› Encrypt, decrypt, sign or verify a blob using an asymmetric key:: long keyctl(KEYCTL_PKEY_ENCRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_DECRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_SIGN, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_VERIFY, const struct keyctl_pkey_params *params, const char *info, const void *in, const void *in2); Use an asymmetric key to perform a public-key cryptographic operation a blob of data. For encryption and verification, the asymmetric key may only need the public parts to be available, but for decryption and signing the private parts are required also. The parameter block pointed to by params contains a number of integer values:: __s32 key_id; __u32 in_len; __u32 out_len; __u32 in2_len; ``key_id`` is the ID of the asymmetric key to be used. ``in_len`` and ``in2_len`` indicate the amount of data in the in and in2 buffers and ``out_len`` indicates the size of the out buffer as appropriate for the above operations. For a given operation, the in and out buffers are used as follows:: Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== KEYCTL_PKEY_ENCRYPT Raw data Encrypted data - KEYCTL_PKEY_DECRYPT Encrypted data Raw data - KEYCTL_PKEY_SIGN Raw data Signature - KEYCTL_PKEY_VERIFY Raw data - Signature ``info`` is a string of key=value pairs that supply supplementary information. These include: ``enc=`` The encoding of the encrypted/signature blob. This can be "pkcs1" for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; "pss" for "RSASSA-PSS"; "oaep" for "RSAES-OAEP". If omitted or is "raw", the raw output of the encryption function is specified. ``hash=`` If the data buffer contains the output of a hash function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. "hash=sha256". The ``__spare[]`` space in the parameter block must be set to 0. This is intended, amongst other things, to allow the passing of passphrases required to unlock a key. If successful, encrypt, decrypt and sign all return the amount of data written into the output buffer. Verification returns 0 on success. ”h]”(hÌ)�”}”(hŒAEncrypt, decrypt, sign or verify a blob using an asymmetric key::”h]”hŒ@Encrypt, decrypt, sign or verify a blob using an asymmetric key:”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¾hj�ubjC )�”}”(hX¤long keyctl(KEYCTL_PKEY_ENCRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_DECRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_SIGN, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_VERIFY, const struct keyctl_pkey_params *params, const char *info, const void *in, const void *in2);”h]”hX¤long keyctl(KEYCTL_PKEY_ENCRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_DECRYPT, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_SIGN, const struct keyctl_pkey_params *params, const char *info, const void *in, void *out); long keyctl(KEYCTL_PKEY_VERIFY, const struct keyctl_pkey_params *params, const char *info, const void *in, const void *in2);”…”�”}”hjŸsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MÀhj�ubhÌ)�”}”(hŒþUse an asymmetric key to perform a public-key cryptographic operation a blob of data. For encryption and verification, the asymmetric key may only need the public parts to be available, but for decryption and signing the private parts are required also.”h]”hŒþUse an asymmetric key to perform a public-key cryptographic operation a blob of data. For encryption and verification, the asymmetric key may only need the public parts to be available, but for decryption and signing the private parts are required also.”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MØhj�ubhÌ)�”}”(hŒNThe parameter block pointed to by params contains a number of integer values::”h]”hŒMThe parameter block pointed to by params contains a number of integer values:”…”�”}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÝhj�ubjC )�”}”(hŒa__s32 key_id; __u32 in_len; __u32 out_len; __u32 in2_len;”h]”hŒa__s32 key_id; __u32 in_len; __u32 out_len; __u32 in2_len;”…”�”}”hjÉsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´Màhj�ubhÌ)�”}”(hŒæ``key_id`` is the ID of the asymmetric key to be used. ``in_len`` and ``in2_len`` indicate the amount of data in the in and in2 buffers and ``out_len`` indicates the size of the out buffer as appropriate for the above operations.”h]”(jª)�”}”(hŒ ``key_id``”h]”hŒkey_id”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj×ubhŒ. is the ID of the asymmetric key to be used. ”…”�”}”(hj×h²hh³Nh´Nubjª)�”}”(hŒ ``in_len``”h]”hŒin_len”…”�”}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj×ubhŒ and ”…”�”}”(hj×h²hh³Nh´Nubjª)�”}”(hŒ ``in2_len``”h]”hŒin2_len”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj×ubhŒ; indicate the amount of data in the in and in2 buffers and ”…”�”}”(hj×h²hh³Nh´Nubjª)�”}”(hŒ ``out_len``”h]”hŒout_len”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj×ubhŒN indicates the size of the out buffer as appropriate for the above operations.”…”�”}”(hj×h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Måhj�ubhÌ)�”}”(hŒCFor a given operation, the in and out buffers are used as follows::”h]”hŒBFor a given operation, the in and out buffers are used as follows:”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mêhj�ubjC )�”}”(hX{Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== KEYCTL_PKEY_ENCRYPT Raw data Encrypted data - KEYCTL_PKEY_DECRYPT Encrypted data Raw data - KEYCTL_PKEY_SIGN Raw data Signature - KEYCTL_PKEY_VERIFY Raw data - Signature”h]”hX{Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== KEYCTL_PKEY_ENCRYPT Raw data Encrypted data - KEYCTL_PKEY_DECRYPT Encrypted data Raw data - KEYCTL_PKEY_SIGN Raw data Signature - KEYCTL_PKEY_VERIFY Raw data - Signature”…”�”}”hj7sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´Mìhj�ubhÌ)�”}”(hŒ^``info`` is a string of key=value pairs that supply supplementary information. These include:”h]”(jª)�”}”(hŒ``info``”h]”hŒinfo”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjEubhŒV is a string of key=value pairs that supply supplementary information. These include:”…”�”}”(hjEh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Móhj�ubhø)�”}”(hXJ``enc=`` The encoding of the encrypted/signature blob. This can be "pkcs1" for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; "pss" for "RSASSA-PSS"; "oaep" for "RSAES-OAEP". If omitted or is "raw", the raw output of the encryption function is specified. ``hash=`` If the data buffer contains the output of a hash function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. "hash=sha256". ”h]”hŒdefinition_list”“”)�”}”(hhh]”(hŒdefinition_list_item”“”)�”}”(hX``enc=`` The encoding of the encrypted/signature blob. This can be "pkcs1" for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; "pss" for "RSASSA-PSS"; "oaep" for "RSAES-OAEP". If omitted or is "raw", the raw output of the encryption function is specified. ”h]”(hŒterm”“”)�”}”(hŒF``enc=`` The encoding of the encrypted/signature blob. This”h]”(jª)�”}”(hŒ``enc=``”h]”hŒenc=”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjrubhŒ4 The encoding of the encrypted/signature blob. This”…”�”}”(hjrh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jph³hÊh´MúhjlubhŒ definition”“”)�”}”(hhh]”hÌ)�”}”(hŒ»can be "pkcs1" for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; "pss" for "RSASSA-PSS"; "oaep" for "RSAES-OAEP". If omitted or is "raw", the raw output of the encryption function is specified.”h]”hŒÓcan be “pkcs1â€� for RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5; “pssâ€� for “RSASSA-PSSâ€�; “oaepâ€� for “RSAES-OAEPâ€�. If omitted or is “rawâ€�, the raw output of the encryption function is specified.”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M÷hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŽhjlubeh}”(h]”h ]”h"]”h$]”h&]”uh1jjh³hÊh´Múhjgubjk)�”}”(hŒÖ``hash=`` If the data buffer contains the output of a hash function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. "hash=sha256". ”h]”(jq)�”}”(hŒ@``hash=`` If the data buffer contains the output of a hash”h]”(jª)�”}”(hŒ``hash=``”h]”hŒ hash=”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj±ubhŒ1 If the data buffer contains the output of a hash”…”�”}”(hj±h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jph³hÊh´Mÿhj­ubj�)�”}”(hhh]”hÌ)�”}”(hŒ”function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. "hash=sha256".”h]”hŒ˜function and the encoding includes some indication of which hash function was used, the hash function can be specified with this, eg. “hash=sha256â€�.”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MýhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1jŽhj­ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jjh³hÊh´Mÿhjgubeh}”(h]”h ]”h"]”h$]”h&]”uh1jehjaubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´Möhj�ubhÌ)�”}”(hŒ§The ``__spare[]`` space in the parameter block must be set to 0. This is intended, amongst other things, to allow the passing of passphrases required to unlock a key.”•Ý7h]”(hŒThe ”…”�”}”(hjöh²hh³Nh´Nubjª)�”}”(hŒ ``__spare[]``”h]”hŒ __spare[]”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjöubhŒ– space in the parameter block must be set to 0. This is intended, amongst other things, to allow the passing of passphrases required to unlock a key.”…”�”}”(hjöh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj�ubhÌ)�”}”(hŒŠIf successful, encrypt, decrypt and sign all return the amount of data written into the output buffer. Verification returns 0 on success.”h]”hŒŠIf successful, encrypt, decrypt and sign all return the amount of data written into the output buffer. Verification returns 0 on success.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj�ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubj*)�”}”(hXÑWatch a key or keyring for changes:: long keyctl(KEYCTL_WATCH_KEY, key_serial_t key, int queue_fd, const struct watch_notification_filter *filter); This will set or remove a watch for changes on the specified key or keyring. "key" is the ID of the key to be watched. "queue_fd" is a file descriptor referring to an open pipe which manages the buffer into which notifications will be delivered. "filter" is either NULL to remove a watch or a filter specification to indicate what events are required from the key. See Documentation/core-api/watch_queue.rst for more information. Note that only one watch may be emplaced for any particular { key, queue_fd } combination. Notification records look like:: struct key_notification { struct watch_notification watch; __u32 key_id; __u32 aux; }; In this, watch::type will be "WATCH_TYPE_KEY_NOTIFY" and subtype will be one of:: NOTIFY_KEY_INSTANTIATED NOTIFY_KEY_UPDATED NOTIFY_KEY_LINKED NOTIFY_KEY_UNLINKED NOTIFY_KEY_CLEARED NOTIFY_KEY_REVOKED NOTIFY_KEY_INVALIDATED NOTIFY_KEY_SETATTR Where these indicate a key being instantiated/rejected, updated, a link being made in a keyring, a link being removed from a keyring, a keyring being cleared, a key being revoked, a key being invalidated or a key having one of its attributes changed (user, group, perm, timeout, restriction). If a watched key is deleted, a basic watch_notification will be issued with "type" set to WATCH_TYPE_META and "subtype" set to watch_meta_removal_notification. The watchpoint ID will be set in the "info" field. This needs to be configured by enabling: "Provide key/keyring change notifications" (KEY_NOTIFICATIONS) ”h]”(hÌ)�”}”(hŒ$Watch a key or keyring for changes::”h]”hŒ#Watch a key or keyring for changes:”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj*ubjC )�”}”(hŒzlong keyctl(KEYCTL_WATCH_KEY, key_serial_t key, int queue_fd, const struct watch_notification_filter *filter);”h]”hŒzlong keyctl(KEYCTL_WATCH_KEY, key_serial_t key, int queue_fd, const struct watch_notification_filter *filter);”…”�”}”hj<sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M hj*ubhÌ)�”}”(hŒLThis will set or remove a watch for changes on the specified key or keyring.”h]”hŒLThis will set or remove a watch for changes on the specified key or keyring.”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒ)"key" is the ID of the key to be watched.”h]”hŒ-“keyâ€� is the ID of the key to be watched.”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒ~"queue_fd" is a file descriptor referring to an open pipe which manages the buffer into which notifications will be delivered.”h]”hŒ‚“queue_fdâ€� is a file descriptor referring to an open pipe which manages the buffer into which notifications will be delivered.”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒv"filter" is either NULL to remove a watch or a filter specification to indicate what events are required from the key.”h]”hŒz“filterâ€� is either NULL to remove a watch or a filter specification to indicate what events are required from the key.”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒ@See Documentation/core-api/watch_queue.rst for more information.”h]”hŒ@See Documentation/core-api/watch_queue.rst for more information.”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒZNote that only one watch may be emplaced for any particular { key, queue_fd } combination.”h]”hŒZNote that only one watch may be emplaced for any particular { key, queue_fd } combination.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubhÌ)�”}”(hŒ Notification records look like::”h]”hŒNotification records look like:”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj*ubjC )�”}”(hŒrstruct key_notification { struct watch_notification watch; __u32 key_id; __u32 aux; };”h]”hŒrstruct key_notification { struct watch_notification watch; __u32 key_id; __u32 aux; };”…”�”}”hj¬sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M hj*ubhÌ)�”}”(hŒQIn this, watch::type will be "WATCH_TYPE_KEY_NOTIFY" and subtype will be one of::”h]”hŒTIn this, watch::type will be “WATCH_TYPE_KEY_NOTIFYâ€� and subtype will be one of:”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M&hj*ubjC )�”}”(hŒ NOTIFY_KEY_INSTANTIATED NOTIFY_KEY_UPDATED NOTIFY_KEY_LINKED NOTIFY_KEY_UNLINKED NOTIFY_KEY_CLEARED NOTIFY_KEY_REVOKED NOTIFY_KEY_INVALIDATED NOTIFY_KEY_SETATTR”h]”hŒ NOTIFY_KEY_INSTANTIATED NOTIFY_KEY_UPDATED NOTIFY_KEY_LINKED NOTIFY_KEY_UNLINKED NOTIFY_KEY_CLEARED NOTIFY_KEY_REVOKED NOTIFY_KEY_INVALIDATED NOTIFY_KEY_SETATTR”…”�”}”hjÈsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M)hj*ubhÌ)�”}”(hX$Where these indicate a key being instantiated/rejected, updated, a link being made in a keyring, a link being removed from a keyring, a keyring being cleared, a key being revoked, a key being invalidated or a key having one of its attributes changed (user, group, perm, timeout, restriction).”h]”hX$Where these indicate a key being instantiated/rejected, updated, a link being made in a keyring, a link being removed from a keyring, a keyring being cleared, a key being revoked, a key being invalidated or a key having one of its attributes changed (user, group, perm, timeout, restriction).”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M2hj*ubhÌ)�”}”(hŒÓIf a watched key is deleted, a basic watch_notification will be issued with "type" set to WATCH_TYPE_META and "subtype" set to watch_meta_removal_notification. The watchpoint ID will be set in the "info" field.”h]”hŒßIf a watched key is deleted, a basic watch_notification will be issued with “typeâ€� set to WATCH_TYPE_META and “subtypeâ€� set to watch_meta_removal_notification. The watchpoint ID will be set in the “infoâ€� field.”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hj*ubhÌ)�”}”(hŒ(This needs to be configured by enabling:”h]”hŒ(This needs to be configured by enabling:”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M=hj*ubhø)�”}”(hŒ@"Provide key/keyring change notifications" (KEY_NOTIFICATIONS) ”h]”hÌ)�”}”(hŒ>"Provide key/keyring change notifications" (KEY_NOTIFICATIONS)”h]”hŒB“Provide key/keyring change notificationsâ€� (KEY_NOTIFICATIONS)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M?hjubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M?hj*ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¶ ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M½hj² ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M½hjT h²hubeh}”(h]”jìah ]”h"]”Œuserspace system call interface”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mbubh¶)�”}”(hhh]”(h»)�”}”(hŒKernel Services”h]”hŒKernel Services”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄjuh1hºhj1h²hh³hÊh´MCubhÌ)�”}”(hŒ‚The kernel services for key management are fairly simple to deal with. They can be broken down into two areas: keys and key types.”h]”hŒ‚The kernel services for key management are fairly simple to deal with. They can be broken down into two areas: keys and key types.”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MEhj1h²hubhÌ)�”}”(hXÖDealing with keys is fairly straightforward. Firstly, the kernel service registers its type, then it searches for a key of that type. It should retain the key as long as it has need of it, and then it should release it. For a filesystem or device file, a search would probably be performed during the open call, and the key released upon close. How to deal with conflicting keys due to two different users opening the same file is left to the filesystem author to solve.”h]”hXÖDealing with keys is fairly straightforward. Firstly, the kernel service registers its type, then it searches for a key of that type. It should retain the key as long as it has need of it, and then it should release it. For a filesystem or device file, a search would probably be performed during the open call, and the key released upon close. How to deal with conflicting keys due to two different users opening the same file is left to the filesystem author to solve.”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MHhj1h²hubhÌ)�”}”(hŒCTo access the key manager, the following header must be #included::”h]”hŒBTo access the key manager, the following header must be #included:”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MPhj1h²hubjC )�”}”(hŒ ”h]”hŒ ”…”�”}”hjlsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MRhj1h²hubhÌ)�”}”(hŒ Specific key types should have a header file under include/keys/ that should be used to access that type. For keys of type "user", for example, that would be::”h]”hŒ£Specific key types should have a header file under include/keys/ that should be used to access that type. For keys of type “userâ€�, for example, that would be:”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MThj1h²hubjC )�”}”(hŒ”h]”hŒ”…”�”}”hjˆsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MWhj1h²hubhÌ)�”}”(hŒTNote that there are two different types of pointers to keys that may be encountered:”h]”hŒTNote that there are two different types of pointers to keys that may be encountered:”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MYhj1h²hubhø)�”}”(hX[* struct key * This simply points to the key structure itself. Key structures will be at least four-byte aligned. * key_ref_t This is equivalent to a ``struct key *``, but the least significant bit is set if the caller "possesses" the key. By "possession" it is meant that the calling processes has a searchable link to the key from one of its keyrings. There are three functions for dealing with these:: key_ref_t make_key_ref(const struct key *key, bool possession); struct key *key_ref_to_ptr(const key_ref_t key_ref); bool is_key_possessed(const key_ref_t key_ref); The first function constructs a key reference from a key pointer and possession information (which must be true or false). The second function retrieves the key pointer from a reference and the third retrieves the possession flag. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒqstruct key * This simply points to the key structure itself. Key structures will be at least four-byte aligned. ”h]”(hÌ)�”}”(hŒ struct key *”h]”hŒ struct key *”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M\hj«ubhÌ)�”}”(hŒbThis simply points to the key structure itself. Key structures will be at least four-byte aligned.”h]”hŒbThis simply points to the key structure itself. Key structures will be at least four-byte aligned.”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M^hj«ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¨ubj*)�”}”(hX¼key_ref_t This is equivalent to a ``struct key *``, but the least significant bit is set if the caller "possesses" the key. By "possession" it is meant that the calling processes has a searchable link to the key from one of its keyrings. There are three functions for dealing with these:: key_ref_t make_key_ref(const struct key *key, bool possession); struct key *key_ref_to_ptr(const key_ref_t key_ref); bool is_key_possessed(const key_ref_t key_ref); The first function constructs a key reference from a key pointer and possession information (which must be true or false). The second function retrieves the key pointer from a reference and the third retrieves the possession flag. ”h]”(hÌ)�”}”(hŒ key_ref_t”h]”hŒ key_ref_t”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MahjÑubhÌ)�”}”(hXThis is equivalent to a ``struct key *``, but the least significant bit is set if the caller "possesses" the key. By "possession" it is meant that the calling processes has a searchable link to the key from one of its keyrings. There are three functions for dealing with these::”h]”(hŒThis is equivalent to a ”…”�”}”(hjãh²hh³Nh´Nubjª)�”}”(hŒ``struct key *``”h]”hŒ struct key *”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjãubhŒõ, but the least significant bit is set if the caller “possessesâ€� the key. By “possessionâ€� it is meant that the calling processes has a searchable link to the key from one of its keyrings. There are three functions for dealing with these:”…”�”}”(hjãh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MchjÑubjC )�”}”(hŒ¦key_ref_t make_key_ref(const struct key *key, bool possession); struct key *key_ref_to_ptr(const key_ref_t key_ref); bool is_key_possessed(const key_ref_t key_ref);”h]”hŒ¦key_ref_t make_key_ref(const struct key *key, bool possession); struct key *key_ref_to_ptr(const key_ref_t key_ref); bool is_key_possessed(const key_ref_t key_ref);”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MhhjÑubhÌ)�”}”(hŒzThe first function constructs a key reference from a key pointer and possession information (which must be true or false).”h]”hŒzThe first function constructs a key reference from a key pointer and possession information (which must be true or false).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MnhjÑubhÌ)�”}”(hŒkThe second function retrieves the key pointer from a reference and the third retrieves the possession flag.”h]”hŒkThe second function retrieves the key pointer from a reference and the third retrieves the possession flag.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MqhjÑubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj¨ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M\hj¤ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M\hj1h²hubhÌ)�”}”(hŒ¿When accessing a key's payload contents, certain precautions must be taken to prevent access vs modification races. See the section "Notes on accessing payload contents" for more information.”h]”hŒÅWhen accessing a key’s payload contents, certain precautions must be taken to prevent access vs modification races. See the section “Notes on accessing payload contentsâ€� for more information.”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mthj1h²hubhø)�”}”(hXU* To search for a key, call:: struct key *request_key(const struct key_type *type, const char *description, const char *callout_info); This is used to request a key or keyring with a description that matches the description specified according to the key type's match_preparse() method. This permits approximate matching to occur. If callout_string is not NULL, then /sbin/request-key will be invoked in an attempt to obtain the key from userspace. In that case, callout_string will be passed as an argument to the program. Should the function fail error ENOKEY, EKEYEXPIRED or EKEYREVOKED will be returned. If successful, the key will have been attached to the default keyring for implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING. See also Documentation/security/keys/request-key.rst. * To search for a key in a specific domain, call:: struct key *request_key_tag(const struct key_type *type, const char *description, struct key_tag *domain_tag, const char *callout_info); This is identical to request_key(), except that a domain tag may be specifies that causes search algorithm to only match keys matching that tag. The domain_tag may be NULL, specifying a global domain that is separate from any nominated domain. * To search for a key, passing auxiliary data to the upcaller, call:: struct key *request_key_with_auxdata(const struct key_type *type, const char *description, struct key_tag *domain_tag, const void *callout_info, size_t callout_len, void *aux); This is identical to request_key_tag(), except that the auxiliary data is passed to the key_type->request_key() op if it exists, and the callout_info is a blob of length callout_len, if given (the length may be 0). * To search for a key under RCU conditions, call:: struct key *request_key_rcu(const struct key_type *type, const char *description, struct key_tag *domain_tag); which is similar to request_key_tag() except that it does not check for keys that are under construction and it will not call out to userspace to construct a key if it can't find a match. * When it is no longer required, the key should be released using:: void key_put(struct key *key); Or:: void key_ref_put(key_ref_t key_ref); These can be called from interrupt context. If CONFIG_KEYS is not set then the argument will not be parsed. * Extra references can be made to a key by calling one of the following functions:: struct key *__key_get(struct key *key); struct key *key_get(struct key *key); Keys so references will need to be disposed of by calling key_put() when they've been finished with. The key pointer passed in will be returned. In the case of key_get(), if the pointer is NULL or CONFIG_KEYS is not set then the key will not be dereferenced and no increment will take place. * A key's serial number can be obtained by calling:: key_serial_t key_serial(struct key *key); If key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument). * If a keyring was found in the search, this can be further searched by:: key_ref_t keyring_search(key_ref_t keyring_ref, const struct key_type *type, const char *description, bool recurse) This searches the specified keyring only (recurse == false) or keyring tree (recurse == true) specified for a matching key. Error ENOKEY is returned upon failure (use IS_ERR/PTR_ERR to determine). If successful, the returned key will need to be released. The possession attribute from the keyring reference is used to control access through the permissions mask and is propagated to the returned key reference pointer if successful. * A keyring can be created by:: struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, key_perm_t perm, struct key_restriction *restrict_link, unsigned long flags, struct key *dest); This creates a keyring with the given attributes and returns it. If dest is not NULL, the new keyring will be linked into the keyring to which it points. No permission checks are made upon the destination keyring. Error EDQUOT can be returned if the keyring would overload the quota (pass KEY_ALLOC_NOT_IN_QUOTA in flags if the keyring shouldn't be accounted towards the user's quota). Error ENOMEM can also be returned. If restrict_link is not NULL, it should point to a structure that contains the function that will be called each time an attempt is made to link a key into the new keyring. The structure may also contain a key pointer and an associated key type. The function is called to check whether a key may be added into the keyring or not. The key type is used by the garbage collector to clean up function or data pointers in this structure if the given key type is unregistered. Callers of key_create_or_update() within the kernel can pass KEY_ALLOC_BYPASS_RESTRICTION to suppress the check. An example of using this is to manage rings of cryptographic keys that are set up when the kernel boots where userspace is also permitted to add keys - provided they can be verified by a key the kernel already has. When called, the restriction function will be passed the keyring being added to, the key type, the payload of the key being added, and data to be used in the restriction check. Note that when a new key is being created, this is called between payload preparsing and actual key creation. The function should return 0 to allow the link or an error to reject it. A convenience function, restrict_link_reject, exists to always return -EPERM to in this case. * To check the validity of a key, this function can be called:: int validate_key(struct key *key); This checks that the key in question hasn't expired or and hasn't been revoked. Should the key be invalid, error EKEYEXPIRED or EKEYREVOKED will be returned. If the key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument). * To register a key type, the following function should be called:: int register_key_type(struct key_type *type); This will return error EEXIST if a type of the same name is already present. * To unregister a key type, call:: void unregister_key_type(struct key_type *type); ”h]”j%)�”}”(hhh]”(j*)�”}”(hXkTo search for a key, call:: struct key *request_key(const struct key_type *type, const char *description, const char *callout_info); This is used to request a key or keyring with a description that matches the description specified according to the key type's match_preparse() method. This permits approximate matching to occur. If callout_string is not NULL, then /sbin/request-key will be invoked in an attempt to obtain the key from userspace. In that case, callout_string will be passed as an argument to the program. Should the function fail error ENOKEY, EKEYEXPIRED or EKEYREVOKED will be returned. If successful, the key will have been attached to the default keyring for implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING. See also Documentation/security/keys/request-key.rst. ”h]”(hÌ)�”}”(hŒTo search for a key, call::”h]”hŒTo search for a key, call:”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MxhjTubjC )�”}”(hŒ˜struct key *request_key(const struct key_type *type, const char *description, const char *callout_info);”h]”hŒ˜struct key *request_key(const struct key_type *type, const char *description, const char *callout_info);”…”�”}”hjfsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MzhjTubhÌ)�”}”(hX„This is used to request a key or keyring with a description that matches the description specified according to the key type's match_preparse() method. This permits approximate matching to occur. If callout_string is not NULL, then /sbin/request-key will be invoked in an attempt to obtain the key from userspace. In that case, callout_string will be passed as an argument to the program.”h]”hX†This is used to request a key or keyring with a description that matches the description specified according to the key type’s match_preparse() method. This permits approximate matching to occur. If callout_string is not NULL, then /sbin/request-key will be invoked in an attempt to obtain the key from userspace. In that case, callout_string will be passed as an argument to the program.”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M~hjTubhÌ)�”}”(hŒSShould the function fail error ENOKEY, EKEYEXPIRED or EKEYREVOKED will be returned.”h]”hŒSShould the function fail error ENOKEY, EKEYEXPIRED or EKEYREVOKED will be returned.”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M…hjTubhÌ)�”}”(hŒ”If successful, the key will have been attached to the default keyring for implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING.”h]”hŒ”If successful, the key will have been attached to the default keyring for implicitly obtained request-key keys, as set by KEYCTL_SET_REQKEY_KEYRING.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MˆhjTubhÌ)�”}”(hŒ5See also Documentation/security/keys/request-key.rst.”h]”hŒ5See also Documentation/security/keys/request-key.rst.”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‹hjTubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hXTo search for a key in a specific domain, call:: struct key *request_key_tag(const struct key_type *type, const char *description, struct key_tag *domain_tag, const char *callout_info); This is identical to request_key(), except that a domain tag may be specifies that causes search algorithm to only match keys matching that tag. The domain_tag may be NULL, specifying a global domain that is separate from any nominated domain. ”h]”(hÌ)�”}”(hŒ0To search for a key in a specific domain, call::”h]”hŒ/To search for a key in a specific domain, call:”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŽhj²ubjC )�”}”(hŒÜstruct key *request_key_tag(const struct key_type *type, const char *description, struct key_tag *domain_tag, const char *callout_info);”h]”hŒÜstruct key *request_key_tag(const struct key_type *type, const char *description, struct key_tag *domain_tag, const char *callout_info);”…”�”}”hjÄsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M�hj²ubhÌ)�”}”(hŒôThis is identical to request_key(), except that a domain tag may be specifies that causes search algorithm to only match keys matching that tag. The domain_tag may be NULL, specifying a global domain that is separate from any nominated domain.”h]”hŒôThis is identical to request_key(), except that a domain tag may be specifies that causes search algorithm to only match keys matching that tag. The domain_tag may be NULL, specifying a global domain that is separate from any nominated domain.”…”�”}”(hjÒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M•hj²ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hX To search for a key, passing auxiliary data to the upcaller, call:: struct key *request_key_with_auxdata(const struct key_type *type, const char *description, struct key_tag *domain_tag, const void *callout_info, size_t callout_len, void *aux); This is identical to request_key_tag(), except that the auxiliary data is passed to the key_type->request_key() op if it exists, and the callout_info is a blob of length callout_len, if given (the length may be 0). ”h]”(hÌ)�”}”(hŒCTo search for a key, passing auxiliary data to the upcaller, call::”h]”hŒBTo search for a key, passing auxiliary data to the upcaller, call:”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M›hjæubjC )�”}”(hXistruct key *request_key_with_auxdata(const struct key_type *type, const char *description, struct key_tag *domain_tag, const void *callout_info, size_t callout_len, void *aux);”h]”hXistruct key *request_key_with_auxdata(const struct key_type *type, const char *description, struct key_tag *domain_tag, const void *callout_info, size_t callout_len, void *aux);”…”�”}”hjøsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M�hjæubhÌ)�”}”(hŒÖThis is identical to request_key_tag(), except that the auxiliary data is passed to the key_type->request_key() op if it exists, and the callout_info is a blob of length callout_len, if given (the length may be 0).”h]”hŒÖThis is identical to request_key_tag(), except that the auxiliary data is passed to the key_type->request_key() op if it exists, and the callout_info is a blob of length callout_len, if given (the length may be 0).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¤hjæubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hX£To search for a key under RCU conditions, call:: struct key *request_key_rcu(const struct key_type *type, const char *description, struct key_tag *domain_tag); which is similar to request_key_tag() except that it does not check for keys that are under construction and it will not call out to userspace to construct a key if it can't find a match. ”h]”(hÌ)�”}”(hŒ0To search for a key under RCU conditions, call::”h]”hŒ/To search for a key under RCU conditions, call:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MªhjubjC )�”}”(hŒ¦struct key *request_key_rcu(const struct key_type *type, const char *description, struct key_tag *domain_tag);”h]”hŒ¦struct key *request_key_rcu(const struct key_type *type, const char *description, struct key_tag *domain_tag);”…”�”}”hj,sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M¬hjubhÌ)�”}”(hŒ»which is similar to request_key_tag() except that it does not check for keys that are under construction and it will not call out to userspace to construct a key if it can't find a match.”h]”hŒ½which is similar to request_key_tag() except that it does not check for keys that are under construction and it will not call out to userspace to construct a key if it can’t find a match.”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M°hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hXWhen it is no longer required, the key should be released using:: void key_put(struct key *key); Or:: void key_ref_put(key_ref_t key_ref); These can be called from interrupt context. If CONFIG_KEYS is not set then the argument will not be parsed. ”h]”(hÌ)�”}”(hŒAWhen it is no longer required, the key should be released using::”h]”hŒ@When it is no longer required, the key should be released using:”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MµhjNubjC )�”}”(hŒvoid key_put(struct key *key);”h]”hŒvoid key_put(struct key *key);”…”�”}”hj`sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M·hjNubhÌ)�”}”(hŒOr::”h]”hŒOr:”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¹hjNubjC )�”}”(hŒ$void key_ref_put(key_ref_t key_ref);”h]”hŒ$void key_ref_put(key_ref_t key_ref);”…”�”}”hj|sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M»hjNubhÌ)�”}”(hŒkThese can be called from interrupt context. If CONFIG_KEYS is not set then the argument will not be parsed.”h]”hŒkThese can be called from interrupt context. If CONFIG_KEYS is not set then the argument will not be parsed.”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M½hjNubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hXÑExtra references can be made to a key by calling one of the following functions:: struct key *__key_get(struct key *key); struct key *key_get(struct key *key); Keys so references will need to be disposed of by calling key_put() when they've been finished with. The key pointer passed in will be returned. In the case of key_get(), if the pointer is NULL or CONFIG_KEYS is not set then the key will not be dereferenced and no increment will take place. ”h]”(hÌ)�”}”(hŒQExtra references can be made to a key by calling one of the following functions::”h]”hŒPExtra references can be made to a key by calling one of the following functions:”…”�”}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÁhjžubjC )�”}”(hŒMstruct key *__key_get(struct key *key); struct key *key_get(struct key *key);”h]”hŒMstruct key *__key_get(struct key *key); struct key *key_get(struct key *key);”…”�”}”hj°sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MÄhjžubhÌ)�”}”(hŒ‘Keys so references will need to be disposed of by calling key_put() when they've been finished with. The key pointer passed in will be returned.”h]”hŒ“Keys so references will need to be disposed of by calling key_put() when they’ve been finished with. The key pointer passed in will be returned.”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÇhjžubhÌ)�”}”(hŒ’In the case of key_get(), if the pointer is NULL or CONFIG_KEYS is not set then the key will not be dereferenced and no increment will take place.”h]”hŒ’In the case of key_get(), if the pointer is NULL or CONFIG_KEYS is not set then the key will not be dereferenced and no increment will take place.”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÊhjžubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hŒÛA key's serial number can be obtained by calling:: key_serial_t key_serial(struct key *key); If key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument). ”h]”(hÌ)�”}”(hŒ2A key's serial number can be obtained by calling::”h]”hŒ3A key’s serial number can be obtained by calling:”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÎhjàubjC )�”}”(hŒ)key_serial_t key_serial(struct key *key);”h]”hŒ)key_serial_t key_serial(struct key *key);”…”�”}”hjòsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MÐhjàubhÌ)�”}”(hŒvIf key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument).”h]”hŒvIf key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÒhjàubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hXÌIf a keyring was found in the search, this can be further searched by:: key_ref_t keyring_search(key_ref_t keyring_ref, const struct key_type *type, const char *description, bool recurse) This searches the specified keyring only (recurse == false) or keyring tree (recurse == true) specified for a matching key. Error ENOKEY is returned upon failure (use IS_ERR/PTR_ERR to determine). If successful, the returned key will need to be released. The possession attribute from the keyring reference is used to control access through the permissions mask and is propagated to the returned key reference pointer if successful. ”h]”(hÌ)�”}”(hŒGIf a keyring was found in the search, this can be further searched by::”h]”hŒFIf a keyring was found in the search, this can be further searched by:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÖhjubjC )�”}”(hŒ¾key_ref_t keyring_search(key_ref_t keyring_ref, const struct key_type *type, const char *description, bool recurse)”h]”hŒ¾key_ref_t keyring_search(key_ref_t keyring_ref, const struct key_type *type, const char *description, bool recurse)”…”�”}”hj&sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MØhjubhÌ)�”}”(hŒþThis searches the specified keyring only (recurse == false) or keyring tree (recurse == true) specified for a matching key. Error ENOKEY is returned upon failure (use IS_ERR/PTR_ERR to determine). If successful, the returned key will need to be released.”h]”hŒþThis searches the specified keyring only (recurse == false) or keyring tree (recurse == true) specified for a matching key. Error ENOKEY is returned upon failure (use IS_ERR/PTR_ERR to determine). If successful, the returned key will need to be released.”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÝhjubhÌ)�”}”(hŒ±The possession attribute from the keyring reference is used to control access through the permissions mask and is propagated to the returned key reference pointer if successful.”h]”hŒ±The possession attribute from the keyring reference is used to control access through the permissions mask and is propagated to the returned key reference pointer if successful.”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mâhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hXA keyring can be created by:: struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, key_perm_t perm, struct key_restriction *restrict_link, unsigned long flags, struct key *dest); This creates a keyring with the given attributes and returns it. If dest is not NULL, the new keyring will be linked into the keyring to which it points. No permission checks are made upon the destination keyring. Error EDQUOT can be returned if the keyring would overload the quota (pass KEY_ALLOC_NOT_IN_QUOTA in flags if the keyring shouldn't be accounted towards the user's quota). Error ENOMEM can also be returned. If restrict_link is not NULL, it should point to a structure that contains the function that will be called each time an attempt is made to link a key into the new keyring. The structure may also contain a key pointer and an associated key type. The function is called to check whether a key may be added into the keyring or not. The key type is used by the garbage collector to clean up function or data pointers in this structure if the given key type is unregistered. Callers of key_create_or_update() within the kernel can pass KEY_ALLOC_BYPASS_RESTRICTION to suppress the check. An example of using this is to manage rings of cryptographic keys that are set up when the kernel boots where userspace is also permitted to add keys - provided they can be verified by a key the kernel already has. When called, the restriction function will be passed the keyring being added to, the key type, the payload of the key being added, and data to be used in the restriction check. Note that when a new key is being created, this is called between payload preparsing and actual key creation. The function should return 0 to allow the link or an error to reject it. A convenience function, restrict_link_reject, exists to always return -EPERM to in this case. ”h]”(hÌ)�”}”(hŒA keyring can be created by::”h]”hŒA keyring can be created by:”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MçhjVubjC )�”}”(hXCstruct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, key_perm_t perm, struct key_restriction *restrict_link, unsigned long flags, struct key *dest);”h]”hXCstruct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, const struct cred *cred, key_perm_t perm, struct key_restriction *restrict_link, unsigned long flags, struct key *dest);”…”�”}”hjhsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MéhjVubhÌ)�”}”(hŒ×This creates a keyring with the given attributes and returns it. If dest is not NULL, the new keyring will be linked into the keyring to which it points. No permission checks are made upon the destination keyring.”h]”hŒ×This creates a keyring with the given attributes and returns it. If dest is not NULL, the new keyring will be linked into the keyring to which it points. No permission checks are made upon the destination keyring.”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MðhjVubhÌ)�”}”(hŒÏError EDQUOT can be returned if the keyring would overload the quota (pass KEY_ALLOC_NOT_IN_QUOTA in flags if the keyring shouldn't be accounted towards the user's quota). Error ENOMEM can also be returned.”h]”hŒÓError EDQUOT can be returned if the keyring would overload the quota (pass KEY_ALLOC_NOT_IN_QUOTA in flags if the keyring shouldn’t be accounted towards the user’s quota). Error ENOMEM can also be returned.”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MôhjVubhÌ)�”}”(hX"If restrict_link is not NULL, it should point to a structure that contains the function that will be called each time an attempt is made to link a key into the new keyring. The structure may also contain a key pointer and an associated key type. The function is called to check whether a key may be added into the keyring or not. The key type is used by the garbage collector to clean up function or data pointers in this structure if the given key type is unregistered. Callers of key_create_or_update() within the kernel can pass KEY_ALLOC_BYPASS_RESTRICTION to suppress the check. An example of using this is to manage rings of cryptographic keys that are set up when the kernel boots where userspace is also permitted to add keys - provided they can be verified by a key the kernel already has.”h]”hX"If restrict_link is not NULL, it should point to a structure that contains the function that will be called each time an attempt is made to link a key into the new keyring. The structure may also contain a key pointer and an associated key type. The function is called to check whether a key may be added into the keyring or not. The key type is used by the garbage collector to clean up function or data pointers in this structure if the given key type is unregistered. Callers of key_create_or_update() within the kernel can pass KEY_ALLOC_BYPASS_RESTRICTION to suppress the check. An example of using this is to manage rings of cryptographic keys that are set up when the kernel boots where userspace is also permitted to add keys - provided they can be verified by a key the kernel already has.”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MøhjVubhÌ)�”}”(hXiWhen called, the restriction function will be passed the keyring being added to, the key type, the payload of the key being added, and data to be used in the restriction check. Note that when a new key is being created, this is called between payload preparsing and actual key creation. The function should return 0 to allow the link or an error to reject it.”h]”hXiWhen called, the restriction function will be passed the keyring being added to, the key type, the payload of the key being added, and data to be used in the restriction check. Note that when a new key is being created, this is called between payload preparsing and actual key creation. The function should return 0 to allow the link or an error to reject it.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjVubhÌ)�”}”(hŒ]A convenience function, restrict_link_reject, exists to always return -EPERM to in this case.”h]”hŒ]A convenience function, restrict_link_reject, exists to always return -EPERM to in this case.”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hjVubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjQubj*)�”}”(hX�To check the validity of a key, this function can be called:: int validate_key(struct key *key); This checks that the key in question hasn't expired or and hasn't been revoked. Should the key be invalid, error EKEYEXPIRED or EKEYREVOKED will be returned. If the key is NULL or if CONFIG_KEYS is not set then 0 will be returned (in the latter case without parsing the argument). ”h]”(hÌ)�”}”(hŒ=To check the validity of a key, this function can be called::”h]”hŒpayload directly. In this case, there's no need to indulge in RCU or locking when accessing the payload.”h]”hŒœThe simplest payload is just data stored in key->payload directly. In this case, there’s no need to indulge in RCU or locking when accessing the payload.”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M3hj�h²hubhÌ)�”}”(hŒªMore complex payload contents must be allocated and pointers to them set in the key->payload.data[] array. One of the following ways must be selected to access the data:”h]”hŒªMore complex payload contents must be allocated and pointers to them set in the key->payload.data[] array. One of the following ways must be selected to access the data:”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M6hj�h²hubhø)�”}”(hX·1) Unmodifiable key type. If the key type does not have a modify method, then the key's payload can be accessed without any form of locking, provided that it's known to be instantiated (uninstantiated keys cannot be "found"). 2) The key's semaphore. The semaphore could be used to govern access to the payload and to control the payload pointer. It must be write-locked for modifications and would have to be read-locked for general access. The disadvantage of doing this is that the accessor may be required to sleep. 3) RCU. RCU must be used when the semaphore isn't already held; if the semaphore is held then the contents can't change under you unexpectedly as the semaphore must still be used to serialise modifications to the key. The key management code takes care of this for the key type. However, this means using:: rcu_read_lock() ... rcu_dereference() ... rcu_read_unlock() to read the pointer, and:: rcu_dereference() ... rcu_assign_pointer() ... call_rcu() to set the pointer and dispose of the old contents after a grace period. Note that only the key type should ever modify a key's payload. Furthermore, an RCU controlled payload must hold a struct rcu_head for the use of call_rcu() and, if the payload is of variable size, the length of the payload. key->datalen cannot be relied upon to be consistent with the payload just dereferenced if the key's semaphore is not held. Note that key->payload.data[0] has a shadow that is marked for __rcu usage. This is called key->payload.rcu_data0. The following accessors wrap the RCU calls to this element: a) Set or change the first payload pointer:: rcu_assign_keypointer(struct key *key, void *data); b) Read the first payload pointer with the key semaphore held:: [const] void *dereference_key_locked([const] struct key *key); Note that the return value will inherit its constness from the key parameter. Static analysis will give an error if it things the lock isn't held. c) Read the first payload pointer with the RCU read lock held:: const void *dereference_key_rcu(const struct key *key); ”h]”hŒenumerated_list”“”)�”}”(hhh]”(j*)�”}”(hŒàUnmodifiable key type. If the key type does not have a modify method, then the key's payload can be accessed without any form of locking, provided that it's known to be instantiated (uninstantiated keys cannot be "found"). ”h]”(hÌ)�”}”(hŒUnmodifiable key type.”h]”hŒUnmodifiable key type.”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M:hjÃubhÌ)�”}”(hŒÇIf the key type does not have a modify method, then the key's payload can be accessed without any form of locking, provided that it's known to be instantiated (uninstantiated keys cannot be "found").”h]”hŒÏIf the key type does not have a modify method, then the key’s payload can be accessed without any form of locking, provided that it’s known to be instantiated (uninstantiated keys cannot be “foundâ€�).”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M<hjÃubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjÀubj*)�”}”(hX#The key's semaphore. The semaphore could be used to govern access to the payload and to control the payload pointer. It must be write-locked for modifications and would have to be read-locked for general access. The disadvantage of doing this is that the accessor may be required to sleep. ”h]”(hÌ)�”}”(hŒThe key's semaphore.”h]”hŒThe key’s semaphore.”…”�”}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M@hjéubhÌ)�”}”(hX The semaphore could be used to govern access to the payload and to control the payload pointer. It must be write-locked for modifications and would have to be read-locked for general access. The disadvantage of doing this is that the accessor may be required to sleep.”h]”hX The semaphore could be used to govern access to the payload and to control the payload pointer. It must be write-locked for modifications and would have to be read-locked for general access. The disadvantage of doing this is that the accessor may be required to sleep.”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MBhjéubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjÀubj*)�”}”(hXFRCU. RCU must be used when the semaphore isn't already held; if the semaphore is held then the contents can't change under you unexpectedly as the semaphore must still be used to serialise modifications to the key. The key management code takes care of this for the key type. However, this means using:: rcu_read_lock() ... rcu_dereference() ... rcu_read_unlock() to read the pointer, and:: rcu_dereference() ... rcu_assign_pointer() ... call_rcu() to set the pointer and dispose of the old contents after a grace period. Note that only the key type should ever modify a key's payload. Furthermore, an RCU controlled payload must hold a struct rcu_head for the use of call_rcu() and, if the payload is of variable size, the length of the payload. key->datalen cannot be relied upon to be consistent with the payload just dereferenced if the key's semaphore is not held. Note that key->payload.data[0] has a shadow that is marked for __rcu usage. This is called key->payload.rcu_data0. The following accessors wrap the RCU calls to this element: a) Set or change the first payload pointer:: rcu_assign_keypointer(struct key *key, void *data); b) Read the first payload pointer with the key semaphore held:: [const] void *dereference_key_locked([const] struct key *key); Note that the return value will inherit its constness from the key parameter. Static analysis will give an error if it things the lock isn't held. c) Read the first payload pointer with the RCU read lock held:: const void *dereference_key_rcu(const struct key *key); ”h]”(hÌ)�”}”(hŒRCU.”h]”hŒRCU.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MGhjubhÌ)�”}”(hXRCU must be used when the semaphore isn't already held; if the semaphore is held then the contents can't change under you unexpectedly as the semaphore must still be used to serialise modifications to the key. The key management code takes care of this for the key type.”h]”hXRCU must be used when the semaphore isn’t already held; if the semaphore is held then the contents can’t change under you unexpectedly as the semaphore must still be used to serialise modifications to the key. The key management code takes care of this for the key type.”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MIhjubhÌ)�”}”(hŒHowever, this means using::”h]”hŒHowever, this means using:”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MNhjubjC )�”}”(hŒ;rcu_read_lock() ... rcu_dereference() ... rcu_read_unlock()”h]”hŒ;rcu_read_lock() ... rcu_dereference() ... rcu_read_unlock()”…”�”}”hj=sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MPhjubhÌ)�”}”(hŒto read the pointer, and::”h]”hŒto read the pointer, and:”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MRhjubjC )�”}”(hŒ9rcu_dereference() ... rcu_assign_pointer() ... call_rcu()”h]”hŒ9rcu_dereference() ... rcu_assign_pointer() ... call_rcu()”…”�”}”hjYsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MThjubhÌ)�”}”(hŒˆto set the pointer and dispose of the old contents after a grace period. Note that only the key type should ever modify a key's payload.”h]”hŒŠto set the pointer and dispose of the old contents after a grace period. Note that only the key type should ever modify a key’s payload.”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MVhjubhÌ)�”}”(hXFurthermore, an RCU controlled payload must hold a struct rcu_head for the use of call_rcu() and, if the payload is of variable size, the length of the payload. key->datalen cannot be relied upon to be consistent with the payload just dereferenced if the key's semaphore is not held.”h]”hXFurthermore, an RCU controlled payload must hold a struct rcu_head for the use of call_rcu() and, if the payload is of variable size, the length of the payload. key->datalen cannot be relied upon to be consistent with the payload just dereferenced if the key’s semaphore is not held.”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MYhjubhÌ)�”}”(hŒ°Note that key->payload.data[0] has a shadow that is marked for __rcu usage. This is called key->payload.rcu_data0. The following accessors wrap the RCU calls to this element:”h]”hŒ°Note that key->payload.data[0] has a shadow that is marked for __rcu usage. This is called key->payload.rcu_data0. The following accessors wrap the RCU calls to this element:”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M^hjubj¿)�”}”(hhh]”(j*)�”}”(hŒgSet or change the first payload pointer:: rcu_assign_keypointer(struct key *key, void *data); ”h]”(hÌ)�”}”(hŒ)Set or change the first payload pointer::”h]”hŒ(Set or change the first payload pointer:”…”�”}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mbhj”ubjC )�”}”(hŒ3rcu_assign_keypointer(struct key *key, void *data);”h]”hŒ3rcu_assign_keypointer(struct key *key, void *data);”…”�”}”hj¦sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´Mdhj”ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hj‘ubj*)�”}”(hXRead the first payload pointer with the key semaphore held:: [const] void *dereference_key_locked([const] struct key *key); Note that the return value will inherit its constness from the key parameter. Static analysis will give an error if it things the lock isn't held. ”h]”(hÌ)�”}”(hŒ”h]”hŒ”…”�”}”hjXsbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M|hj+h²hubhÌ)�”}”(hŒBThe structure has a number of fields, some of which are mandatory:”h]”hŒBThe structure has a number of fields, some of which are mandatory:”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M~hj+h²hubhø)�”}”(hX6>* ``const char *name`` The name of the key type. This is used to translate a key type name supplied by userspace into a pointer to the structure. * ``size_t def_datalen`` This is optional - it supplies the default payload data length as contributed to the quota. If the key type's payload is always or almost always the same size, then this is a more efficient way to do things. The data length (and quota) on a particular key can always be changed during instantiation or update by calling:: int key_payload_reserve(struct key *key, size_t datalen); With the revised data length. Error EDQUOT will be returned if this is not viable. * ``int (*vet_description)(const char *description);`` This optional method is called to vet a key description. If the key type doesn't approve of the key description, it may return an error, otherwise it should return 0. * ``int (*preparse)(struct key_preparsed_payload *prep);`` This optional method permits the key type to attempt to parse payload before a key is created (add key) or the key semaphore is taken (update or instantiate key). The structure pointed to by prep looks like:: struct key_preparsed_payload { char *description; union key_payload payload; const void *data; size_t datalen; size_t quotalen; time_t expiry; }; Before calling the method, the caller will fill in data and datalen with the payload blob parameters; quotalen will be filled in with the default quota size from the key type; expiry will be set to TIME_T_MAX and the rest will be cleared. If a description can be proposed from the payload contents, that should be attached as a string to the description field. This will be used for the key description if the caller of add_key() passes NULL or "". The method can attach anything it likes to payload. This is merely passed along to the instantiate() or update() operations. If set, the expiry time will be applied to the key if it is instantiated from this data. The method should return 0 if successful or a negative error code otherwise. * ``void (*free_preparse)(struct key_preparsed_payload *prep);`` This method is only required if the preparse() method is provided, otherwise it is unused. It cleans up anything attached to the description and payload fields of the key_preparsed_payload struct as filled in by the preparse() method. It will always be called after preparse() returns successfully, even if instantiate() or update() succeed. * ``int (*instantiate)(struct key *key, struct key_preparsed_payload *prep);`` This method is called to attach a payload to a key during construction. The payload attached need not bear any relation to the data passed to this function. The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also. If the amount of data attached to the key differs from the size in keytype->def_datalen, then key_payload_reserve() should be called. This method does not have to lock the key in order to attach a payload. The fact that KEY_FLAG_INSTANTIATED is not set in key->flags prevents anything else from gaining access to the key. It is safe to sleep in this method. generic_key_instantiate() is provided to simply copy the data from prep->payload.data[] to key->payload.data[], with RCU-safe assignment on the first element. It will then clear prep->payload.data[] so that the free_preparse method doesn't release the data. * ``int (*update)(struct key *key, const void *data, size_t datalen);`` If this type of key can be updated, then this method should be provided. It is called to update a key's payload from the blob of data provided. The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also. key_payload_reserve() should be called if the data length might change before any changes are actually made. Note that if this succeeds, the type is committed to changing the key because it's already been altered, so all memory allocation must be done first. The key will have its semaphore write-locked before this method is called, but this only deters other writers; any changes to the key's payload must be made under RCU conditions, and call_rcu() must be used to dispose of the old payload. key_payload_reserve() should be called before the changes are made, but after all allocations and other potentially failing function calls are made. It is safe to sleep in this method. * ``int (*match_preparse)(struct key_match_data *match_data);`` This method is optional. It is called when a key search is about to be performed. It is given the following structure:: struct key_match_data { bool (*cmp)(const struct key *key, const struct key_match_data *match_data); const void *raw_data; void *preparsed; unsigned lookup_type; }; On entry, raw_data will be pointing to the criteria to be used in matching a key by the caller and should not be modified. ``(*cmp)()`` will be pointing to the default matcher function (which does an exact description match against raw_data) and lookup_type will be set to indicate a direct lookup. The following lookup_type values are available: * KEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys. * KEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that's not doing a simple direct match on the key description. The method may set cmp to point to a function of its choice that does some other form of match, may set lookup_type to KEYRING_SEARCH_LOOKUP_ITERATE and may attach something to the preparsed pointer for use by ``(*cmp)()``. ``(*cmp)()`` should return true if a key matches and false otherwise. If preparsed is set, it may be necessary to use the match_free() method to clean it up. The method should return 0 if successful or a negative error code otherwise. It is permitted to sleep in this method, but ``(*cmp)()`` may not sleep as locks will be held over it. If match_preparse() is not provided, keys of this type will be matched exactly by their description. * ``void (*match_free)(struct key_match_data *match_data);`` This method is optional. If given, it called to clean up match_data->preparsed after a successful call to match_preparse(). * ``void (*revoke)(struct key *key);`` This method is optional. It is called to discard part of the payload data upon a key being revoked. The caller will have the key semaphore write-locked. It is safe to sleep in this method, though care should be taken to avoid a deadlock against the key semaphore. * ``void (*destroy)(struct key *key);`` This method is optional. It is called to discard the payload data on a key when it is being destroyed. This method does not need to lock the key to access the payload; it can consider the key as being inaccessible at this time. Note that the key's type may have been changed before this function is called. It is not safe to sleep in this method; the caller may hold spinlocks. * ``void (*describe)(const struct key *key, struct seq_file *p);`` This method is optional. It is called during /proc/keys reading to summarise a key's description and payload in text form. This method will be called with the RCU read lock held. rcu_dereference() should be used to read the payload pointer if the payload is to be accessed. key->datalen cannot be trusted to stay consistent with the contents of the payload. The description will not change, though the key's state may. It is not safe to sleep in this method; the RCU read lock is held by the caller. * ``long (*read)(const struct key *key, char __user *buffer, size_t buflen);`` This method is optional. It is called by KEYCTL_READ to translate the key's payload into something a blob of data for userspace to deal with. Ideally, the blob should be in the same format as that passed in to the instantiate and update methods. If successful, the blob size that could be produced should be returned rather than the size copied. This method will be called with the key's semaphore read-locked. This will prevent the key's payload changing. It is not necessary to use RCU locking when accessing the key's payload. It is safe to sleep in this method, such as might happen when the userspace buffer is accessed. * ``int (*request_key)(struct key_construction *cons, const char *op, void *aux);`` This method is optional. If provided, request_key() and friends will invoke this function rather than upcalling to /sbin/request-key to operate upon a key of this type. The aux parameter is as passed to request_key_async_with_auxdata() and similar or is NULL otherwise. Also passed are the construction record for the key to be operated upon and the operation type (currently only "create"). This method is permitted to return before the upcall is complete, but the following function must be called under all circumstances to complete the instantiation process, whether or not it succeeds, whether or not there's an error:: void complete_request_key(struct key_construction *cons, int error); The error parameter should be 0 on success, -ve on error. The construction record is destroyed by this action and the authorisation key will be revoked. If an error is indicated, the key under construction will be negatively instantiated if it wasn't already instantiated. If this method returns an error, that error will be returned to the caller of request_key*(). complete_request_key() must be called prior to returning. The key under construction and the authorisation key can be found in the key_construction struct pointed to by cons: * ``struct key *key;`` The key under construction. * ``struct key *authkey;`` The authorisation key. * ``struct key_restriction *(*lookup_restriction)(const char *params);`` This optional method is used to enable userspace configuration of keyring restrictions. The restriction parameter string (not including the key type name) is passed in, and this method returns a pointer to a key_restriction structure containing the relevant functions and data to evaluate each attempted key link operation. If there is no match, -EINVAL is returned. * ``asym_eds_op`` and ``asym_verify_signature``:: int (*asym_eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*asym_verify_signature)(struct kernel_pkey_params *params, const void *in, const void *in2); These methods are optional. If provided the first allows a key to be used to encrypt, decrypt or sign a blob of data, and the second allows a key to verify a signature. In all cases, the following information is provided in the params block:: struct kernel_pkey_params { struct key *key; const char *encoding; const char *hash_algo; char *info; __u32 in_len; union { __u32 out_len; __u32 in2_len; }; enum kernel_pkey_operation op : 8; }; This includes the key to be used; a string indicating the encoding to use (for instance, "pkcs1" may be used with an RSA key to indicate RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5 encoding or "raw" if no encoding); the name of the hash algorithm used to generate the data for a signature (if appropriate); the sizes of the input and output (or second input) buffers; and the ID of the operation to be performed. For a given operation ID, the input and output buffers are used as follows:: Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== kernel_pkey_encrypt Raw data Encrypted data - kernel_pkey_decrypt Encrypted data Raw data - kernel_pkey_sign Raw data Signature - kernel_pkey_verify Raw data - Signature asym_eds_op() deals with encryption, decryption and signature creation as specified by params->op. Note that params->op is also set for asym_verify_signature(). Encrypting and signature creation both take raw data in the input buffer and return the encrypted result in the output buffer. Padding may have been added if an encoding was set. In the case of signature creation, depending on the encoding, the padding created may need to indicate the digest algorithm - the name of which should be supplied in hash_algo. Decryption takes encrypted data in the input buffer and returns the raw data in the output buffer. Padding will get checked and stripped off if an encoding was set. Verification takes raw data in the input buffer and the signature in the second input buffer and checks that the one matches the other. Padding will be validated. Depending on the encoding, the digest algorithm used to generate the raw data may need to be indicated in hash_algo. If successful, asym_eds_op() should return the number of bytes written into the output buffer. asym_verify_signature() should return 0. A variety of errors may be returned, including EOPNOTSUPP if the operation is not supported; EKEYREJECTED if verification fails; ENOPKG if the required crypto isn't available. * ``asym_query``:: int (*asym_query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info); This method is optional. If provided it allows information about the public or asymmetric key held in the key to be determined. The parameter block is as for asym_eds_op() and co. but in_len and out_len are unused. The encoding and hash_algo fields should be used to reduce the returned buffer/data sizes as appropriate. If successful, the following information is filled in:: struct kernel_pkey_query { __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; }; The supported_ops field will contain a bitmask indicating what operations are supported by the key, including encryption of a blob, decryption of a blob, signing a blob and verifying the signature on a blob. The following constants are defined for this:: KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY} The key_size field is the size of the key in bits. max_data_size and max_sig_size are the maximum raw data and signature sizes for creation and verification of a signature; max_enc_size and max_dec_size are the maximum raw data and signature sizes for encryption and decryption. The max_*_size fields are measured in bytes. If successful, 0 will be returned. If the key doesn't support this, EOPNOTSUPP will be returned. ”•‹h]”j%)�”}”(hhh]”(j*)�”}”(hŒ’``const char *name`` The name of the key type. This is used to translate a key type name supplied by userspace into a pointer to the structure. ”h]”(hÌ)�”}”(hŒ``const char *name``”h]”jª)�”}”(hj�h]”hŒconst char *name”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M€hj{ubhÌ)�”}”(hŒzThe name of the key type. This is used to translate a key type name supplied by userspace into a pointer to the structure.”h]”hŒzThe name of the key type. This is used to translate a key type name supplied by userspace into a pointer to the structure.”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‚hj{ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hXî``size_t def_datalen`` This is optional - it supplies the default payload data length as contributed to the quota. If the key type's payload is always or almost always the same size, then this is a more efficient way to do things. The data length (and quota) on a particular key can always be changed during instantiation or update by calling:: int key_payload_reserve(struct key *key, size_t datalen); With the revised data length. Error EDQUOT will be returned if this is not viable. ”h]”(hÌ)�”}”(hŒ``size_t def_datalen``”h]”jª)�”}”(hj°h]”hŒsize_t def_datalen”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj®ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M†hjªubhÌ)�”}”(hŒÏThis is optional - it supplies the default payload data length as contributed to the quota. If the key type's payload is always or almost always the same size, then this is a more efficient way to do things.”h]”hŒÑThis is optional - it supplies the default payload data length as contributed to the quota. If the key type’s payload is always or almost always the same size, then this is a more efficient way to do things.”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MˆhjªubhÌ)�”}”(hŒqThe data length (and quota) on a particular key can always be changed during instantiation or update by calling::”h]”hŒpThe data length (and quota) on a particular key can always be changed during instantiation or update by calling:”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŒhjªubjC )�”}”(hŒ9int key_payload_reserve(struct key *key, size_t datalen);”h]”hŒ9int key_payload_reserve(struct key *key, size_t datalen);”…”�”}”hjásbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M�hjªubhÌ)�”}”(hŒRWith the revised data length. Error EDQUOT will be returned if this is not viable.”h]”hŒRWith the revised data length. Error EDQUOT will be returned if this is not viable.”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‘hjªubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hŒß``int (*vet_description)(const char *description);`` This optional method is called to vet a key description. If the key type doesn't approve of the key description, it may return an error, otherwise it should return 0. ”h]”(hÌ)�”}”(hŒ4``int (*vet_description)(const char *description);``”h]”jª)�”}”(hj h]”hŒ0int (*vet_description)(const char *description);”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M•hjubhÌ)�”}”(hŒ§This optional method is called to vet a key description. If the key type doesn't approve of the key description, it may return an error, otherwise it should return 0.”h]”hŒ©This optional method is called to vet a key description. If the key type doesn’t approve of the key description, it may return an error, otherwise it should return 0.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M—hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hXþ``int (*preparse)(struct key_preparsed_payload *prep);`` This optional method permits the key type to attempt to parse payload before a key is created (add key) or the key semaphore is taken (update or instantiate key). The structure pointed to by prep looks like:: struct key_preparsed_payload { char *description; union key_payload payload; const void *data; size_t datalen; size_t quotalen; time_t expiry; }; Before calling the method, the caller will fill in data and datalen with the payload blob parameters; quotalen will be filled in with the default quota size from the key type; expiry will be set to TIME_T_MAX and the rest will be cleared. If a description can be proposed from the payload contents, that should be attached as a string to the description field. This will be used for the key description if the caller of add_key() passes NULL or "". The method can attach anything it likes to payload. This is merely passed along to the instantiate() or update() operations. If set, the expiry time will be applied to the key if it is instantiated from this data. The method should return 0 if successful or a negative error code otherwise. ”h]”(hÌ)�”}”(hŒ8``int (*preparse)(struct key_preparsed_payload *prep);``”h]”jª)�”}”(hj8h]”hŒ4int (*preparse)(struct key_preparsed_payload *prep);”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mœhj2ubhÌ)�”}”(hŒÑThis optional method permits the key type to attempt to parse payload before a key is created (add key) or the key semaphore is taken (update or instantiate key). The structure pointed to by prep looks like::”h]”hŒÐThis optional method permits the key type to attempt to parse payload before a key is created (add key) or the key semaphore is taken (update or instantiate key). The structure pointed to by prep looks like:”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mžhj2ubjC )�”}”(hŒìstruct key_preparsed_payload { char *description; union key_payload payload; const void *data; size_t datalen; size_t quotalen; time_t expiry; };”h]”hŒìstruct key_preparsed_payload { char *description; union key_payload payload; const void *data; size_t datalen; size_t quotalen; time_t expiry; };”…”�”}”hj[sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M¢hj2ubhÌ)�”}”(hŒîBefore calling the method, the caller will fill in data and datalen with the payload blob parameters; quotalen will be filled in with the default quota size from the key type; expiry will be set to TIME_T_MAX and the rest will be cleared.”h]”hŒîBefore calling the method, the caller will fill in data and datalen with the payload blob parameters; quotalen will be filled in with the default quota size from the key type; expiry will be set to TIME_T_MAX and the rest will be cleared.”…”�”}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M«hj2ubhÌ)�”}”(hŒÒIf a description can be proposed from the payload contents, that should be attached as a string to the description field. This will be used for the key description if the caller of add_key() passes NULL or "".”h]”hŒÖIf a description can be proposed from the payload contents, that should be attached as a string to the description field. This will be used for the key description if the caller of add_key() passes NULL or “â€�.”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M°hj2ubhÌ)�”}”(hŒ×The method can attach anything it likes to payload. This is merely passed along to the instantiate() or update() operations. If set, the expiry time will be applied to the key if it is instantiated from this data.”h]”hŒ×The method can attach anything it likes to payload. This is merely passed along to the instantiate() or update() operations. If set, the expiry time will be applied to the key if it is instantiated from this data.”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M´hj2ubhÌ)�”}”(hŒLThe method should return 0 if successful or a negative error code otherwise.”h]”hŒLThe method should return 0 if successful or a negative error code otherwise.”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¸hj2ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX™``void (*free_preparse)(struct key_preparsed_payload *prep);`` This method is only required if the preparse() method is provided, otherwise it is unused. It cleans up anything attached to the description and payload fields of the key_preparsed_payload struct as filled in by the preparse() method. It will always be called after preparse() returns successfully, even if instantiate() or update() succeed. ”h]”(hÌ)�”}”(hŒ>``void (*free_preparse)(struct key_preparsed_payload *prep);``”h]”jª)�”}”(hj­h]”hŒ:void (*free_preparse)(struct key_preparsed_payload *prep);”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj«ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¼hj§ubhÌ)�”}”(hXWThis method is only required if the preparse() method is provided, otherwise it is unused. It cleans up anything attached to the description and payload fields of the key_preparsed_payload struct as filled in by the preparse() method. It will always be called after preparse() returns successfully, even if instantiate() or update() succeed.”h]”hXWThis method is only required if the preparse() method is provided, otherwise it is unused. It cleans up anything attached to the description and payload fields of the key_preparsed_payload struct as filled in by the preparse() method. It will always be called after preparse() returns successfully, even if instantiate() or update() succeed.”…”�”}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¾hj§ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hXî``int (*instantiate)(struct key *key, struct key_preparsed_payload *prep);`` This method is called to attach a payload to a key during construction. The payload attached need not bear any relation to the data passed to this function. The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also. If the amount of data attached to the key differs from the size in keytype->def_datalen, then key_payload_reserve() should be called. This method does not have to lock the key in order to attach a payload. The fact that KEY_FLAG_INSTANTIATED is not set in key->flags prevents anything else from gaining access to the key. It is safe to sleep in this method. generic_key_instantiate() is provided to simply copy the data from prep->payload.data[] to key->payload.data[], with RCU-safe assignment on the first element. It will then clear prep->payload.data[] so that the free_preparse method doesn't release the data. ”h]”(hÌ)�”}”(hŒL``int (*instantiate)(struct key *key, struct key_preparsed_payload *prep);``”h]”jª)�”}”(hjÜh]”hŒHint (*instantiate)(struct key *key, struct key_preparsed_payload *prep);”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjÚubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÅhjÖubhÌ)�”}”(hŒœThis method is called to attach a payload to a key during construction. The payload attached need not bear any relation to the data passed to this function.”h]”hŒœThis method is called to attach a payload to a key during construction. The payload attached need not bear any relation to the data passed to this function.”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÇhjÖubhÌ)�”}”(hŒ“The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also.”h]”hŒ“The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also.”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MËhjÖubhÌ)�”}”(hŒ…If the amount of data attached to the key differs from the size in keytype->def_datalen, then key_payload_reserve() should be called.”h]”hŒ…If the amount of data attached to the key differs from the size in keytype->def_datalen, then key_payload_reserve() should be called.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÎhjÖubhÌ)�”}”(hŒ»This method does not have to lock the key in order to attach a payload. The fact that KEY_FLAG_INSTANTIATED is not set in key->flags prevents anything else from gaining access to the key.”h]”hŒ»This method does not have to lock the key in order to attach a payload. The fact that KEY_FLAG_INSTANTIATED is not set in key->flags prevents anything else from gaining access to the key.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÑhjÖubhÌ)�”}”(hŒ#It is safe to sleep in this method.”h]”hŒ#It is safe to sleep in this method.”…”�”}”(hj) h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÕhjÖubhÌ)�”}”(hXgeneric_key_instantiate() is provided to simply copy the data from prep->payload.data[] to key->payload.data[], with RCU-safe assignment on the first element. It will then clear prep->payload.data[] so that the free_preparse method doesn't release the data.”h]”hXgeneric_key_instantiate() is provided to simply copy the data from prep->payload.data[] to key->payload.data[], with RCU-safe assignment on the first element. It will then clear prep->payload.data[] so that the free_preparse method doesn’t release the data.”…”�”}”(hj7 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M×hjÖubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX``int (*update)(struct key *key, const void *data, size_t datalen);`` If this type of key can be updated, then this method should be provided. It is called to update a key's payload from the blob of data provided. The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also. key_payload_reserve() should be called if the data length might change before any changes are actually made. Note that if this succeeds, the type is committed to changing the key because it's already been altered, so all memory allocation must be done first. The key will have its semaphore write-locked before this method is called, but this only deters other writers; any changes to the key's payload must be made under RCU conditions, and call_rcu() must be used to dispose of the old payload. key_payload_reserve() should be called before the changes are made, but after all allocations and other potentially failing function calls are made. It is safe to sleep in this method. ”h]”(hÌ)�”}”(hŒE``int (*update)(struct key *key, const void *data, size_t datalen);``”h]”jª)�”}”(hjQ h]”hŒAint (*update)(struct key *key, const void *data, size_t datalen);”…”�”}”(hjS h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjO ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÝhjK ubhÌ)�”}”(hŒ�If this type of key can be updated, then this method should be provided. It is called to update a key's payload from the blob of data provided.”h]”hŒ‘If this type of key can be updated, then this method should be provided. It is called to update a key’s payload from the blob of data provided.”…”�”}”(hjf h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MßhjK ubhÌ)�”}”(hŒ“The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also.”h]”hŒ“The prep->data and prep->datalen fields will define the original payload blob. If preparse() was supplied then other fields may be filled in also.”…”�”}”(hjt h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MâhjK ubhÌ)�”}”(hXkey_payload_reserve() should be called if the data length might change before any changes are actually made. Note that if this succeeds, the type is committed to changing the key because it's already been altered, so all memory allocation must be done first.”h]”hXkey_payload_reserve() should be called if the data length might change before any changes are actually made. Note that if this succeeds, the type is committed to changing the key because it’s already been altered, so all memory allocation must be done first.”…”�”}”(hj‚ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MåhjK ubhÌ)�”}”(hŒíThe key will have its semaphore write-locked before this method is called, but this only deters other writers; any changes to the key's payload must be made under RCU conditions, and call_rcu() must be used to dispose of the old payload.”h]”hŒïThe key will have its semaphore write-locked before this method is called, but this only deters other writers; any changes to the key’s payload must be made under RCU conditions, and call_rcu() must be used to dispose of the old payload.”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MêhjK ubhÌ)�”}”(hŒ”key_payload_reserve() should be called before the changes are made, but after all allocations and other potentially failing function calls are made.”h]”hŒ”key_payload_reserve() should be called before the changes are made, but after all allocations and other potentially failing function calls are made.”…”�”}”(hjž h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MïhjK ubhÌ)�”}”(hŒ#It is safe to sleep in this method.”h]”hŒ#It is safe to sleep in this method.”…”�”}”(hj¬ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MóhjK ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX&``int (*match_preparse)(struct key_match_data *match_data);`` This method is optional. It is called when a key search is about to be performed. It is given the following structure:: struct key_match_data { bool (*cmp)(const struct key *key, const struct key_match_data *match_data); const void *raw_data; void *preparsed; unsigned lookup_type; }; On entry, raw_data will be pointing to the criteria to be used in matching a key by the caller and should not be modified. ``(*cmp)()`` will be pointing to the default matcher function (which does an exact description match against raw_data) and lookup_type will be set to indicate a direct lookup. The following lookup_type values are available: * KEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys. * KEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that's not doing a simple direct match on the key description. The method may set cmp to point to a function of its choice that does some other form of match, may set lookup_type to KEYRING_SEARCH_LOOKUP_ITERATE and may attach something to the preparsed pointer for use by ``(*cmp)()``. ``(*cmp)()`` should return true if a key matches and false otherwise. If preparsed is set, it may be necessary to use the match_free() method to clean it up. The method should return 0 if successful or a negative error code otherwise. It is permitted to sleep in this method, but ``(*cmp)()`` may not sleep as locks will be held over it. If match_preparse() is not provided, keys of this type will be matched exactly by their description. ”h]”(hÌ)�”}”(hŒ=``int (*match_preparse)(struct key_match_data *match_data);``”h]”jª)�”}”(hjÆ h]”hŒ9int (*match_preparse)(struct key_match_data *match_data);”…”�”}”(hjÈ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjÄ ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MöhjÀ ubhÌ)�”}”(hŒyThis method is optional. It is called when a key search is about to be performed. It is given the following structure::”h]”hŒxThis method is optional. It is called when a key search is about to be performed. It is given the following structure:”…”�”}”(hjÛ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MøhjÀ ubjC )�”}”(hŒïstruct key_match_data { bool (*cmp)(const struct key *key, const struct key_match_data *match_data); const void *raw_data; void *preparsed; unsigned lookup_type; };”h]”hŒïstruct key_match_data { bool (*cmp)(const struct key *key, const struct key_match_data *match_data); const void *raw_data; void *preparsed; unsigned lookup_type; };”…”�”}”hjé sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MûhjÀ ubhÌ)�”}”(hX+On entry, raw_data will be pointing to the criteria to be used in matching a key by the caller and should not be modified. ``(*cmp)()`` will be pointing to the default matcher function (which does an exact description match against raw_data) and lookup_type will be set to indicate a direct lookup.”h]”(hŒ|On entry, raw_data will be pointing to the criteria to be used in matching a key by the caller and should not be modified. ”…”�”}”(hj÷ h²hh³Nh´Nubjª)�”}”(hŒ ``(*cmp)()``”h]”hŒ(*cmp)()”…”�”}”(hjÿ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj÷ ubhŒ£ will be pointing to the default matcher function (which does an exact description match against raw_data) and lookup_type will be set to indicate a direct lookup.”…”�”}”(hj÷ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhÌ)�”}”(hŒ/The following lookup_type values are available:”h]”hŒ/The following lookup_type values are available:”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhø)�”}”(hXa* KEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys. * KEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that's not doing a simple direct match on the key description. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒ„KEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys. ”h]”hÌ)�”}”(hŒƒKEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys.”h]”hŒƒKEYRING_SEARCH_LOOKUP_DIRECT - A direct lookup hashes the type and description to narrow down the search to a small number of keys.”…”�”}”(hj0!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj,!ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj)!ubj*)�”}”(hŒÍKEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that's not doing a simple direct match on the key description. ”h]”hÌ)�”}”(hŒÌKEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that's not doing a simple direct match on the key description.”h]”hŒÎKEYRING_SEARCH_LOOKUP_ITERATE - An iterative lookup walks all the keys in the keyring until one is matched. This must be used for any search that’s not doing a simple direct match on the key description.”…”�”}”(hjH!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hjD!ubah}”(h]”h ]”h"]”h$]”h&]”uh1j)hj)!ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M hj%!ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M hjÀ ubhÌ)�”}”(hX%The method may set cmp to point to a function of its choice that does some other form of match, may set lookup_type to KEYRING_SEARCH_LOOKUP_ITERATE and may attach something to the preparsed pointer for use by ``(*cmp)()``. ``(*cmp)()`` should return true if a key matches and false otherwise.”h]”(hŒÒThe method may set cmp to point to a function of its choice that does some other form of match, may set lookup_type to KEYRING_SEARCH_LOOKUP_ITERATE and may attach something to the preparsed pointer for use by ”…”�”}”(hjh!h²hh³Nh´Nubjª)�”}”(hŒ ``(*cmp)()``”h]”hŒ(*cmp)()”…”�”}”(hjp!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjh!ubhŒ. ”…”�”}”(hjh!h²hh³Nh´Nubjª)�”}”(hŒ ``(*cmp)()``”h]”hŒ(*cmp)()”…”�”}”(hj‚!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjh!ubhŒ9 should return true if a key matches and false otherwise.”…”�”}”(hjh!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhÌ)�”}”(hŒWIf preparsed is set, it may be necessary to use the match_free() method to clean it up.”h]”hŒWIf preparsed is set, it may be necessary to use the match_free() method to clean it up.”…”�”}”(hjš!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhÌ)�”}”(hŒLThe method should return 0 if successful or a negative error code otherwise.”h]”hŒLThe method should return 0 if successful or a negative error code otherwise.”…”�”}”(hj¨!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhÌ)�”}”(hŒfIt is permitted to sleep in this method, but ``(*cmp)()`` may not sleep as locks will be held over it.”h]”(hŒ-It is permitted to sleep in this method, but ”…”�”}”(hj¶!h²hh³Nh´Nubjª)�”}”(hŒ ``(*cmp)()``”h]”hŒ(*cmp)()”…”�”}”(hj¾!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj¶!ubhŒ- may not sleep as locks will be held over it.”…”�”}”(hj¶!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubhÌ)�”}”(hŒdIf match_preparse() is not provided, keys of this type will be matched exactly by their description.”h]”hŒdIf match_preparse() is not provided, keys of this type will be matched exactly by their description.”…”�”}”(hjÖ!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÀ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hŒº``void (*match_free)(struct key_match_data *match_data);`` This method is optional. If given, it called to clean up match_data->preparsed after a successful call to match_preparse(). ”h]”(hÌ)�”}”(hŒ:``void (*match_free)(struct key_match_data *match_data);``”h]”jª)�”}”(hjð!h]”hŒ6void (*match_free)(struct key_match_data *match_data);”…”�”}”(hjò!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjî!ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M#hjê!ubhÌ)�”}”(hŒ|This method is optional. If given, it called to clean up match_data->preparsed after a successful call to match_preparse().”h]”hŒ|This method is optional. If given, it called to clean up match_data->preparsed after a successful call to match_preparse().”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M%hjê!ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX2``void (*revoke)(struct key *key);`` This method is optional. It is called to discard part of the payload data upon a key being revoked. The caller will have the key semaphore write-locked. It is safe to sleep in this method, though care should be taken to avoid a deadlock against the key semaphore. ”h]”(hÌ)�”}”(hŒ$``void (*revoke)(struct key *key);``”h]”jª)�”}”(hj"h]”hŒ void (*revoke)(struct key *key);”…”�”}”(hj!"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj"ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M)hj"ubhÌ)�”}”(hŒšThis method is optional. It is called to discard part of the payload data upon a key being revoked. The caller will have the key semaphore write-locked.”h]”hŒšThis method is optional. It is called to discard part of the payload data upon a key being revoked. The caller will have the key semaphore write-locked.”…”�”}”(hj4"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M+hj"ubhÌ)�”}”(hŒnIt is safe to sleep in this method, though care should be taken to avoid a deadlock against the key semaphore.”h]”hŒnIt is safe to sleep in this method, though care should be taken to avoid a deadlock against the key semaphore.”…”�”}”(hjB"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M/hj"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX¤``void (*destroy)(struct key *key);`` This method is optional. It is called to discard the payload data on a key when it is being destroyed. This method does not need to lock the key to access the payload; it can consider the key as being inaccessible at this time. Note that the key's type may have been changed before this function is called. It is not safe to sleep in this method; the caller may hold spinlocks. ”h]”(hÌ)�”}”(hŒ%``void (*destroy)(struct key *key);``”h]”jª)�”}”(hj\"h]”hŒ!void (*destroy)(struct key *key);”…”�”}”(hj^"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjZ"ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M3hjV"ubhÌ)�”}”(hŒfThis method is optional. It is called to discard the payload data on a key when it is being destroyed.”h]”hŒfThis method is optional. It is called to discard the payload data on a key when it is being destroyed.”…”�”}”(hjq"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M5hjV"ubhÌ)�”}”(hŒËThis method does not need to lock the key to access the payload; it can consider the key as being inaccessible at this time. Note that the key's type may have been changed before this function is called.”h]”hŒÍThis method does not need to lock the key to access the payload; it can consider the key as being inaccessible at this time. Note that the key’s type may have been changed before this function is called.”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hjV"ubhÌ)�”}”(hŒFIt is not safe to sleep in this method; the caller may hold spinlocks.”h]”hŒFIt is not safe to sleep in this method; the caller may hold spinlocks.”…”�”}”(hj�"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M<hjV"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX:``void (*describe)(const struct key *key, struct seq_file *p);`` This method is optional. It is called during /proc/keys reading to summarise a key's description and payload in text form. This method will be called with the RCU read lock held. rcu_dereference() should be used to read the payload pointer if the payload is to be accessed. key->datalen cannot be trusted to stay consistent with the contents of the payload. The description will not change, though the key's state may. It is not safe to sleep in this method; the RCU read lock is held by the caller. ”h]”(hÌ)�”}”(hŒ@``void (*describe)(const struct key *key, struct seq_file *p);``”h]”jª)�”}”(hj§"h]”hŒdatalen cannot be trusted to stay consistent with the contents of the payload.”h]”hŒêThis method will be called with the RCU read lock held. rcu_dereference() should be used to read the payload pointer if the payload is to be accessed. key->datalen cannot be trusted to stay consistent with the contents of the payload.”…”�”}”(hjÊ"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MDhj¡"ubhÌ)�”}”(hŒThe description will not change, though the key’s state may.”…”�”}”(hjØ"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MIhj¡"ubhÌ)�”}”(hŒPIt is not safe to sleep in this method; the RCU read lock is held by the caller.”h]”hŒPIt is not safe to sleep in this method; the RCU read lock is held by the caller.”…”�”}”(hjæ"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MKhj¡"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hXÃ``long (*read)(const struct key *key, char __user *buffer, size_t buflen);`` This method is optional. It is called by KEYCTL_READ to translate the key's payload into something a blob of data for userspace to deal with. Ideally, the blob should be in the same format as that passed in to the instantiate and update methods. If successful, the blob size that could be produced should be returned rather than the size copied. This method will be called with the key's semaphore read-locked. This will prevent the key's payload changing. It is not necessary to use RCU locking when accessing the key's payload. It is safe to sleep in this method, such as might happen when the userspace buffer is accessed. ”h]”(hÌ)�”}”(hŒL``long (*read)(const struct key *key, char __user *buffer, size_t buflen);``”h]”jª)�”}”(hj#h]”hŒHlong (*read)(const struct key *key, char __user *buffer, size_t buflen);”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjþ"ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MOhjú"ubhÌ)�”}”(hŒõThis method is optional. It is called by KEYCTL_READ to translate the key's payload into something a blob of data for userspace to deal with. Ideally, the blob should be in the same format as that passed in to the instantiate and update methods.”h]”hŒ÷This method is optional. It is called by KEYCTL_READ to translate the key’s payload into something a blob of data for userspace to deal with. Ideally, the blob should be in the same format as that passed in to the instantiate and update methods.”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MQhjú"ubhÌ)�”}”(hŒcIf successful, the blob size that could be produced should be returned rather than the size copied.”h]”hŒcIf successful, the blob size that could be produced should be returned rather than the size copied.”…”�”}”(hj##h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MVhjú"ubhÌ)�”}”(hXThis method will be called with the key's semaphore read-locked. This will prevent the key's payload changing. It is not necessary to use RCU locking when accessing the key's payload. It is safe to sleep in this method, such as might happen when the userspace buffer is accessed.”h]”hXThis method will be called with the key’s semaphore read-locked. This will prevent the key’s payload changing. It is not necessary to use RCU locking when accessing the key’s payload. It is safe to sleep in this method, such as might happen when the userspace buffer is accessed.”…”�”}”(hj1#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MYhjú"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX«``int (*request_key)(struct key_construction *cons, const char *op, void *aux);`` This method is optional. If provided, request_key() and friends will invoke this function rather than upcalling to /sbin/request-key to operate upon a key of this type. The aux parameter is as passed to request_key_async_with_auxdata() and similar or is NULL otherwise. Also passed are the construction record for the key to be operated upon and the operation type (currently only "create"). This method is permitted to return before the upcall is complete, but the following function must be called under all circumstances to complete the instantiation process, whether or not it succeeds, whether or not there's an error:: void complete_request_key(struct key_construction *cons, int error); The error parameter should be 0 on success, -ve on error. The construction record is destroyed by this action and the authorisation key will be revoked. If an error is indicated, the key under construction will be negatively instantiated if it wasn't already instantiated. If this method returns an error, that error will be returned to the caller of request_key*(). complete_request_key() must be called prior to returning. The key under construction and the authorisation key can be found in the key_construction struct pointed to by cons: * ``struct key *key;`` The key under construction. * ``struct key *authkey;`` The authorisation key. ”h]”(hÌ)�”}”(hŒQ``int (*request_key)(struct key_construction *cons, const char *op, void *aux);``”h]”jª)�”}”(hjK#h]”hŒMint (*request_key)(struct key_construction *cons, const char *op, void *aux);”…”�”}”(hjM#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjI#ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M_hjE#ubhÌ)�”}”(hŒ©This method is optional. If provided, request_key() and friends will invoke this function rather than upcalling to /sbin/request-key to operate upon a key of this type.”h]”hŒ©This method is optional. If provided, request_key() and friends will invoke this function rather than upcalling to /sbin/request-key to operate upon a key of this type.”…”�”}”(hj`#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MahjE#ubhÌ)�”}”(hŒßThe aux parameter is as passed to request_key_async_with_auxdata() and similar or is NULL otherwise. Also passed are the construction record for the key to be operated upon and the operation type (currently only "create").”h]”hŒãThe aux parameter is as passed to request_key_async_with_auxdata() and similar or is NULL otherwise. Also passed are the construction record for the key to be operated upon and the operation type (currently only “createâ€�).”…”�”}”(hjn#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MehjE#ubhÌ)�”}”(hŒèThis method is permitted to return before the upcall is complete, but the following function must be called under all circumstances to complete the instantiation process, whether or not it succeeds, whether or not there's an error::”h]”hŒéThis method is permitted to return before the upcall is complete, but the following function must be called under all circumstances to complete the instantiation process, whether or not it succeeds, whether or not there’s an error:”…”�”}”(hj|#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MjhjE#ubjC )�”}”(hŒDvoid complete_request_key(struct key_construction *cons, int error);”h]”hŒDvoid complete_request_key(struct key_construction *cons, int error);”…”�”}”hjŠ#sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MohjE#ubhÌ)�”}”(hXThe error parameter should be 0 on success, -ve on error. The construction record is destroyed by this action and the authorisation key will be revoked. If an error is indicated, the key under construction will be negatively instantiated if it wasn't already instantiated.”h]”hXThe error parameter should be 0 on success, -ve on error. The construction record is destroyed by this action and the authorisation key will be revoked. If an error is indicated, the key under construction will be negatively instantiated if it wasn’t already instantiated.”…”�”}”(hj˜#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MqhjE#ubhÌ)�”}”(hŒ˜If this method returns an error, that error will be returned to the caller of request_key*(). complete_request_key() must be called prior to returning.”h]”hŒ˜If this method returns an error, that error will be returned to the caller of request_key*(). complete_request_key() must be called prior to returning.”…”�”}”(hj¦#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MvhjE#ubhÌ)�”}”(hŒtThe key under construction and the authorisation key can be found in the key_construction struct pointed to by cons:”h]”hŒtThe key under construction and the authorisation key can be found in the key_construction struct pointed to by cons:”…”�”}”(hj´#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MzhjE#ubhø)�”}”(hŒq* ``struct key *key;`` The key under construction. * ``struct key *authkey;`` The authorisation key. ”h]”j%)�”}”(hhh]”(j*)�”}”(hŒ2``struct key *key;`` The key under construction. ”h]”(hÌ)�”}”(hŒ``struct key *key;``”h]”jª)�”}”(hjÏ#h]”hŒstruct key *key;”…”�”}”(hjÑ#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjÍ#ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M}hjÉ#ubhÌ)�”}”(hŒThe key under construction.”h]”hŒThe key under construction.”…”�”}”(hjä#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjÉ#ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjÆ#ubj*)�”}”(hŒ2``struct key *authkey;`` The authorisation key. ”h]”(hÌ)�”}”(hŒ``struct key *authkey;``”h]”jª)�”}”(hjþ#h]”hŒstruct key *authkey;”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjü#ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hjø#ubhÌ)�”}”(hŒThe authorisation key.”h]”hŒThe authorisation key.”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mƒhjø#ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjÆ#ubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M}hjÂ#ubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M}hjE#ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX¸``struct key_restriction *(*lookup_restriction)(const char *params);`` This optional method is used to enable userspace configuration of keyring restrictions. The restriction parameter string (not including the key type name) is passed in, and this method returns a pointer to a key_restriction structure containing the relevant functions and data to evaluate each attempted key link operation. If there is no match, -EINVAL is returned. ”h]”(hÌ)�”}”(hŒF``struct key_restriction *(*lookup_restriction)(const char *params);``”h]”jª)�”}”(hj?$h]”hŒBstruct key_restriction *(*lookup_restriction)(const char *params);”…”�”}”(hjA$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hj=$ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M†hj9$ubhÌ)�”}”(hXnThis optional method is used to enable userspace configuration of keyring restrictions. The restriction parameter string (not including the key type name) is passed in, and this method returns a pointer to a key_restriction structure containing the relevant functions and data to evaluate each attempted key link operation. If there is no match, -EINVAL is returned.”h]”hXnThis optional method is used to enable userspace configuration of keyring restrictions. The restriction parameter string (not including the key type name) is passed in, and this method returns a pointer to a key_restriction structure containing the relevant functions and data to evaluate each attempted key link operation. If there is no match, -EINVAL is returned.”…”�”}”(hjT$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mˆhj9$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hX ``asym_eds_op`` and ``asym_verify_signature``:: int (*asym_eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*asym_verify_signature)(struct kernel_pkey_params *params, const void *in, const void *in2); These methods are optional. If provided the first allows a key to be used to encrypt, decrypt or sign a blob of data, and the second allows a key to verify a signature. In all cases, the following information is provided in the params block:: struct kernel_pkey_params { struct key *key; const char *encoding; const char *hash_algo; char *info; __u32 in_len; union { __u32 out_len; __u32 in2_len; }; enum kernel_pkey_operation op : 8; }; This includes the key to be used; a string indicating the encoding to use (for instance, "pkcs1" may be used with an RSA key to indicate RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5 encoding or "raw" if no encoding); the name of the hash algorithm used to generate the data for a signature (if appropriate); the sizes of the input and output (or second input) buffers; and the ID of the operation to be performed. For a given operation ID, the input and output buffers are used as follows:: Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== kernel_pkey_encrypt Raw data Encrypted data - kernel_pkey_decrypt Encrypted data Raw data - kernel_pkey_sign Raw data Signature - kernel_pkey_verify Raw data - Signature asym_eds_op() deals with encryption, decryption and signature creation as specified by params->op. Note that params->op is also set for asym_verify_signature(). Encrypting and signature creation both take raw data in the input buffer and return the encrypted result in the output buffer. Padding may have been added if an encoding was set. In the case of signature creation, depending on the encoding, the padding created may need to indicate the digest algorithm - the name of which should be supplied in hash_algo. Decryption takes encrypted data in the input buffer and returns the raw data in the output buffer. Padding will get checked and stripped off if an encoding was set. Verification takes raw data in the input buffer and the signature in the second input buffer and checks that the one matches the other. Padding will be validated. Depending on the encoding, the digest algorithm used to generate the raw data may need to be indicated in hash_algo. If successful, asym_eds_op() should return the number of bytes written into the output buffer. asym_verify_signature() should return 0. A variety of errors may be returned, including EOPNOTSUPP if the operation is not supported; EKEYREJECTED if verification fails; ENOPKG if the required crypto isn't available. ”h]”(hÌ)�”}”(hŒ/``asym_eds_op`` and ``asym_verify_signature``::”h]”(jª)�”}”(hŒ``asym_eds_op``”h]”hŒ asym_eds_op”…”�”}”(hjp$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjl$ubhŒ and ”…”�”}”(hjl$h²hh³Nh´Nubjª)�”}”(hŒ``asym_verify_signature``”h]”hŒasym_verify_signature”…”�”}”(hj‚$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjl$ubhŒ:”…”�”}”(hjl$h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hjh$ubjC )�”}”(hŒãint (*asym_eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*asym_verify_signature)(struct kernel_pkey_params *params, const void *in, const void *in2);”h]”hŒãint (*asym_eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*asym_verify_signature)(struct kernel_pkey_params *params, const void *in, const void *in2);”…”�”}”hjš$sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M‘hjh$ubhÌ)�”}”(hŒ©These methods are optional. If provided the first allows a key to be used to encrypt, decrypt or sign a blob of data, and the second allows a key to verify a signature.”h]”hŒ©These methods are optional. If provided the first allows a key to be used to encrypt, decrypt or sign a blob of data, and the second allows a key to verify a signature.”…”�”}”(hj¨$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M–hjh$ubhÌ)�”}”(hŒIIn all cases, the following information is provided in the params block::”h]”hŒHIn all cases, the following information is provided in the params block:”…”�”}”(hj¶$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mšhjh$ubjC )�”}”(hXJstruct kernel_pkey_params { struct key *key; const char *encoding; const char *hash_algo; char *info; __u32 in_len; union { __u32 out_len; __u32 in2_len; }; enum kernel_pkey_operation op : 8; };”h]”hXJstruct kernel_pkey_params { struct key *key; const char *encoding; const char *hash_algo; char *info; __u32 in_len; union { __u32 out_len; __u32 in2_len; }; enum kernel_pkey_operation op : 8; };”…”�”}”hjÄ$sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´Mœhjh$ubhÌ)�”}”(hX–This includes the key to be used; a string indicating the encoding to use (for instance, "pkcs1" may be used with an RSA key to indicate RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5 encoding or "raw" if no encoding); the name of the hash algorithm used to generate the data for a signature (if appropriate); the sizes of the input and output (or second input) buffers; and the ID of the operation to be performed.”h]”hXžThis includes the key to be used; a string indicating the encoding to use (for instance, “pkcs1â€� may be used with an RSA key to indicate RSASSA-PKCS1-v1.5 or RSAES-PKCS1-v1.5 encoding or “rawâ€� if no encoding); the name of the hash algorithm used to generate the data for a signature (if appropriate); the sizes of the input and output (or second input) buffers; and the ID of the operation to be performed.”…”�”}”(hjÒ$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M©hjh$ubhÌ)�”}”(hŒLFor a given operation ID, the input and output buffers are used as follows::”h]”hŒKFor a given operation ID, the input and output buffers are used as follows:”…”�”}”(hjà$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M°hjh$ubjC )�”}”(hX{Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== kernel_pkey_encrypt Raw data Encrypted data - kernel_pkey_decrypt Encrypted data Raw data - kernel_pkey_sign Raw data Signature - kernel_pkey_verify Raw data - Signature”h]”hX{Operation ID in,in_len out,out_len in2,in2_len ======================= =============== =============== =============== kernel_pkey_encrypt Raw data Encrypted data - kernel_pkey_decrypt Encrypted data Raw data - kernel_pkey_sign Raw data Signature - kernel_pkey_verify Raw data - Signature”…”�”}”hjî$sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M³hjh$ubhÌ)�”}”(hŒ¡asym_eds_op() deals with encryption, decryption and signature creation as specified by params->op. Note that params->op is also set for asym_verify_signature().”h]”hŒ¡asym_eds_op() deals with encryption, decryption and signature creation as specified by params->op. Note that params->op is also set for asym_verify_signature().”…”�”}”(hjü$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mºhjh$ubhÌ)�”}”(hXeEncrypting and signature creation both take raw data in the input buffer and return the encrypted result in the output buffer. Padding may have been added if an encoding was set. In the case of signature creation, depending on the encoding, the padding created may need to indicate the digest algorithm - the name of which should be supplied in hash_algo.”h]”hXeEncrypting and signature creation both take raw data in the input buffer and return the encrypted result in the output buffer. Padding may have been added if an encoding was set. In the case of signature creation, depending on the encoding, the padding created may need to indicate the digest algorithm - the name of which should be supplied in hash_algo.”…”�”}”(hj %h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¾hjh$ubhÌ)�”}”(hŒ¥Decryption takes encrypted data in the input buffer and returns the raw data in the output buffer. Padding will get checked and stripped off if an encoding was set.”h]”hŒ¥Decryption takes encrypted data in the input buffer and returns the raw data in the output buffer. Padding will get checked and stripped off if an encoding was set.”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÄhjh$ubhÌ)�”}”(hXVerification takes raw data in the input buffer and the signature in the second input buffer and checks that the one matches the other. Padding will be validated. Depending on the encoding, the digest algorithm used to generate the raw data may need to be indicated in hash_algo.”h]”hXVerification takes raw data in the input buffer and the signature in the second input buffer and checks that the one matches the other. Padding will be validated. Depending on the encoding, the digest algorithm used to generate the raw data may need to be indicated in hash_algo.”…”�”}”(hj&%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÈhjh$ubhÌ)�”}”(hŒˆIf successful, asym_eds_op() should return the number of bytes written into the output buffer. asym_verify_signature() should return 0.”h]”hŒˆIf successful, asym_eds_op() should return the number of bytes written into the output buffer. asym_verify_signature() should return 0.”…”�”}”(hj4%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÍhjh$ubhÌ)�”}”(hŒ¯A variety of errors may be returned, including EOPNOTSUPP if the operation is not supported; EKEYREJECTED if verification fails; ENOPKG if the required crypto isn't available.”h]”hŒ±A variety of errors may be returned, including EOPNOTSUPP if the operation is not supported; EKEYREJECTED if verification fails; ENOPKG if the required crypto isn’t available.”…”�”}”(hjB%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÐhjh$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubj*)�”}”(hXù``asym_query``:: int (*asym_query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info); This method is optional. If provided it allows information about the public or asymmetric key held in the key to be determined. The parameter block is as for asym_eds_op() and co. but in_len and out_len are unused. The encoding and hash_algo fields should be used to reduce the returned buffer/data sizes as appropriate. If successful, the following information is filled in:: struct kernel_pkey_query { __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; }; The supported_ops field will contain a bitmask indicating what operations are supported by the key, including encryption of a blob, decryption of a blob, signing a blob and verifying the signature on a blob. The following constants are defined for this:: KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY} The key_size field is the size of the key in bits. max_data_size and max_sig_size are the maximum raw data and signature sizes for creation and verification of a signature; max_enc_size and max_dec_size are the maximum raw data and signature sizes for encryption and decryption. The max_*_size fields are measured in bytes. If successful, 0 will be returned. If the key doesn't support this, EOPNOTSUPP will be returned. ”h]”(hÌ)�”}”(hŒ``asym_query``::”h]”(jª)�”}”(hŒ``asym_query``”h]”hŒ asym_query”…”�”}”(hj^%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j©hjZ%ubhŒ:”…”�”}”(hjZ%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÕhjV%ubjC )�”}”(hŒmint (*asym_query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info);”h]”hŒmint (*asym_query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info);”…”�”}”hjv%sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M×hjV%ubhÌ)�”}”(hŒ€This method is optional. If provided it allows information about the public or asymmetric key held in the key to be determined.”h]”hŒ€This method is optional. If provided it allows information about the public or asymmetric key held in the key to be determined.”…”�”}”(hj„%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÚhjV%ubhÌ)�”}”(hŒÁThe parameter block is as for asym_eds_op() and co. but in_len and out_len are unused. The encoding and hash_algo fields should be used to reduce the returned buffer/data sizes as appropriate.”h]”hŒÁThe parameter block is as for asym_eds_op() and co. but in_len and out_len are unused. The encoding and hash_algo fields should be used to reduce the returned buffer/data sizes as appropriate.”…”�”}”(hj’%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÝhjV%ubhÌ)�”}”(hŒ7If successful, the following information is filled in::”h]”hŒ6If successful, the following information is filled in:”…”�”}”(hj %h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MáhjV%ubjC )�”}”(hŒÿstruct kernel_pkey_query { __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; };”h]”hŒÿstruct kernel_pkey_query { __u32 supported_ops; __u32 key_size; __u16 max_data_size; __u16 max_sig_size; __u16 max_enc_size; __u16 max_dec_size; };”…”�”}”hj®%sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MãhjV%ubhÌ)�”}”(hŒÿThe supported_ops field will contain a bitmask indicating what operations are supported by the key, including encryption of a blob, decryption of a blob, signing a blob and verifying the signature on a blob. The following constants are defined for this::”h]”hŒþThe supported_ops field will contain a bitmask indicating what operations are supported by the key, including encryption of a blob, decryption of a blob, signing a blob and verifying the signature on a blob. The following constants are defined for this:”…”�”}”(hj¼%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MìhjV%ubjC )�”}”(hŒ-KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY}”h]”hŒ-KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY}”…”�”}”hjÊ%sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´MñhjV%ubhÌ)�”}”(hXEThe key_size field is the size of the key in bits. max_data_size and max_sig_size are the maximum raw data and signature sizes for creation and verification of a signature; max_enc_size and max_dec_size are the maximum raw data and signature sizes for encryption and decryption. The max_*_size fields are measured in bytes.”h]”hXEThe key_size field is the size of the key in bits. max_data_size and max_sig_size are the maximum raw data and signature sizes for creation and verification of a signature; max_enc_size and max_dec_size are the maximum raw data and signature sizes for encryption and decryption. The max_*_size fields are measured in bytes.”…”�”}”(hjØ%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MóhjV%ubhÌ)�”}”(hŒaIf successful, 0 will be returned. If the key doesn't support this, EOPNOTSUPP will be returned.”h]”hŒcIf successful, 0 will be returned. If the key doesn’t support this, EOPNOTSUPP will be returned.”…”�”}”(hjæ%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MùhjV%ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j)hjxubeh}”(h]”h ]”h"]”h$]”h&]”j”j2uh1j$h³hÊh´M€hjtubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M€hj+h²hubeh}”(h]”jRah ]”h"]”Œdefining a key type”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mtubh¶)�”}”(hhh]”(h»)�”}”(hŒRequest-Key Callback Service”h]”hŒRequest-Key Callback Service”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄjnuh1hºhj &h²hh³hÊh´MþubhÌ)�”}”(hŒTTo create a new key, the kernel will attempt to execute the following command line::”h]”hŒSTo create a new key, the kernel will attempt to execute the following command line:”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubjC )�”}”(hŒl/sbin/request-key create \ ”h]”hŒl/sbin/request-key create \ ”…”�”}”hj,&sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´Mhj &h²hubhÌ)�”}”(hŒ­ is the key being constructed, and the three keyrings are the process keyrings from the process that caused the search to be issued. These are included for two reasons:”h]”hŒ­ is the key being constructed, and the three keyrings are the process keyrings from the process that caused the search to be issued. These are included for two reasons:”…”�”}”(hj:&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubhø)�”}”(hŒÎ1 There may be an authentication token in one of the keyrings that is required to obtain the key, eg: a Kerberos Ticket-Granting Ticket. 2 The new key should probably be cached in one of these rings. ”h]”(jf)�”}”(hhh]”jk)�”}”(hŒŠ1 There may be an authentication token in one of the keyrings that is required to obtain the key, eg: a Kerberos Ticket-Granting Ticket. ”h]”(jq)�”}”(hŒF1 There may be an authentication token in one of the keyrings that is”h]”hŒF1 There may be an authentication token in one of the keyrings that is”…”�”}”(hjS&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jph³hÊh´M hjO&ubj�)�”}”(hhh]”hÌ)�”}”(hŒBrequired to obtain the key, eg: a Kerberos Ticket-Granting Ticket.”h]”hŒBrequired to obtain the key, eg: a Kerberos Ticket-Granting Ticket.”…”�”}”(hjd&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hja&ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŽhjO&ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jjh³hÊh´M hjL&ubah}”(h]”h ]”h"]”h$]”h&]”uh1jehjH&ubhÌ)�”}”(hŒ?2 The new key should probably be cached in one of these rings.”h]”hŒ?2 The new key should probably be cached in one of these rings.”…”�”}”(hj„&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hjH&ubeh}”(h]”h ]”h"]”h$]”h&]”uh1h÷h³hÊh´M hj &h²hubhÌ)�”}”(hX This program should set it UID and GID to those specified before attempting to access any more keys. It may then look around for a user specific process to hand the request off to (perhaps a path held in placed in another key by, for example, the KDE desktop manager).”h]”hX This program should set it UID and GID to those specified before attempting to access any more keys. It may then look around for a user specific process to hand the request off to (perhaps a path held in placed in another key by, for example, the KDE desktop manager).”…”�”}”(hj˜&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubhÌ)�”}”(hXƒThe program (or whatever it calls) should finish construction of the key by calling KEYCTL_INSTANTIATE or KEYCTL_INSTANTIATE_IOV, which also permits it to cache the key in one of the keyrings (probably the session ring) before returning. Alternatively, the key can be marked as negative with KEYCTL_NEGATE or KEYCTL_REJECT; this also permits the key to be cached in one of the keyrings.”h]”hXƒThe program (or whatever it calls) should finish construction of the key by calling KEYCTL_INSTANTIATE or KEYCTL_INSTANTIATE_IOV, which also permits it to cache the key in one of the keyrings (probably the session ring) before returning. Alternatively, the key can be marked as negative with KEYCTL_NEGATE or KEYCTL_REJECT; this also permits the key to be cached in one of the keyrings.”…”�”}”(hj¦&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubhÌ)�”}”(hŒÇIf it returns with the key remaining in the unconstructed state, the key will be marked as being negative, it will be added to the session keyring, and an error will be returned to the key requestor.”h]”hŒÇIf it returns with the key remaining in the unconstructed state, the key will be marked as being negative, it will be added to the session keyring, and an error will be returned to the key requestor.”…”�”}”(hj´&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubhÌ)�”}”(hŒëSupplementary information may be provided from whoever or whatever invoked this service. This will be passed as the parameter. If no such information was made available, then "-" will be passed as this parameter instead.”h]”hŒïSupplementary information may be provided from whoever or whatever invoked this service. This will be passed as the parameter. If no such information was made available, then “-â€� will be passed as this parameter instead.”…”�”}”(hjÂ&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj &h²hubhÌ)�”}”(hŒ]Similarly, the kernel may attempt to update an expired or a soon to expire key by executing::”h]”hŒ\Similarly, the kernel may attempt to update an expired or a soon to expire key by executing:”…”�”}”(hjÐ&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M%hj &h²hubjC )�”}”(hŒ]/sbin/request-key update \ ”h]”hŒ]/sbin/request-key update \ ”…”�”}”hjÞ&sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M(hj &h²hubhÌ)�”}”(hŒtIn this case, the program isn't required to actually attach the key to a ring; the rings are provided for reference.”h]”hŒvIn this case, the program isn’t required to actually attach the key to a ring; the rings are provided for reference.”…”�”}”(hjì&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M+hj &h²hubeh}”(h]”jtah ]”h"]”Œrequest-key callback service”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mþubh¶)�”}”(hhh]”(h»)�”}”(hŒGarbage Collection”h]”hŒGarbage Collection”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jÄj�uh1hºhj'h²hh³hÊh´M0ubhÌ)�”}”(hŒ¸Dead keys (for which the type has been removed) will be automatically unlinked from those keyrings that point to them and deleted as soon as possible by a background garbage collector.”•} h]”hŒ¸Dead keys (for which the type has been removed) will be automatically unlinked from those keyrings that point to them and deleted as soon as possible by a background garbage collector.”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M2hj'h²hubhÌ)�”}”(hŒ Similarly, revoked and expired keys will be garbage collected, but only after a certain amount of time has passed. This time is set as a number of seconds in::”h]”hŒŸSimilarly, revoked and expired keys will be garbage collected, but only after a certain amount of time has passed. This time is set as a number of seconds in:”…”�”}”(hj 'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M6hj'h²hubjC )�”}”(hŒ/proc/sys/kernel/keys/gc_delay”h]”hŒ/proc/sys/kernel/keys/gc_delay”…”�”}”hj.'sbah}”(h]”h ]”h"]”h$]”h&]”jR jS uh1jB h³hÊh´M9hj'h²hubeh}”(h]”j–ah ]”h"]”Œgarbage collection”ah$]”h&]”uh1hµhh·h²hh³hÊh´M0ubeh}”(h]”Œkernel-key-retention-service”ah ]”h"]”Œkernel key retention service”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jn'Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jH'jE'j°j«j]jBjTjdjj†jÝj¨jQ jÊj.jìjŠjj(j0j &jRjþ&jtj@'j–uŒ nametypes”}”(jH'‰j°‰j]‰jT‰j‰j݉jQ ‰j.‰jЉj(‰j &‰jþ&‰j@'‰uh}”(jE'h·j«j!jBj³jdj`j†jWj¨j‚jÊjàjìjT jj1j0j�jRj+jtj &j–j'j<j3j^jUj€jwj¢j™jÄj»jæjÝjjÿj*j!jLjCjnjej�j‡uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j|'K s…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.