Lines Matching +full:0 +full:d

20 	pr_debug("%s: ctrl %d qid %d transaction %u expired, resetting\n",  in nvmet_auth_expired_work()
34 static u16 nvmet_auth_negotiate(struct nvmet_req *req, void *d) in nvmet_auth_negotiate() argument
37 struct nvmf_auth_dhchap_negotiate_data *data = d; in nvmet_auth_negotiate()
38 int i, hash_id = 0, fallback_hash_id = 0, dhgid, fallback_dhgid; in nvmet_auth_negotiate()
40 pr_debug("%s: ctrl %d qid %d: data sc_d %d napd %d authid %d halen %d dhlen %d\n", in nvmet_auth_negotiate()
42 data->sc_c, data->napd, data->auth_protocol[0].dhchap.authid, in nvmet_auth_negotiate()
43 data->auth_protocol[0].dhchap.halen, in nvmet_auth_negotiate()
44 data->auth_protocol[0].dhchap.dhlen); in nvmet_auth_negotiate()
52 if (data->auth_protocol[0].dhchap.authid != in nvmet_auth_negotiate()
56 for (i = 0; i < data->auth_protocol[0].dhchap.halen; i++) { in nvmet_auth_negotiate()
57 u8 host_hmac_id = data->auth_protocol[0].dhchap.idlist[i]; in nvmet_auth_negotiate()
60 crypto_has_shash(nvme_auth_hmac_name(host_hmac_id), 0, 0)) in nvmet_auth_negotiate()
67 if (hash_id == 0) { in nvmet_auth_negotiate()
68 if (fallback_hash_id == 0) { in nvmet_auth_negotiate()
69 pr_debug("%s: ctrl %d qid %d: no usable hash found\n", in nvmet_auth_negotiate()
73 pr_debug("%s: ctrl %d qid %d: no usable hash found, falling back to %s\n", in nvmet_auth_negotiate()
81 for (i = 0; i < data->auth_protocol[0].dhchap.dhlen; i++) { in nvmet_auth_negotiate()
82 int tmp_dhgid = data->auth_protocol[0].dhchap.idlist[i + 30]; in nvmet_auth_negotiate()
88 if (fallback_dhgid < 0) { in nvmet_auth_negotiate()
91 if (crypto_has_kpp(kpp, 0, 0)) in nvmet_auth_negotiate()
95 if (dhgid < 0) { in nvmet_auth_negotiate()
96 if (fallback_dhgid < 0) { in nvmet_auth_negotiate()
97 pr_debug("%s: ctrl %d qid %d: no usable DH group found\n", in nvmet_auth_negotiate()
101 pr_debug("%s: ctrl %d qid %d: configured DH group %s not found\n", in nvmet_auth_negotiate()
106 pr_debug("%s: ctrl %d qid %d: selected DH group %s (%d)\n", in nvmet_auth_negotiate()
109 return 0; in nvmet_auth_negotiate()
112 static u16 nvmet_auth_reply(struct nvmet_req *req, void *d) in nvmet_auth_reply() argument
115 struct nvmf_auth_dhchap_reply_data *data = d; in nvmet_auth_reply()
119 pr_debug("%s: ctrl %d qid %d: data hl %d cvalid %d dhvlen %u\n", in nvmet_auth_reply()
127 dhvlen) < 0) in nvmet_auth_reply()
136 pr_warn("ctrl %d qid %d no host key\n", in nvmet_auth_reply()
141 if (nvmet_auth_host_hash(req, response, data->hl) < 0) { in nvmet_auth_reply()
142 pr_debug("ctrl %d qid %d host hash failed\n", in nvmet_auth_reply()
149 pr_info("ctrl %d qid %d host response mismatch\n", in nvmet_auth_reply()
155 pr_debug("%s: ctrl %d qid %d host authenticated\n", in nvmet_auth_reply()
163 pr_debug("%s: ctrl %d qid %d challenge %*ph\n", in nvmet_auth_reply()
172 return 0; in nvmet_auth_reply()
175 static u16 nvmet_auth_failure2(void *d) in nvmet_auth_failure2() argument
177 struct nvmf_auth_dhchap_failure_data *data = d; in nvmet_auth_failure2()
186 void *d; in nvmet_execute_auth_send() local
188 u16 status = 0; in nvmet_execute_auth_send()
196 if (req->cmd->auth_send.spsp0 != 0x01) { in nvmet_execute_auth_send()
202 if (req->cmd->auth_send.spsp1 != 0x01) { in nvmet_execute_auth_send()
220 d = kmalloc(tl, GFP_KERNEL); in nvmet_execute_auth_send()
221 if (!d) { in nvmet_execute_auth_send()
226 status = nvmet_copy_from_sgl(req, 0, d, tl); in nvmet_execute_auth_send()
230 data = d; in nvmet_execute_auth_send()
231 pr_debug("%s: ctrl %d qid %d type %d id %d step %x\n", __func__, in nvmet_execute_auth_send()
240 pr_debug("%s: ctrl %d qid %d reset negotiation\n", __func__, in nvmet_execute_auth_send()
243 if (nvmet_setup_auth(ctrl) < 0) { in nvmet_execute_auth_send()
245 pr_err("ctrl %d qid 0 failed to setup" in nvmet_execute_auth_send()
255 status = nvmet_auth_negotiate(req, d); in nvmet_execute_auth_send()
256 if (status == 0) in nvmet_execute_auth_send()
263 status = 0; in nvmet_execute_auth_send()
268 pr_debug("%s: ctrl %d qid %d step mismatch (%d != %d)\n", in nvmet_execute_auth_send()
274 pr_debug("%s: ctrl %d qid %d invalid transaction %d (expected %d)\n", in nvmet_execute_auth_send()
287 status = nvmet_auth_reply(req, d); in nvmet_execute_auth_send()
288 if (status == 0) in nvmet_execute_auth_send()
295 status = 0; in nvmet_execute_auth_send()
300 pr_debug("%s: ctrl %d qid %d ctrl authenticated\n", in nvmet_execute_auth_send()
304 status = nvmet_auth_failure2(d); in nvmet_execute_auth_send()
306 pr_warn("ctrl %d qid %d: authentication failed (%d)\n", in nvmet_execute_auth_send()
310 status = 0; in nvmet_execute_auth_send()
326 kfree(d); in nvmet_execute_auth_send()
328 pr_debug("%s: ctrl %d qid %d dhchap status %x step %x\n", __func__, in nvmet_execute_auth_send()
332 pr_debug("%s: ctrl %d qid %d nvme status %x error loc %d\n", in nvmet_execute_auth_send()
335 req->cqe->result.u64 = 0; in nvmet_execute_auth_send()
353 static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al) in nvmet_auth_challenge() argument
355 struct nvmf_auth_dhchap_challenge_data *data = d; in nvmet_auth_challenge()
357 int ret = 0; in nvmet_auth_challenge()
359 int data_size = sizeof(*d) + hash_len; in nvmet_auth_challenge()
364 pr_debug("%s: buffer too small (al %d need %d)\n", __func__, in nvmet_auth_challenge()
368 memset(data, 0, data_size); in nvmet_auth_challenge()
387 pr_debug("%s: ctrl %d qid %d seq %d transaction %d hl %d dhvlen %zu\n", in nvmet_auth_challenge()
393 static int nvmet_auth_success1(struct nvmet_req *req, void *d, int al) in nvmet_auth_success1() argument
395 struct nvmf_auth_dhchap_success1_data *data = d; in nvmet_auth_success1()
400 memset(data, 0, sizeof(*data)); in nvmet_auth_success1()
407 pr_warn("ctrl %d qid %d no ctrl key\n", in nvmet_auth_success1()
414 pr_debug("ctrl %d qid %d response %*ph\n", in nvmet_auth_success1()
417 return 0; in nvmet_auth_success1()
420 static void nvmet_auth_failure1(struct nvmet_req *req, void *d, int al) in nvmet_auth_failure1() argument
422 struct nvmf_auth_dhchap_failure_data *data = d; in nvmet_auth_failure1()
435 void *d; in nvmet_execute_auth_receive() local
437 u16 status = 0; in nvmet_execute_auth_receive()
445 if (req->cmd->auth_receive.spsp0 != 0x01) { in nvmet_execute_auth_receive()
451 if (req->cmd->auth_receive.spsp1 != 0x01) { in nvmet_execute_auth_receive()
469 d = kmalloc(al, GFP_KERNEL); in nvmet_execute_auth_receive()
470 if (!d) { in nvmet_execute_auth_receive()
474 pr_debug("%s: ctrl %d qid %d step %x\n", __func__, in nvmet_execute_auth_receive()
478 if (nvmet_auth_challenge(req, d, al) < 0) { in nvmet_execute_auth_receive()
479 pr_warn("ctrl %d qid %d: challenge error (%d)\n", in nvmet_execute_auth_receive()
487 status = nvmet_auth_success1(req, d, al); in nvmet_execute_auth_receive()
491 nvmet_auth_failure1(req, d, al); in nvmet_execute_auth_receive()
492 pr_warn("ctrl %d qid %d: success1 status (%x)\n", in nvmet_execute_auth_receive()
501 nvmet_auth_failure1(req, d, al); in nvmet_execute_auth_receive()
502 pr_warn("ctrl %d qid %d failure1 (%x)\n", in nvmet_execute_auth_receive()
506 pr_warn("ctrl %d qid %d unhandled step (%d)\n", in nvmet_execute_auth_receive()
510 nvmet_auth_failure1(req, d, al); in nvmet_execute_auth_receive()
511 status = 0; in nvmet_execute_auth_receive()
515 status = nvmet_copy_to_sgl(req, 0, d, al); in nvmet_execute_auth_receive()
516 kfree(d); in nvmet_execute_auth_receive()
518 req->cqe->result.u64 = 0; in nvmet_execute_auth_receive()