KCAPI_KPP_SSGEN_AIO(3)

โœจ KCAPI_KPP_SSGEN_AIO โœจ

okay bestie, gather round ๐Ÿซถ this is a section 3 page from the libkcapi manual (the "Programming Interface" corner of the world), and it's about kcapi_kpp_ssgen_aio โ€” generating a shared secret, asynchronous one shot style. one shot. no second chances. main character energy only ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

kcapi_kpp_ssgen_aio โ€” generate a shared secret (asynchronous one shot) ๐Ÿ”โœจ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

ssize_t kcapi_kpp_ssgen_aio(struct kcapi_handle * handle,
                            struct iovec * iniov, struct iovec * outiov,
                            size_t iovlen, int access);

like. that's the whole function signature. she's compact, she's powerful, she's literally iconic ๐Ÿ’–


๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • handle โ€” [in] cipher handle. your little handle bestie, the one you already got from somewhere ๐Ÿ’ซ
  • iniov โ€” [in] head of scatter-gather list of the source buffers with the public keys of the peer. yes, the peer. the other party. the person on the other end of the secret ๐Ÿค
  • outiov โ€” [out] head of scatter-gather list of the destination buffers filled with the generated shared secret. this is where the magic gets deposited โœจ๐Ÿ”ฎ
  • iovlen โ€” [in] number of scatter-gather list entries. count 'em, bestie ๐Ÿ”ข
  • access โ€” [in] kernel access type. and the options are:
    • KCAPI_ACCESS_HEURISTIC โ€” use internal heuristic for fastest kernel access ๐ŸŽ๏ธ
    • KCAPI_ACCESS_VMSPLICE โ€” use vmsplice access ๐Ÿงต
    • KCAPI_ACCESS_SENDMSG โ€” sendmsg access ๐Ÿ“จ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so the individual scatter-gather list entries? each one gets processed with separate invocations of the the given cipher. not one big blob โ€” separate. invocations. periodt ๐Ÿ’…

ngl, there's a memory thing you cannot skip: the memory should be aligned at the page boundary using

posix_memalign(sysconf(_SC_PAGESIZE))

and if it is not aligned at the page boundary, the vmsplice call may not send all data to the kernel ๐Ÿ˜ญ so likeโ€ฆ align it. please. for me. for us. ๐Ÿฅบ

fr fr, misaligned memory + vmsplice = data that never made it to the kernel. that's not a vibe, that's a bug. do the posix_memalign thing ๐Ÿ™ˆ

and the return? it returns the number of bytes verify upon success; a negative errno-style error code if an error occurred. so like, positive number = slay, negative number = something went wrong, go read your errno ๐Ÿ’€


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Stephan Mueller <smueller@chronox.de> โ€” Author. the legend themselves, we stan ๐Ÿซถโญ


copyright vibes live in the footer, bestie, so here we go โ€” this page is from the libkcapi Manual 1.5.0, dated July 2025 ๐ŸŒˆ๐Ÿ’ซ

that's the whole thing. go align your memory and generate that shared secret, you absolute icon ๐Ÿงš๐ŸŽ€๐Ÿ’…

๐Ÿ“ฆ where this page comes from