crypto_shash_setkey(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ crypto_shash_setkey(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– we're doing crypto_shash_setkey(9) today and it's literally gonna be so easy, i promise 🫢


🌸 NAME 🌸

crypto_shash_setkey β€” set key for message digest πŸ”‘


πŸŽ€ SYNOPSIS πŸŽ€

int crypto_shash_setkey (struct crypto_shash *tfm , const u8 *key ,
       unsigned int keylen );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • tfm β€” the cipher handle πŸ’… that's your main character right there
  • key β€” the buffer holding the key πŸ”‘ like the actual key bytes live here
  • keylen β€” length of the key in bytes, not vibes, bytes ✨

πŸ‘‘ DESCRIPTION πŸ‘‘

so basically: the key you the caller provided gets set for the keyed message digest cipher πŸ’– that's it, that's the plot.

but here's the thing bestie, listen β€” the cipher handle has to point to a keyed message digest cipher, or this function will not succeed. no cap. if it's not keyed, this whole thing is a no 🚫


🌈 CONTEXT 🌈

Softirq or process context. so yes, both, depending. iykyk ⭐


πŸ’œ RETURN πŸ’œ

0 if the setting of the key was successful πŸŽ‰; < 0 if an error occurred 😭

fr fr check the return value, don't just assume it slayed πŸ™ˆ

πŸ“ SEE ALSO πŸ“

Kernel file ./include/crypto/hash.h 🌸 Message Digest Algorithm Definitions(9), struct ahash_alg(9), struct shash_alg(9), Asynchronous Message Digest API(9), crypto_alloc_ahash(9), crypto_free_ahash(9), crypto_has_ahash(9), crypto_ahash_blocksize(9), crypto_ahash_digestsize(9), crypto_ahash_statesize(9), crypto_ahash_reqtfm(9), crypto_ahash_reqsize(9), crypto_ahash_setkey(9), crypto_ahash_finup(9), crypto_ahash_final(9), crypto_ahash_digest(9), crypto_ahash_export(9), crypto_ahash_import(9), crypto_ahash_init(9), crypto_ahash_update(9), Asynchronous Hash Request Handle(9), ahash_request_set_tfm(9), ahash_request_alloc(9), ahash_request_free(9), ahash_request_set_callback(9), ahash_request_set_crypt(9), ahash_request_set_virt(9), Synchronous Message Digest API(9), crypto_alloc_shash(9), crypto_free_shash(9), crypto_shash_blocksize(9), crypto_shash_digestsize(9), crypto_shash_descsize(9), crypto_shash_digest(9), crypto_shash_tfm_digest(9), crypto_shash_export(9), crypto_shash_import(9), crypto_shash_init(9), crypto_shash_finup(9), crypto_shash_update(9), crypto_shash_final(9) 🧚

that's a lot of links bestie but they're all right there, go click around, it's giving study session πŸ“šβœ¨


and that's the whole page!! πŸ’… this one came from ./include/crypto, October 2026, and it's crypto_shash_setkey(9) β€” mwah, go set some keys, you're gonna ate it up πŸ”₯πŸ‘‘πŸŽ€

πŸ“¦ where this page comes from