blk_crypto_init_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… blk_crypto_init_key (kernel API manual, bestie edition) πŸ’…

Okay so real talk β€” this one's blk_crypto_init_key from the kernel API manual, and it's literally the glow-up your key needs before blk-crypto will even look at it. Let's get into it ✨


🌸 NAME 🌸

blk_crypto_init_key β€” prepare a key for use with blk-crypto πŸ”‘

Like, it takes your key and gets it all dressed up and ready for the blk-crypto ball. No cap.


πŸŽ€ SYNOPSIS πŸŽ€

int blk_crypto_init_key (struct blk_crypto_key *blk_key , const u8
*key_bytes , size_t key_size , enum blk_crypto_key_type key_type , enum
blk_crypto_mode_num crypto_mode , unsigned int dun_bytes , unsigned int
data_unit_size , int flags );

That's a lot of args, i know 😭 but every single one is doing its job, ok? Let's meet them πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • blk_key β€” pointer to the blk_crypto_key you're initializing. This is the main character here, the one getting set up πŸ‘‘
  • key_bytes β€” the actual bytes of the key. the raw material, the moment, the stuff πŸ“
  • key_size β€” size of the key in bytes. yes, in bytes, specifically πŸ’…
  • key_type β€” type of the key β€” either raw or hardware-wrapped. two vibes, you pick 🫢
  • crypto_mode β€” identifier for the encryption algorithm to use. the algorithm's @ basically ✨
  • dun_bytes β€” number of bytes that will be used to specify the DUN when this key is used. yes it's dun_bytes not "done bytes", i know, i giggled too πŸ™ˆ
  • data_unit_size β€” the data unit size to use for en/decryption. how big each unit is, lowkey important πŸ”₯
  • flags β€” BLK_CRYPTO_CFG_* flags. the little config sprinkles on top 🌈

⭐ RETURN ⭐

0 on success, -errno on failure. that's it, that's the whole vibe check πŸ’€

🚨 okay listen bestie, this part matters: the caller is responsible for zeroizing both blk_key and key_bytes when done with them. like, both of them. zeroize them. don't leave key material just lying around, that's genuinely not the move, fr fr 😀

πŸ’œ SEE ALSO πŸ’œ

the whole friend group, honestly 🧚


That's the whole page, bestie β€” slay, you now know how to prep a key for blk-crypto πŸ’–βœ¨ This one came out of ./block, dated October 2026, and it's page blk_crypto_init_key(9) of the kernel API manual. mwah, go zeroize your keys πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from