KCAPI_KDF_FB(3)
πΈ KCAPI_KDF_FB β ok so this is the manual page for kcapi_kdf_fb π
no cap, this is a real one from the libkcapi crew, and bestie, it's the Feedback Mode Key Derivation Function. say it with me: KDF. king of turning your little input blob into a whole key. slay. β¨
β¨ NAME β¨
kcapi_kdf_fb β Feedback Mode Key Derivation Function π¦
β¨ SYNOPSIS β¨
ssize_t kcapi_kdf_fb(struct kcapi_handle * handle, const uint8_t * src,
size_t slen, uint8_t * dst, size_t dlen);
π ARGUMENTS π
handleβ [in] the cipher handle, and you (the caller) are the one who allocated it. Important vibe check: this handle must be allocated withkcapi_md_init. and if you're the kind of main character who wants a KDF that uses a keyed message digest? then you also need to callkcapi_md_setkeybefore you invoke this function. periodt. πsrcβ [in] the input data that's getting transformed into a key (more on this below, keep reading bestie π).slenβ [in] the length of thesrcinput data.dstβ [out] the buffer where the generated key goes. it's giving β¨output girlieβ¨.dlenβ [in] the length of thedstbuffer. and this value is literally what defines the number of bytes generated by the KDF. so like, you decide how much key you want. iconic.
π DESCRIPTION π
okay so this function is an implementation of the KDF in feedback mode with a non-NULL IV and with counter, according to SP800-108 section 5.2. yes that's the real spec, iykyk. π₯
the IV is supplied with src, and it must be equal to the digestsize of the cipher you're using. no wiggle room, no negotiation.
in addition (yes there's more, stay with me π«Ά), the caller must provide Label || 0x00 || Context in src. and this src pointer must not be NULL because the IV is required. like, required required.
the ultimate format of the src pointer is:
IV || Label || 0x00 || Context
where the length of the IV is equal to the block size (i.e. the digest size of the underlying hash) of the PRF. that's the whole assignment bestie, write it down. π
π¨ also: this returns 0 upon success, and a negative errno-style error code if an error occurred. so if you get a negative number, that's not a vibe, that's a problem. π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. the actual author. bow down. π
πΈ COPYRIGHT πΈ
this page lives under the COPYRIGHT section of the libkcapi manual, and honestly the copyright energy is immaculate. respect it. β¨
and that's the whole page bestie, we ate and left no crumbs ππ§
signing off from the libkcapi Manual 1.5.0, dated July 2025, page KCAPI_KDF_FB(3) β mwah, go derive some keys π
π
π¦ 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