KCAPI_AKCIPHER_VERIF(3)
π KCAPI_AKCIPHER_VERIF β signature verification, bestie edition π
okay so this page is KCAPI_AKCIPHER_VERIF(3) from the Programming Interface section, and it's literally the whole vibe of "did this signature actually come from who it says it did" π΅οΈβοΈβ¨
πΈ NAME πΈ
kcapi_akcipher_verify β signature verification. that's it, that's the whole job. she verifies signatures. queen behavior π
β¨ SYNOPSIS β¨
ssize_t kcapi_akcipher_verify(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 girl. your main character. the thing you already set up πinβ [in] the message data buffer. this is the data whose signature we're checking.inlenβ [in] how longinis. the length. the size. the amount of stuff. πoutβ [out] the signature data buffer. yes it's marked out, and yes that's a whole thing β read the DESCRIPTION, bestie πoutlenβ [in] the length of theoutbuffer. she needs to know how much room she has.accessβ [in] the kernel access type, pick your fighter:KCAPI_ACCESS_HEURISTICβ uses the internal heuristic to find the fastest kernel access π₯KCAPI_ACCESS_VMSPLICEβ uses thevmspliceaccessKCAPI_ACCESS_SENDMSGβ uses thesendmsgaccess
π DESCRIPTION π
okay so first thing, and this is important: it is perfectly legal to use the same buffer for the message pointer and the signature pointer. same buffer, both jobs, no drama. π«Ά but like, think about what that means β after the signature generation operation, the message gets overwritten with the signature. so your original message? gone. replaced. it's giving "we traded". π
now, the memory situation. you should align it at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). and I mean should, because if it is not aligned at the page boundary, the vmsplice call may not send all the data to the kernel. not all of it. some of it justβ¦ stays home. π so align it, fr fr.
if the output size is insufficiently large, -EINVAL gets returned. so the output buffer must be at least as large as the modulus of the key you're using β that's the floor, that's the minimum, do not test her. π
and now the part you cannot skip: to catch signature verification errors, you must check the return value of this call. like actually check it. if this function returns -EBADMSG, the verification of the signature failed. that's the whole point of the call, bestie, don't just call it and walk away π
return value breakdown:
- on success, it returns the number of bytes returned by the signature ver operation π
- if an error occurred, you get a negative errno-style error code back
β οΈ no cap: an unchecked return value here is a vibe check you will fail. -EBADMSG means the signature did not verify. periodt. π
π AUTHOR π
Stephan Mueller <smueller@chronox.de>
- Author.
π COPYRIGHT π
that's the whole page, bestie, go forth and verify responsibly π
and that's a wrap! this was libkcapi Manual 1.5.0, dated July 2025 β mwah, iconic, no notes πβ¨π¦π
π¦ 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