libnvmf_ins...s_key_compat(9)
π 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β yourstruct libnvme_global_ctxobject, the main character of literally every libnvme storykeyringβ which keyring we're using, bestiekey_typeβ the type of the resulting keyhostnqnβ the Host NVMe Qualified Namesubsysnqnβ the Subsystem NVMe Qualified Name (yes, a different NQN, don't mix them up π)versionβ which TLS PSK identity version to usehmacβ the HMAC algorithmconfigured_keyβ the configured PSK we're deriving the retained PSK fromkey_lenβ length ofconfigured_keykeyβ 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 π
0on 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
- arch rolling: nvme-cli 3.2-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms