KCAPI_AKCIPHER_SIGN(3)

✨ KCAPI_AKCIPHER_SIGN ✨

okay bestie, gather round πŸ’– this is kcapi_akcipher_sign(3) from the libkcapi manual (that's the Programming Interface girlies, section 3, the good section) and she is literally the function that signs things for you. no cap.


🌸 NAME 🌸

kcapi_akcipher_sign β€” signature generation πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

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

πŸ¦‹ ARGUMENTS πŸ¦‹

  • handle β€” [in] the cipher handle. your whole entire vibe, the thing you're working with 🫢
  • in β€” [in] the message data buffer. this is the tea you're about to sign, bestie.
  • inlen β€” [in] length of the in buffer. yes she's literally just the length, iconic behaviour honestly.
  • out β€” [out] the signature data buffer. this is where the signature gets dropped ✨
  • outlen β€” [in] length of the out buffer.
  • access β€” [in] the kernel access type πŸ‘‘ your options are:
    • KCAPI_ACCESS_HEURISTIC β€” use the internal heuristic for the fastest kernel access πŸ”₯
    • KCAPI_ACCESS_VMSPLICE β€” use vmsplice access
    • KCAPI_ACCESS_SENDMSG β€” use sendmsg access

πŸ’œ DESCRIPTION πŸ’œ

first thing's first, and this is lowkey the cutest part: it is perfectly legal to use the same buffer for both the message and signature pointers πŸ’– like, go off. what that means is that after the signature generation operation finishes, the message gets overwritten with the signature. same memory, new content, main character energy ✨

second thing: your 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. and bestie. we do NOT want the kernel getting half the data 😭

third thing, and this one's important so listen up: if the output size is insufficiently large, -EINVAL is returned 🚨 the output buffer must be at least as large as the modulus of the used key. fr fr. size her correctly or she will simply not.

and then, the return situation: on success you get the number of bytes returned by the signature gen operation; on error you get a negative errno-style error code. that's it, that's the whole deal πŸ’…

🌈 AUTHOR 🌈

Stephan Mueller <smueller@chronox.de>

  • Author. πŸ’«

(no extra deets in this section, the girlies said see the sign-off below πŸ’–)


and that's the whole page, bestie!! you ate this 🫢 go forth and sign things responsibly ✨

libkcapi Manual 1.5.0 β€” July 2025 β€” KCAPI_AKCIPHER_SIGN(3) β€” mwah, that's the footer, love u, bye πŸ’…πŸŽ€

πŸ“¦ where this page comes from