Skip to content

Commit 5fdc131

Browse files
martin-gpyigaw
authored andcommitted
fabrics: add error if dhchap-ctrl-secret is specified with --concat
--concat works only with unidirectional auth and not bidirectional auth. As per section 8.3.4.5.9 Generated PSK for TLS in the NVMe base spec 2.1: "The host may request secure channel concatenation with the TLS protocol by setting the SC_C field in the AUTH_Negotiate message to NEWTLSPSK while performing only unidirectional auth. In this case, the host shall send a challenge value C2 to the controller and clear the sequence number S2 to 0h to indicate that controller authentication is not requested". In the kernel too, if both host and controller auth keys are specified with secure channel concat, it would ignore the controller key and and default to using the host key itself for uni-auth with concat TLS. So add an appropriate error to catch the same in the userspace itself. Signed-off-by: Martin George <[email protected]>
1 parent 62a3ec1 commit 5fdc131

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

libnvme/src/nvme/fabrics.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,11 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
742742
return -ENVME_CONNECT_INVAL;
743743
}
744744

745+
if (cfg->concat && ctrlkey) {
746+
nvme_msg(h->ctx, LOG_ERR, "cannot specify [--dhchap-ctrl-secret | -C] with --concat\n");
747+
return -ENVME_CONNECT_INVAL;
748+
}
749+
745750
if (cfg->tls) {
746751
ret = __nvme_import_keys_from_config(h, c, &keyring_id, &key_id);
747752
if (ret)

0 commit comments

Comments
 (0)