KCAPI_KDF_CTR(3)
π KCAPI_KDF_CTR π
okay bestie, welcome to kcapi_kdf_ctr from the Programming Interface section of the libkcapi manual (that's section 3, the library-calls girlies π«Ά). it's literally the Counter Mode Key Derivation Function and it's here to turn your input into a key. no cap.
β¨ NAME β¨
kcapi_kdf_ctr β Counter Mode Key Derivation Function
πΈ SYNOPSIS πΈ
ssize_t kcapi_kdf_ctr(struct kcapi_handle * handle, const uint8_t * src,
size_t slen, uint8_t * dst, size_t dlen);
π ARGUMENTS π
handleβ [in] the cipher handle that you, the caller, allocated. π and listen: this handle must be allocated withkcapi_md_init. and if you're the kind of main character who wants a KDF using a keyed message digest, you should also callkcapi_md_setkeybefore you invoke this function. yes ma'am, order matters.srcβ [in] the input data that's getting transformed into a key (more on that down below π).slenβ [in] length of thesrcinput data.dstβ [out] the buffer where the generated key goes. she's the output, she's the moment. β¨dlenβ [in] length of thedstbuffer. and this is the important part: this value defines the number of bytes generated by the KDF. so like, you decide how much key you get. iconic.
π¦ DESCRIPTION π¦
so this function is an implementation of the KDF in counter mode according to SP800-108 section 5.1, AND ALSO SP800-56A section 5.8.1 (that's the Single-step KDF). two standards, one function, she's versatile. π
SP800-108: the caller must provide Label || 0x00 || Context in src. and honestly? that src pointer may also be NULL if you're the kind of caller who wishes not to provide anything. no thoughts, no context, just vibes. π
SP800-56A: if a keyed MAC is used, the key shall NOT be the shared secret from the DH operation β it has to be an independently generated key. like, do not do that. seriously. and the src pointer here is defined as Z || other info, where Z is the shared secret from DH and other info is an arbitrary string (see SP800-56A section 5.8.1.2 for the receipts π).
return0upon success; a negativeerrno-style error code if an error occurred. so like, zero is the slay, negative is the π.
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. periodt. π
π COPYRIGHT π
that's the whole page bestie, go derive some keys responsibly π§β¨
libkcapi Manual1.5.0βJuly 2025βKCAPI_KDF_CTR(3)
mwah π go forth and be cryptographic.
π¦ 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