[--hostnqn=<nqn> | -n <nqn>]
[--subsysnqn=<nqn> | -c <nqn>]
[--hmac=<hmac-id> | -h <hmac-id>]
+ [--identity=<id-vers> | -I <id-vers>]
[--secret=<secret> | -s <secret>]
[--insert | -i]
[--output-format=<fmt> | -o <fmt>] [--verbose | -v]
'NVMeTLSkey-1:01:<base64 encoded data>:',
inserted as a 'retained' key into the specified keyring, or both.
When the PSK should be inserted into the keyring a 'retained' key
-is derived from the secret key material, and the resulting 'retained'
+is derived from the secret key material. The resulting 'retained'
key is stored with the identity
'NVMe0R0<hmac> <host NQN> <subsystem NQN>'
-in the keyring.
+(for identity version '0') or
+'NVMe1R0<hmac> <host NQN> <subsystem NQN> <PSK hash>'
+(for identity version '1') in the keyring.
The 'retained' key is derived from the secret key material,
the specified subsystem NQN, and the host NQN.
Once the 'retained' key is stored in the keyring the original
1 - SHA-256 (default)
2 - SHA-384
+-I <vers>::
+--identity=<id-vers>::
+ Select the TLS identity to use. Possible values are:
+ 0 - Original NVMe TLS 1.0c identity
+ 1 - NVMe TLS 2.0 (TP8018) identity
+
-s <secret>::
--secret=<secret>::
Secret value (in hexadecimal) to be used for the key. If none are
const char *secret =
"Optional secret (in hexadecimal characters) to be used for the TLS key.";
const char *hmac = "HMAC function to use for the retained key (1 = SHA-256, 2 = SHA-384).";
+ const char *identity = "TLS identity version to use (0 = NVMe TCP 1.0c, 1 = NVMe TCP 2.0";
const char *hostnqn = "Host NQN for the retained key.";
const char *subsysnqn = "Subsystem NQN for the retained key.";
const char *keyring = "Keyring for the retained key.";
char *subsysnqn;
char *secret;
unsigned int hmac;
+ unsigned int identity;
bool insert;
};
.subsysnqn = NULL,
.secret = NULL,
.hmac = 1,
+ .identity = 0,
.insert = false,
};
OPT_STR("subsysnqn", 'c', &cfg.subsysnqn, subsysnqn),
OPT_STR("secret", 's', &cfg.secret, secret),
OPT_UINT("hmac", 'm', &cfg.hmac, hmac),
+ OPT_UINT("identity", 'I', &cfg.identity, identity),
OPT_FLAG("insert", 'i', &cfg.insert, insert));
err = argconfig_parse(argc, argv, desc, opts);
nvme_show_error("Invalid HMAC identifier %u", cfg.hmac);
return -EINVAL;
}
+ if (cfg.identity > 1) {
+ nvme_show_error("Invalid TLS identity version %u",
+ cfg.identity);
+ return -EINVAL;
+ }
if (cfg.insert && !cfg.subsysnqn) {
nvme_show_error("No subsystem NQN specified");
return -EINVAL;
}
}
- tls_key = nvme_insert_tls_key(cfg.keyring, cfg.keytype, cfg.hostnqn, cfg.subsysnqn,
- cfg.hmac, raw_secret, key_len);
+ tls_key = nvme_insert_tls_key_versioned(cfg.keyring,
+ cfg.keytype, cfg.hostnqn,
+ cfg.subsysnqn, cfg.identity,
+ cfg.hmac, raw_secret, key_len);
if (tls_key < 0) {
nvme_show_error("Failed to insert key, error %d", errno);
return -errno;