KCAPI_MD_SETKEY(3)

πŸ’– NAME πŸ’–

kcapi_md_setkey β€” bestie, this is the one that sets the key for your message digest handle πŸ”‘


✨ SYNOPSIS ✨

int kcapi_md_setkey(struct kcapi_handle * handle, const uint8_t * key,
                    uint32_t keylen);

πŸŽ€ ARGUMENTS πŸŽ€

  • handle β€” [in] your cipher handle, the lil main character of this whole situation 🫢
  • key β€” [in] the key buffer, aka where your actual key lives
  • keylen β€” [in] length of that key buffer, so we know how much of it to actually read πŸ“

🌸 DESCRIPTION 🌸

Okay so, with this function the caller sets the key for all the hashing operations that come after it. Lowkey important: this call is only applicable for keyed message digests β€” not your plain unkeyed ones, iykyk.

And here's the part that's genuinely iconic πŸ‘‘ β€” once you've handed the key over, you may securely destroy it, because at that point it's being maintained by the kernel, not by you. No cap. Your key is safe in the kernel's hands now, so go ahead and wipe your copy, bestie πŸ’…

The return value is giving:

  • 0 upon success πŸŽ‰
  • a negative errno-style error code if an error occurred 😭

πŸ¦‹ AUTHOR πŸ¦‹

Stephan Mueller <smueller@chronox.de> Author.


That's a wrap, gorgeous! This was libkcapi Manual version 1.5.0, dated July 2025 β€” go set some keys, destroy them securely, and slay the whole time πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from