KCAPI_CIPHER_INIT(3)

✨ KCAPI_CIPHER_INIT ✨

okay so bestie, welcome to kcapi_cipher_init from the libkcapi crew β€” this is the one that initializes a cipher handle for you πŸ’– it's a libkcapi manual page (section 3, programming interface energy) and we're gonna get you fluent in it, no cap.


🌸 SYNOPSIS 🌸

int kcapi_cipher_init(struct kcapi_handle ** handle,
                      const char * ciphername, uint32_t flags);

like. three args. one int back. she's simple, she's iconic, she slays πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • handle β€” [out] bestie this is the output, it's where the cipher handle gets filled in during the call 🫢 you bring the pointer-to-pointer, she fills it with the goods.
  • ciphername β€” [in] the kernel crypto API cipher name, exactly as specified in /proc/crypto ✨ copy it character for character, do not freestyle, do not improvise, do not get cute with it.
  • flags β€” [in] the flags that specify the type of cipher handle you want πŸ¦‹ this is where you tell her what kind of handle vibe you're going for.

πŸ’œ DESCRIPTION πŸ’œ

so what does she actually do? This function provides the initialization of a symmetric cipher handle and β€” the main character moment β€” establishes the connection to the kernel πŸ”₯

On success, a pointer to a kcapi_handle object is returned in *handle. and then?? you should call kcapi_cipher_destroy afterwards to free resources 🧚 like, that's the clean-up era, don't skip it, we don't leave handles lying around, that's not the vibe.

Return values, and listen close because these matter:

  • returns 0 upon success πŸŽ‰
  • -ENOENT β€” algorithm not available 😭
  • -EOPNOTSUPP β€” AF_ALG family not available πŸ’€
  • -EINVAL β€” accept syscall failed
  • -ENOMEM β€” cipher handle cannot be allocated πŸ™ˆ
bestie if you get a negative number back, that's not a win. check which one it is, she's telling you exactly what went wrong. periodt.

πŸ‘‘ AUTHOR πŸ‘‘

Stephan Mueller <smueller@chronox.de> β€” Author. the icon, the legend, the one who wrote it fr fr πŸ’–


that's all she wrote β€” the copyright vibes belong to the libkcapi Manual, version 1.5.0, dated July 2025 ⭐

and that's the whole page, bestie πŸŽ€ go forth and kcapi_cipher_init, remember your kcapi_cipher_destroy, and stay iconic βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from