Commit 7e091add authored by Martin George's avatar Martin George Committed by Keith Busch
Browse files

nvme-auth: update sc_c in host response



The sc_c field is currently not updated in the host response to the
controller challenge leading to failures while attempting secure
channel concatenation. Fix this by adding a new sc_c variable to the
dhchap queue context structure which is appropriately set during
negotiate and then used in the host response.

Fixes: e88a7595 ("nvme-tcp: request secure channel concatenation")
Signed-off-by: default avatarMartin George <marting@netapp.com>
Signed-off-by: default avatarPrashanth Adurthi <prashana@netapp.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent bb642e2d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct nvme_dhchap_queue_context {
	u8 status;
	u8 dhgroup_id;
	u8 hash_id;
	u8 sc_c;
	size_t hash_len;
	u8 c1[64];
	u8 c2[64];
@@ -154,6 +155,8 @@ static int nvme_auth_set_dhchap_negotiate_data(struct nvme_ctrl *ctrl,
	data->auth_protocol[0].dhchap.idlist[34] = NVME_AUTH_DHGROUP_6144;
	data->auth_protocol[0].dhchap.idlist[35] = NVME_AUTH_DHGROUP_8192;

	chap->sc_c = data->sc_c;

	return size;
}

@@ -489,7 +492,7 @@ static int nvme_auth_dhchap_setup_host_response(struct nvme_ctrl *ctrl,
	ret = crypto_shash_update(shash, buf, 2);
	if (ret)
		goto out;
	memset(buf, 0, sizeof(buf));
	*buf = chap->sc_c;
	ret = crypto_shash_update(shash, buf, 1);
	if (ret)
		goto out;
@@ -500,6 +503,7 @@ static int nvme_auth_dhchap_setup_host_response(struct nvme_ctrl *ctrl,
				  strlen(ctrl->opts->host->nqn));
	if (ret)
		goto out;
	memset(buf, 0, sizeof(buf));
	ret = crypto_shash_update(shash, buf, 1);
	if (ret)
		goto out;