Skip to content

Commit 60ad1de

Browse files
hreineckekeithbusch
authored andcommitted
nvmet-auth: update sc_c in host response
The target code should set the sc_c bit in calculating the host response based on the status of the 'concat' setting, otherwise we'll get an authentication mismatch for hosts setting that bit correctly. Fixes: 7e091ad ("nvme-auth: update sc_c in host response") Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 4c8cf6b commit 60ad1de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/nvme/target/auth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
298298
const char *hash_name;
299299
u8 *challenge = req->sq->dhchap_c1;
300300
struct nvme_dhchap_key *transformed_key;
301-
u8 buf[4];
301+
u8 buf[4], sc_c = ctrl->concat ? 1 : 0;
302302
int ret;
303303

304304
hash_name = nvme_auth_hmac_name(ctrl->shash_id);
@@ -367,13 +367,14 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
367367
ret = crypto_shash_update(shash, buf, 2);
368368
if (ret)
369369
goto out;
370-
memset(buf, 0, 4);
370+
*buf = sc_c;
371371
ret = crypto_shash_update(shash, buf, 1);
372372
if (ret)
373373
goto out;
374374
ret = crypto_shash_update(shash, "HostHost", 8);
375375
if (ret)
376376
goto out;
377+
memset(buf, 0, 4);
377378
ret = crypto_shash_update(shash, ctrl->hostnqn, strlen(ctrl->hostnqn));
378379
if (ret)
379380
goto out;

0 commit comments

Comments
 (0)