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 with kcapi_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 call kcapi_md_setkey before 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 the src input data.
  • dst β€” [out] the buffer where the generated key goes. it's giving ✨output girlie✨.
  • dlen β€” [in] the length of the dst buffer. 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. πŸ‘‘


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