nvme_auth_generate_digest(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

nvme_auth_generate_digest β€” the little function that generates a TLS PSK digest ✨ (yes bestie, it's from the Kernel API Manual, and yes it's nvme_auth_generate_digest(9) β€” iykyk 🫢)


✨ SYNOPSIS ✨

int nvme_auth_generate_digest (u8 hmac_id , const u8 *psk , size_t
psk_len , const char *subsysnqn , const char *hostnqn , char
**ret_digest );

πŸŽ€ ARGUMENTS πŸŽ€

  • hmac_id β€” the hash function identifier πŸ‘‘ (which hash we're vibing with)
  • psk β€” the generated input PSK πŸ”‘
  • psk_len β€” length of psk, like, how many bytes of PSK we're working with
  • subsysnqn β€” the NQN of the subsystem πŸ¦‹
  • hostnqn β€” the NQN of the host 🌸
  • ret_digest β€” pointer to the returned digest, i.e. where the good stuff gets handed back to you πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the whole point of this function πŸ₯°: it generates a TLS PSK digest, exactly as specified in TP8018 Section 3.6.1.3: TLS PSK and PSK identity Derivation. Periodt.

The PSK digest shall be computed by encoding in Base64 (refer to RFC 4648) the result of the application of the HMAC function using the hash function specified in item 4 above (ie the hash function of the cipher suite associated with the PSK identity) with the PSK as HMAC key to the concatenation of:

  • the NQN of the host (i.e., NQNh) β€” not including the null terminator;
  • a space character;
  • the NQN of the NVM subsystem (i.e., NQNc) β€” not including the null terminator;
  • a space character; and
  • the seventeen ASCII characters "NVMe-over-Fabrics" β€” fr fr, seventeen of them.

Like, the whole vibe is:

<PSK digest> = Base64(HMAC(PSK, NQNh || " " || NQNc || " " || "NVMe-over-Fabrics"))

The length of the PSK digest depends on the hash function used to compute it, as follows:

  • if the SHA-256 hash function is used, the resulting PSK digest is 44 characters long; or
  • if the SHA-384 hash function is used, the resulting PSK digest is 64 characters long. πŸ’€ (longer hash, longer digest, math is mathing)

Returns 0 on success with a valid digest pointer in ret_digest πŸŽ‰ β€” or a negative error number on failure πŸ™ˆ.

Not me emphasizing this: success = 0 + valid digest pointer in ret_digest; failure = negative error number. Don't get it twisted πŸ’…

🌸 SEE ALSO 🌸


And that's the whole page, bestie 🫢 β€” brought to you by the source/version ./drivers/nvme/common, dated October 2026, and filed under nvme_auth_generate_digest(9) in the Kernel API Manual. Slay, go generate some digests πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from