libnvmf_ins...s_key_compat(9)

πŸ“¦ version 3.2, in arch rolling

πŸ’… libnvmf_insert_tls_key_compat β€” bestie, let's talk TLS PSKs

okay so this page lives in the libnvme API manual and the function we're obsessing over is literally called libnvmf_insert_tls_key_compat. it derives a TLS PSK and inserts it. that's the whole vibe. let's get into it 🫢


✨ SYNOPSIS ✨

int libnvmf_insert_tls_key_compat (struct libnvme_global_ctx *ctx ,
const char *keyring , const char *key_type , const char *hostnqn , const
char *subsysnqn , int version , enum libnvmf_hmac_alg hmac , unsigned
char *configured_key , int key_len , long *key );

ten arguments, no cap. she's high-maintenance but she delivers πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • ctx β€” your struct libnvme_global_ctx object, the main character of literally every libnvme story
  • keyring β€” which keyring we're using, bestie
  • key_type β€” the type of the resulting key
  • hostnqn β€” the Host NVMe Qualified Name
  • subsysnqn β€” the Subsystem NVMe Qualified Name (yes, a different NQN, don't mix them up πŸ™ˆ)
  • version β€” which TLS PSK identity version to use
  • hmac β€” the HMAC algorithm
  • configured_key β€” the configured PSK we're deriving the retained PSK from
  • key_len β€” length of configured_key
  • key β€” the key serial gets returned here, iconic

🌸 DESCRIPTION 🌸

so here's the tea β˜• β€” this function derives a retained PSK from configured_key and, from that, the TLS PSK plus its identity exactly as specified in the NVMe TCP Transport Specification 1.3, section 3.6.1.3. slay. then it stores the TLS PSK as type key_type under that identity in the keyring you passed in via keyring. put it away neatly, we love a tidy keyring πŸ’–

the way this differs from libnvmf_insert_tls_key_versioned… okay so it uses the original implementation for HKDF Expand-Label, which does not prefix the 'info' and 'label' strings with the length. that's the whole distinction. iykyk πŸ”₯

and version? it selects the identity version, so listen up:

  • 0 β€” this one is obsolete, defined in the NVMe TCP Transport Specification 1.0. no cap, it's giving legacy vibes πŸ’€
  • 1 β€” TLS 1.3, with the PSK digest chillin' in the identity ✨

🌈 RETURN 🌈

  • 0 on success πŸŽ‰
  • negative error code otherwise 😭

fr fr, the 0 is fine but that negative error code means something went sideways. don't ignore her.

okay that's the whole page, mwah πŸ§šπŸ’œ β€” signed off from the libnvme API manual, dated October 2026. go forth and insert those keys, bestie. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from