KCAPI_HKDF(3)

✨ NAME ✨

kcapi_hkdf β€” Extract-and-Expand HKDF (RFC5869)

okay bestie, welcome to page 3 of the libkcapi manual β€” this is KCAPI_HKDF(3) and it's literally the glow-up your key derivation needed πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

ssize_t kcapi_hkdf(const char * hashname, const uint8_t * ikm,
                   size_t ikmlen, const uint8_t * salt,
                   uint32_t saltlen, const uint8_t * info,
                   size_t infolen, uint8_t * dst, size_t dlen);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • hashname β€” [in] the kernel crypto API name of a keyed hash, like hmac(sha1). that's the flavor of hash you're serving today πŸ“
  • ikm β€” [in] Input Keying Material (IKM) β€” and no, you can't skip it, it must be provided. it's the main character here πŸ‘‘
  • ikmlen β€” [in] the length of the IKM buffer β€” must be non-zero. we do not accept zero, periodt
  • salt β€” [in] salt buffer β€” lowkey optional, it may be NULL πŸ§‚
  • saltlen β€” [in] salt buffer length β€” may be zero
  • info β€” [in] info buffer β€” also chill, may be NULL
  • infolen β€” [in] info buffer length β€” may be zero
  • dst β€” [out] Buffer to store the generated key in,
  • dlen β€” [in] Length of the dst buffer. This value defines the number of bytes generated by the KDF. so like, this is you deciding how much key you want ✨

πŸ’– DESCRIPTION πŸ’–

Perform the key-derivation function according to RFC5869. The input data is defined in sections 2.2 und 2.3 of RFC5869. (yes the "und" is in the original, we keep the receipts, no cap 🫢)

return 0 upon success; a negative errno-style error code if an error occurred. so zero = slay, negative = something went sideways 😭


🌸 AUTHOR 🌸

Stephan Mueller <smueller@chronox.de>

  • Author.

that's the whole page bestie, go forth and derive πŸ’œ

and finally, the cute lil sign-off: this page comes from the libkcapi Manual 1.5.0, dated July 2025. bye bestie, drink water, check your error codes πŸ’…πŸ¦‹βœ¨

πŸ“¦ where this page comes from