summaryrefslogtreecommitdiffstats
path: root/src/nvme/linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvme/linux.h')
-rw-r--r--src/nvme/linux.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/nvme/linux.h b/src/nvme/linux.h
index 8e5e8ad..5dbc092 100644
--- a/src/nvme/linux.h
+++ b/src/nvme/linux.h
@@ -437,6 +437,25 @@ long nvme_revoke_tls_key(const char *keyring, const char *key_type,
char *nvme_export_tls_key(const unsigned char *key_data, int key_len);
/**
+ * nvme_export_tls_key_versioned() - Export a TLS pre-shared key
+ * @version: Indicated the representation of the TLS PSK
+ * @hmac: HMAC algorithm used to transfor the configured PSK
+ * in a retained PSK
+ * @key_data: Raw data of the key
+ * @key_len: Length of @key_data
+ *
+ * Returns @key_data in the PSK Interchange format as defined in section
+ * 3.6.1.5 of the NVMe TCP Transport specification.
+ *
+ * Return: The string containing the TLS identity or NULL with errno set
+ * on error. It is the responsibility of the caller to free the returned
+ * string.
+ */
+char *nvme_export_tls_key_versioned(unsigned char version, unsigned char hmac,
+ const unsigned char *key_data,
+ size_t key_len);
+
+/**
* nvme_import_tls_key() - Import a TLS key
* @encoded_key: TLS key in PSK interchange format
* @key_len: Length of the resulting key data
@@ -452,6 +471,24 @@ unsigned char *nvme_import_tls_key(const char *encoded_key, int *key_len,
unsigned int *hmac);
/**
+ * nvme_import_tls_key_versioned() - Import a TLS key
+ * @encoded_key: TLS key in PSK interchange format
+ * @version: Indicated the representation of the TLS PSK
+ * @hmac: HMAC algorithm used to transfor the configured
+ * PSK in a retained PSK
+ * @key_len: Length of the resulting key data
+ *
+ * Imports @key_data in the PSK Interchange format as defined in section
+ * 3.6.1.5 of the NVMe TCP Transport specification.
+ *
+ * Return: The raw data of the PSK or NULL with errno set on error. It is
+ * the responsibility of the caller to free the returned string.
+ */
+unsigned char *nvme_import_tls_key_versioned(const char *encoded_key,
+ unsigned char *version,
+ unsigned char *hmac,
+ size_t *key_len);
+/**
* nvme_submit_passthru - Low level ioctl wrapper for passthru commands
* @fd: File descriptor of the nvme device
* @ioctl_cmd: IOCTL command id