KCAPI_AKCIPHER_DECRY(3)

✨ KCAPI_AKCIPHER_DECRY(3) ✨

okay bestie, welcome to the libkcapi manual, section 3 πŸŽ€ this one's about kcapi_akcipher_decrypt β€” the glow-up machine that turns your ciphertext back into readable plaintext. no cap. πŸ’…


🌸 NAME 🌸

kcapi_akcipher_decrypt β€” decrypt data πŸ¦‹


⭐ SYNOPSIS ⭐

ssize_t kcapi_akcipher_decrypt(struct kcapi_handle * handle,
                               const uint8_t * in, size_t inlen,
                               uint8_t * out, size_t outlen,
                               int access);

πŸ’– ARGUMENTS πŸ’–

  • handle β€” [in] your cipher handle. the main character of this whole operation πŸ‘‘
  • in β€” [in] the ciphertext data buffer. this is the mystery box you're opening πŸ™ˆ
  • inlen β€” [in] how long that in buffer is, in bytes.
  • out β€” [out] the plaintext data buffer. this is where the reveal lands ✨
  • outlen β€” [in] how long the out buffer is.
  • access β€” [in] which kernel access type you want:
    • KCAPI_ACCESS_HEURISTIC β€” use the internal heuristic to figure out the fastest kernel access πŸ”₯
    • KCAPI_ACCESS_VMSPLICE β€” use vmsplice access
    • KCAPI_ACCESS_SENDMSG β€” use sendmsg access

🌈 DESCRIPTION 🌈

it is perfectly legal to use the same buffer for both the plaintext and ciphertext pointers. like, go off. what that means is: after the decryption operation finishes, the ciphertext gets overwritten with the plaintext. one buffer, two eras. πŸ’€

now, the memory should be aligned at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). if it is not aligned at the page boundary, the vmsplice call may not send all the data to the kernel. so like… align it, bestie, it's giving self-care 🧚

if the output size is insufficiently large, -EINVAL is returned. the output buffer must be at least as large as the modulus of the key being used. no shortcuts, that's the rule 😭

on success you get back the number of bytes returned by the decryption operation; if something went wrong you get a negative errno-style error code instead. slay when it works, weep when it doesn't 🫢


πŸ’œ AUTHOR πŸ’œ

Stephan Mueller <smueller@chronox.de> Author.


that's the whole page, bestie β€” periodt. πŸ’–

this was libkcapi Manual 1.5.0, dated July 2025, and yes the title up top says KCAPI_AKCIPHER_DECRY(3). go decrypt something iconic βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from