KCAPI_HANDLE_REINIT(3)
β¨ kcapi_handle_reinit(3) β¨
okay bestie, gather round π this one lives in the Programming Interface section of the manual (yes that's the manual name, it's giving very official), and it's literally the "make me a twin handle" function. no cap. π¦
πΈ NAME πΈ
kcapi_handle_reinit β re-initialize a new kernel interface π
π SYNOPSIS π
int kcapi_handle_reinit(struct kcapi_handle ** newhandle,
struct kcapi_handle * existing, uint32_t flags);
π ARGUMENTS π
newhandleβ [out] the cipher handle that gets filled in during the call, i.e. where your shiny new baby handle lands πΌexistingβ [in] the existing cipher handle you're re-initializing a new handle from. it's the source, the blueprint, the moment πflagsβ [in] flags that specify the type of cipher handle π©
π DESCRIPTION π
so. the kernel crypto API interface runs on two types of file descriptors, and you gotta know both or you're lost:
- the TFM file descriptor β this is the one holding the cipher-operation static info: the key, and the AEAD tag size π
- the OP file descriptor β this is the one holding the volatile data, like the plaintext / ciphertext, the IV, or the AEAD AD size π
the kernel crypto API AF_ALG interface supports this whole concept where one TFM file descriptor can operate with multiple OP file descriptors. and like, not just "multiple", the different OP file descriptors can perform completely separate cipher operations using the same key, and those can execute in parallel π₯. that parallel execution can happen in the same process threads or in different process threads β dealer's choice, bestie.
so what does kcapi_handle_reinit do? it allows the allocation of a new cipher handle with a new OP file descriptor but using the same TFM file descriptor. to get a reference to that TFM file descriptor, an existing cipher handle is used as the source. β¨
and the way that you can invoke kcapi_handle_reinit multiple times?? iconic. each resulting cipher handle must be deallocated with kcapi_cipher_destroy. and the deallocation is smart β it ensures that the TFM resource is only released if the last handle using this TFM resource is released. reference counting, but make it cute π«Ά
π¨ not me reminding you: every single handle you spawn from this needs its own kcapi_cipher_destroy. no leaving them orphaned, that's not the vibe.
and the return situation:
0upon success π-EINVALβ accept syscall failed π-ENOMEMβ cipher handle cannot be allocated π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. π«‘ absolute legend, we thank them for their service.
π COPYRIGHT π
that's the whole page, bestie! this was brought to you by the libkcapi Manual 1.5.0, dated July 2025, and you can find it filed under KCAPI_HANDLE_REINIT(3) πβ¨ go forth and reinit responsibly, mwah π
π¦ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms