---
name: "libnvmf_insert_tls_key_compat-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvmf_insert_tls_key_compat-libnvme3"
---

# libnvmf\_insert\_tls\_key\_compat-libnvme3(2)

Derive and insert a TLS PSK

## NAME

libnvmf\_insert\_tls\_key\_compat - Derive and insert a TLS PSK

## 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** *);*

## ARGUMENTS

- ctx

  struct libnvme\_global\_ctx object

- keyring

  Keyring to use

- key\_type

  Type of the resulting key

- hostnqn

  Host NVMe Qualified Name

- subsysnqn

  Subsystem NVMe Qualified Name

- version

  TLS PSK identity version to use

- hmac

  HMAC algorithm

- configured\_key

  Configured PSK to derive the retained PSK from

- key\_len

  Length of *configured\_key*

- key

  Key serial to return

## DESCRIPTION

Derives a retained PSK from *configured\_key* and, from that, the TLS PSK and its identity as specified in the NVMe TCP Transport Specification 1.3, section 3.6.1.3. Stores the TLS PSK as type *key\_type* under that identity in the keyring specified by *keyring*. This function differs from **libnvmf\_insert\_tls\_key\_versioned** in that it uses the original implementation for HKDF Expand-Label which does not prefix the 'info' and 'label' strings with the length.

*version* selects the identity version: 0 is obsolete and defined in the NVMe TCP Transport Specification 1.0, 1 is TLS 1.3 with the PSK digest in the identity.

## RETURN

0 on success, negative error code otherwise.
