KCAPI_KDF_DPI(3)

πŸ’– KCAPI_KDF_DPI πŸ’–

okay so bestie, we're in the kcapi_kdf_dpi page from the libkcapi manual, and it's literally the Double Pipeline Mode Key Derivation Function. yes it's a mouthful. no you don't have to say it out loud. let's get into it πŸŽ€


✨ SYNOPSIS ✨

ssize_t kcapi_kdf_dpi(struct kcapi_handle * handle, const uint8_t * src,
                      size_t slen, uint8_t * dst, size_t dlen);

look at her. one function, five args, zero drama. πŸ’…


🌸 ARGUMENTS 🌸

  • handle β€” [in] the cipher handle that you, the caller, allocated. and babes, listen: it must be allocated with kcapi_md_init. and if you're out here wanting a KDF that uses a keyed message digest? then you also need to call kcapi_md_setkey before you invoke this function. don't skip that step, i'm begging 🫢
  • src β€” [in] the input data that should be transformed into a key (peep the DESCRIPTION below for the tea).
  • slen β€” [in] the length of the src input data. yes, the whole thing. don't be shy.
  • dst β€” [out] the buffer where your freshly generated key gets stored. she's the output, she's the moment. πŸ’–
  • dlen β€” [in] the length of the dst buffer. and this value? it literally defines the number of bytes generated by the KDF. so whatever number you put here is how many bytes you're getting. periodt.

πŸ‘‘ DESCRIPTION πŸ‘‘

so this function is an implementation of the KDF in double pipeline iteration mode β€” according with counter β€” to SP800-108 section 5.3. no cap, that's the spec.

and here's the part you cannot skip: the caller must provide Label || 0x00 || Context in src. that's the exact format, bestie, pipe-pipe and all. ✨

but also β€” plot twist β€” that src pointer may also be NULL if the caller wishes not to provide anything. so like. it's optional-optional. iconic behaviour honestly.

oh and the return? 0 upon success; a negative errno-style error code if an error occurred. that's it, that's the vibe check.


πŸ¦‹ AUTHOR πŸ¦‹

  • Stephan Mueller <smueller@chronox.de> β€” Author. yeah, he wrote it. main character energy fr fr. πŸ‘‘

and that's the whole page, bestie!! this was the kcapi_kdf_dpi(3) situation, brought to you by the libkcapi Manual 1.5.0, dated July 2025. mwah, slay, go derive some keys responsibly πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from