Lines Matching refs:chap

121 		struct nvme_dhchap_queue_context *chap)  in nvme_auth_set_dhchap_negotiate_data()  argument
123 struct nvmf_auth_dhchap_negotiate_data *data = chap->buf; in nvme_auth_set_dhchap_negotiate_data()
127 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_set_dhchap_negotiate_data()
130 memset((u8 *)chap->buf, 0, size); in nvme_auth_set_dhchap_negotiate_data()
133 data->t_id = cpu_to_le16(chap->transaction); in nvme_auth_set_dhchap_negotiate_data()
153 struct nvme_dhchap_queue_context *chap) in nvme_auth_process_dhchap_challenge() argument
155 struct nvmf_auth_dhchap_challenge_data *data = chap->buf; in nvme_auth_process_dhchap_challenge()
162 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_process_dhchap_challenge()
170 chap->qid, data->hashid); in nvme_auth_process_dhchap_challenge()
171 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE; in nvme_auth_process_dhchap_challenge()
175 if (chap->hash_id == data->hashid && chap->shash_tfm && in nvme_auth_process_dhchap_challenge()
176 !strcmp(crypto_shash_alg_name(chap->shash_tfm), hmac_name) && in nvme_auth_process_dhchap_challenge()
177 crypto_shash_digestsize(chap->shash_tfm) == data->hl) { in nvme_auth_process_dhchap_challenge()
180 chap->qid, hmac_name); in nvme_auth_process_dhchap_challenge()
185 if (chap->shash_tfm) { in nvme_auth_process_dhchap_challenge()
186 crypto_free_shash(chap->shash_tfm); in nvme_auth_process_dhchap_challenge()
187 chap->hash_id = 0; in nvme_auth_process_dhchap_challenge()
188 chap->hash_len = 0; in nvme_auth_process_dhchap_challenge()
190 chap->shash_tfm = crypto_alloc_shash(hmac_name, 0, in nvme_auth_process_dhchap_challenge()
192 if (IS_ERR(chap->shash_tfm)) { in nvme_auth_process_dhchap_challenge()
195 chap->qid, hmac_name, PTR_ERR(chap->shash_tfm)); in nvme_auth_process_dhchap_challenge()
196 chap->shash_tfm = NULL; in nvme_auth_process_dhchap_challenge()
197 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; in nvme_auth_process_dhchap_challenge()
201 if (crypto_shash_digestsize(chap->shash_tfm) != data->hl) { in nvme_auth_process_dhchap_challenge()
204 chap->qid, data->hl); in nvme_auth_process_dhchap_challenge()
205 crypto_free_shash(chap->shash_tfm); in nvme_auth_process_dhchap_challenge()
206 chap->shash_tfm = NULL; in nvme_auth_process_dhchap_challenge()
207 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE; in nvme_auth_process_dhchap_challenge()
211 chap->hash_id = data->hashid; in nvme_auth_process_dhchap_challenge()
212 chap->hash_len = data->hl; in nvme_auth_process_dhchap_challenge()
214 chap->qid, hmac_name); in nvme_auth_process_dhchap_challenge()
221 chap->qid, data->dhgid); in nvme_auth_process_dhchap_challenge()
222 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE; in nvme_auth_process_dhchap_challenge()
227 if (chap->dhgroup_id == data->dhgid && in nvme_auth_process_dhchap_challenge()
228 (data->dhgid == NVME_AUTH_DHGROUP_NULL || chap->dh_tfm)) { in nvme_auth_process_dhchap_challenge()
231 chap->qid, gid_name); in nvme_auth_process_dhchap_challenge()
236 if (chap->dh_tfm) { in nvme_auth_process_dhchap_challenge()
237 crypto_free_kpp(chap->dh_tfm); in nvme_auth_process_dhchap_challenge()
238 chap->dh_tfm = NULL; in nvme_auth_process_dhchap_challenge()
245 chap->qid); in nvme_auth_process_dhchap_challenge()
246 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE; in nvme_auth_process_dhchap_challenge()
250 chap->dh_tfm = crypto_alloc_kpp(kpp_name, 0, 0); in nvme_auth_process_dhchap_challenge()
251 if (IS_ERR(chap->dh_tfm)) { in nvme_auth_process_dhchap_challenge()
252 int ret = PTR_ERR(chap->dh_tfm); in nvme_auth_process_dhchap_challenge()
256 chap->qid, ret, gid_name); in nvme_auth_process_dhchap_challenge()
257 chap->status = NVME_AUTH_DHCHAP_FAILURE_DHGROUP_UNUSABLE; in nvme_auth_process_dhchap_challenge()
258 chap->dh_tfm = NULL; in nvme_auth_process_dhchap_challenge()
262 chap->qid, gid_name); in nvme_auth_process_dhchap_challenge()
266 chap->qid); in nvme_auth_process_dhchap_challenge()
267 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_process_dhchap_challenge()
270 chap->dhgroup_id = data->dhgid; in nvme_auth_process_dhchap_challenge()
273 chap->s1 = le32_to_cpu(data->seqnum); in nvme_auth_process_dhchap_challenge()
274 memcpy(chap->c1, data->cval, chap->hash_len); in nvme_auth_process_dhchap_challenge()
276 chap->ctrl_key = kmalloc(dhvlen, GFP_KERNEL); in nvme_auth_process_dhchap_challenge()
277 if (!chap->ctrl_key) { in nvme_auth_process_dhchap_challenge()
278 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; in nvme_auth_process_dhchap_challenge()
281 chap->ctrl_key_len = dhvlen; in nvme_auth_process_dhchap_challenge()
282 memcpy(chap->ctrl_key, data->cval + chap->hash_len, in nvme_auth_process_dhchap_challenge()
285 (int)chap->ctrl_key_len, chap->ctrl_key); in nvme_auth_process_dhchap_challenge()
292 struct nvme_dhchap_queue_context *chap) in nvme_auth_set_dhchap_reply_data() argument
294 struct nvmf_auth_dhchap_reply_data *data = chap->buf; in nvme_auth_set_dhchap_reply_data()
297 size += 2 * chap->hash_len; in nvme_auth_set_dhchap_reply_data()
299 if (chap->host_key_len) in nvme_auth_set_dhchap_reply_data()
300 size += chap->host_key_len; in nvme_auth_set_dhchap_reply_data()
303 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_set_dhchap_reply_data()
307 memset(chap->buf, 0, size); in nvme_auth_set_dhchap_reply_data()
310 data->t_id = cpu_to_le16(chap->transaction); in nvme_auth_set_dhchap_reply_data()
311 data->hl = chap->hash_len; in nvme_auth_set_dhchap_reply_data()
312 data->dhvlen = cpu_to_le16(chap->host_key_len); in nvme_auth_set_dhchap_reply_data()
313 memcpy(data->rval, chap->response, chap->hash_len); in nvme_auth_set_dhchap_reply_data()
315 get_random_bytes(chap->c2, chap->hash_len); in nvme_auth_set_dhchap_reply_data()
317 chap->s2 = nvme_auth_get_seqnum(); in nvme_auth_set_dhchap_reply_data()
318 memcpy(data->rval + chap->hash_len, chap->c2, in nvme_auth_set_dhchap_reply_data()
319 chap->hash_len); in nvme_auth_set_dhchap_reply_data()
321 __func__, chap->qid, (int)chap->hash_len, chap->c2); in nvme_auth_set_dhchap_reply_data()
323 memset(chap->c2, 0, chap->hash_len); in nvme_auth_set_dhchap_reply_data()
324 chap->s2 = 0; in nvme_auth_set_dhchap_reply_data()
326 data->seqnum = cpu_to_le32(chap->s2); in nvme_auth_set_dhchap_reply_data()
327 if (chap->host_key_len) { in nvme_auth_set_dhchap_reply_data()
329 __func__, chap->qid, in nvme_auth_set_dhchap_reply_data()
330 chap->host_key_len, chap->host_key); in nvme_auth_set_dhchap_reply_data()
331 memcpy(data->rval + 2 * chap->hash_len, chap->host_key, in nvme_auth_set_dhchap_reply_data()
332 chap->host_key_len); in nvme_auth_set_dhchap_reply_data()
339 struct nvme_dhchap_queue_context *chap) in nvme_auth_process_dhchap_success1() argument
341 struct nvmf_auth_dhchap_success1_data *data = chap->buf; in nvme_auth_process_dhchap_success1()
344 if (chap->s2) in nvme_auth_process_dhchap_success1()
345 size += chap->hash_len; in nvme_auth_process_dhchap_success1()
348 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_process_dhchap_success1()
352 if (data->hl != chap->hash_len) { in nvme_auth_process_dhchap_success1()
355 chap->qid, data->hl); in nvme_auth_process_dhchap_success1()
356 chap->status = NVME_AUTH_DHCHAP_FAILURE_HASH_UNUSABLE; in nvme_auth_process_dhchap_success1()
361 if (chap->qid == 0) in nvme_auth_process_dhchap_success1()
364 nvme_auth_hmac_name(chap->hash_id), in nvme_auth_process_dhchap_success1()
365 nvme_auth_dhgroup_name(chap->dhgroup_id)); in nvme_auth_process_dhchap_success1()
371 if (memcmp(chap->response, data->rval, data->hl)) { in nvme_auth_process_dhchap_success1()
373 __func__, chap->qid, (int)chap->hash_len, data->rval); in nvme_auth_process_dhchap_success1()
375 __func__, chap->qid, (int)chap->hash_len, in nvme_auth_process_dhchap_success1()
376 chap->response); in nvme_auth_process_dhchap_success1()
379 chap->qid); in nvme_auth_process_dhchap_success1()
380 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; in nvme_auth_process_dhchap_success1()
385 if (chap->qid == 0) in nvme_auth_process_dhchap_success1()
392 struct nvme_dhchap_queue_context *chap) in nvme_auth_set_dhchap_success2_data() argument
394 struct nvmf_auth_dhchap_success2_data *data = chap->buf; in nvme_auth_set_dhchap_success2_data()
397 memset(chap->buf, 0, size); in nvme_auth_set_dhchap_success2_data()
400 data->t_id = cpu_to_le16(chap->transaction); in nvme_auth_set_dhchap_success2_data()
406 struct nvme_dhchap_queue_context *chap) in nvme_auth_set_dhchap_failure2_data() argument
408 struct nvmf_auth_dhchap_failure_data *data = chap->buf; in nvme_auth_set_dhchap_failure2_data()
411 memset(chap->buf, 0, size); in nvme_auth_set_dhchap_failure2_data()
414 data->t_id = cpu_to_le16(chap->transaction); in nvme_auth_set_dhchap_failure2_data()
416 data->rescode_exp = chap->status; in nvme_auth_set_dhchap_failure2_data()
422 struct nvme_dhchap_queue_context *chap) in nvme_auth_dhchap_setup_host_response() argument
424 SHASH_DESC_ON_STACK(shash, chap->shash_tfm); in nvme_auth_dhchap_setup_host_response()
425 u8 buf[4], *challenge = chap->c1; in nvme_auth_dhchap_setup_host_response()
429 __func__, chap->qid, chap->s1, chap->transaction); in nvme_auth_dhchap_setup_host_response()
431 if (!chap->host_response) { in nvme_auth_dhchap_setup_host_response()
432 chap->host_response = nvme_auth_transform_key(ctrl->host_key, in nvme_auth_dhchap_setup_host_response()
434 if (IS_ERR(chap->host_response)) { in nvme_auth_dhchap_setup_host_response()
435 ret = PTR_ERR(chap->host_response); in nvme_auth_dhchap_setup_host_response()
436 chap->host_response = NULL; in nvme_auth_dhchap_setup_host_response()
441 __func__, chap->qid); in nvme_auth_dhchap_setup_host_response()
444 ret = crypto_shash_setkey(chap->shash_tfm, in nvme_auth_dhchap_setup_host_response()
445 chap->host_response, ctrl->host_key->len); in nvme_auth_dhchap_setup_host_response()
448 chap->qid, ret); in nvme_auth_dhchap_setup_host_response()
452 if (chap->dh_tfm) { in nvme_auth_dhchap_setup_host_response()
453 challenge = kmalloc(chap->hash_len, GFP_KERNEL); in nvme_auth_dhchap_setup_host_response()
458 ret = nvme_auth_augmented_challenge(chap->hash_id, in nvme_auth_dhchap_setup_host_response()
459 chap->sess_key, in nvme_auth_dhchap_setup_host_response()
460 chap->sess_key_len, in nvme_auth_dhchap_setup_host_response()
461 chap->c1, challenge, in nvme_auth_dhchap_setup_host_response()
462 chap->hash_len); in nvme_auth_dhchap_setup_host_response()
467 shash->tfm = chap->shash_tfm; in nvme_auth_dhchap_setup_host_response()
471 ret = crypto_shash_update(shash, challenge, chap->hash_len); in nvme_auth_dhchap_setup_host_response()
474 put_unaligned_le32(chap->s1, buf); in nvme_auth_dhchap_setup_host_response()
478 put_unaligned_le16(chap->transaction, buf); in nvme_auth_dhchap_setup_host_response()
500 ret = crypto_shash_final(shash, chap->response); in nvme_auth_dhchap_setup_host_response()
502 if (challenge != chap->c1) in nvme_auth_dhchap_setup_host_response()
508 struct nvme_dhchap_queue_context *chap) in nvme_auth_dhchap_setup_ctrl_response() argument
510 SHASH_DESC_ON_STACK(shash, chap->shash_tfm); in nvme_auth_dhchap_setup_ctrl_response()
512 u8 buf[4], *challenge = chap->c2; in nvme_auth_dhchap_setup_ctrl_response()
522 ret = crypto_shash_setkey(chap->shash_tfm, in nvme_auth_dhchap_setup_ctrl_response()
526 chap->qid, ret); in nvme_auth_dhchap_setup_ctrl_response()
530 if (chap->dh_tfm) { in nvme_auth_dhchap_setup_ctrl_response()
531 challenge = kmalloc(chap->hash_len, GFP_KERNEL); in nvme_auth_dhchap_setup_ctrl_response()
536 ret = nvme_auth_augmented_challenge(chap->hash_id, in nvme_auth_dhchap_setup_ctrl_response()
537 chap->sess_key, in nvme_auth_dhchap_setup_ctrl_response()
538 chap->sess_key_len, in nvme_auth_dhchap_setup_ctrl_response()
539 chap->c2, challenge, in nvme_auth_dhchap_setup_ctrl_response()
540 chap->hash_len); in nvme_auth_dhchap_setup_ctrl_response()
545 __func__, chap->qid, chap->s2, chap->transaction); in nvme_auth_dhchap_setup_ctrl_response()
547 __func__, chap->qid, (int)chap->hash_len, challenge); in nvme_auth_dhchap_setup_ctrl_response()
549 __func__, chap->qid, ctrl->opts->subsysnqn); in nvme_auth_dhchap_setup_ctrl_response()
551 __func__, chap->qid, ctrl->opts->host->nqn); in nvme_auth_dhchap_setup_ctrl_response()
552 shash->tfm = chap->shash_tfm; in nvme_auth_dhchap_setup_ctrl_response()
556 ret = crypto_shash_update(shash, challenge, chap->hash_len); in nvme_auth_dhchap_setup_ctrl_response()
559 put_unaligned_le32(chap->s2, buf); in nvme_auth_dhchap_setup_ctrl_response()
563 put_unaligned_le16(chap->transaction, buf); in nvme_auth_dhchap_setup_ctrl_response()
585 ret = crypto_shash_final(shash, chap->response); in nvme_auth_dhchap_setup_ctrl_response()
587 if (challenge != chap->c2) in nvme_auth_dhchap_setup_ctrl_response()
594 struct nvme_dhchap_queue_context *chap) in nvme_auth_dhchap_exponential() argument
598 if (chap->host_key && chap->host_key_len) { in nvme_auth_dhchap_exponential()
600 "qid %d: reusing host key\n", chap->qid); in nvme_auth_dhchap_exponential()
603 ret = nvme_auth_gen_privkey(chap->dh_tfm, chap->dhgroup_id); in nvme_auth_dhchap_exponential()
605 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_dhchap_exponential()
609 chap->host_key_len = crypto_kpp_maxsize(chap->dh_tfm); in nvme_auth_dhchap_exponential()
611 chap->host_key = kzalloc(chap->host_key_len, GFP_KERNEL); in nvme_auth_dhchap_exponential()
612 if (!chap->host_key) { in nvme_auth_dhchap_exponential()
613 chap->host_key_len = 0; in nvme_auth_dhchap_exponential()
614 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; in nvme_auth_dhchap_exponential()
617 ret = nvme_auth_gen_pubkey(chap->dh_tfm, in nvme_auth_dhchap_exponential()
618 chap->host_key, chap->host_key_len); in nvme_auth_dhchap_exponential()
622 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_dhchap_exponential()
627 chap->sess_key_len = chap->host_key_len; in nvme_auth_dhchap_exponential()
628 chap->sess_key = kmalloc(chap->sess_key_len, GFP_KERNEL); in nvme_auth_dhchap_exponential()
629 if (!chap->sess_key) { in nvme_auth_dhchap_exponential()
630 chap->sess_key_len = 0; in nvme_auth_dhchap_exponential()
631 chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; in nvme_auth_dhchap_exponential()
635 ret = nvme_auth_gen_shared_secret(chap->dh_tfm, in nvme_auth_dhchap_exponential()
636 chap->ctrl_key, chap->ctrl_key_len, in nvme_auth_dhchap_exponential()
637 chap->sess_key, chap->sess_key_len); in nvme_auth_dhchap_exponential()
641 chap->status = NVME_AUTH_DHCHAP_FAILURE_INCORRECT_PAYLOAD; in nvme_auth_dhchap_exponential()
645 (int)chap->sess_key_len, chap->sess_key); in nvme_auth_dhchap_exponential()
649 static void nvme_auth_reset_dhchap(struct nvme_dhchap_queue_context *chap) in nvme_auth_reset_dhchap() argument
651 kfree_sensitive(chap->host_response); in nvme_auth_reset_dhchap()
652 chap->host_response = NULL; in nvme_auth_reset_dhchap()
653 kfree_sensitive(chap->host_key); in nvme_auth_reset_dhchap()
654 chap->host_key = NULL; in nvme_auth_reset_dhchap()
655 chap->host_key_len = 0; in nvme_auth_reset_dhchap()
656 kfree_sensitive(chap->ctrl_key); in nvme_auth_reset_dhchap()
657 chap->ctrl_key = NULL; in nvme_auth_reset_dhchap()
658 chap->ctrl_key_len = 0; in nvme_auth_reset_dhchap()
659 kfree_sensitive(chap->sess_key); in nvme_auth_reset_dhchap()
660 chap->sess_key = NULL; in nvme_auth_reset_dhchap()
661 chap->sess_key_len = 0; in nvme_auth_reset_dhchap()
662 chap->status = 0; in nvme_auth_reset_dhchap()
663 chap->error = 0; in nvme_auth_reset_dhchap()
664 chap->s1 = 0; in nvme_auth_reset_dhchap()
665 chap->s2 = 0; in nvme_auth_reset_dhchap()
666 chap->transaction = 0; in nvme_auth_reset_dhchap()
667 memset(chap->c1, 0, sizeof(chap->c1)); in nvme_auth_reset_dhchap()
668 memset(chap->c2, 0, sizeof(chap->c2)); in nvme_auth_reset_dhchap()
669 mempool_free(chap->buf, nvme_chap_buf_pool); in nvme_auth_reset_dhchap()
670 chap->buf = NULL; in nvme_auth_reset_dhchap()
673 static void nvme_auth_free_dhchap(struct nvme_dhchap_queue_context *chap) in nvme_auth_free_dhchap() argument
675 nvme_auth_reset_dhchap(chap); in nvme_auth_free_dhchap()
676 if (chap->shash_tfm) in nvme_auth_free_dhchap()
677 crypto_free_shash(chap->shash_tfm); in nvme_auth_free_dhchap()
678 if (chap->dh_tfm) in nvme_auth_free_dhchap()
679 crypto_free_kpp(chap->dh_tfm); in nvme_auth_free_dhchap()
684 struct nvme_dhchap_queue_context *chap = in nvme_queue_auth_work() local
686 struct nvme_ctrl *ctrl = chap->ctrl; in nvme_queue_auth_work()
694 chap->buf = mempool_alloc(nvme_chap_buf_pool, GFP_KERNEL); in nvme_queue_auth_work()
695 if (!chap->buf) { in nvme_queue_auth_work()
696 chap->error = -ENOMEM; in nvme_queue_auth_work()
700 chap->transaction = ctrl->transaction++; in nvme_queue_auth_work()
704 __func__, chap->qid); in nvme_queue_auth_work()
705 ret = nvme_auth_set_dhchap_negotiate_data(ctrl, chap); in nvme_queue_auth_work()
707 chap->error = ret; in nvme_queue_auth_work()
711 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); in nvme_queue_auth_work()
713 chap->error = ret; in nvme_queue_auth_work()
719 __func__, chap->qid); in nvme_queue_auth_work()
721 memset(chap->buf, 0, CHAP_BUF_SIZE); in nvme_queue_auth_work()
722 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, CHAP_BUF_SIZE, in nvme_queue_auth_work()
727 chap->qid, ret < 0 ? "error" : "nvme status", ret); in nvme_queue_auth_work()
728 chap->error = ret; in nvme_queue_auth_work()
731 ret = nvme_auth_receive_validate(ctrl, chap->qid, chap->buf, chap->transaction, in nvme_queue_auth_work()
734 chap->status = ret; in nvme_queue_auth_work()
735 chap->error = -ECONNREFUSED; in nvme_queue_auth_work()
739 ret = nvme_auth_process_dhchap_challenge(ctrl, chap); in nvme_queue_auth_work()
742 chap->error = ret; in nvme_queue_auth_work()
746 if (chap->ctrl_key_len) { in nvme_queue_auth_work()
749 __func__, chap->qid); in nvme_queue_auth_work()
750 ret = nvme_auth_dhchap_exponential(ctrl, chap); in nvme_queue_auth_work()
752 chap->error = ret; in nvme_queue_auth_work()
758 __func__, chap->qid); in nvme_queue_auth_work()
760 ret = nvme_auth_dhchap_setup_host_response(ctrl, chap); in nvme_queue_auth_work()
763 chap->error = ret; in nvme_queue_auth_work()
770 __func__, chap->qid); in nvme_queue_auth_work()
771 ret = nvme_auth_set_dhchap_reply_data(ctrl, chap); in nvme_queue_auth_work()
773 chap->error = ret; in nvme_queue_auth_work()
778 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); in nvme_queue_auth_work()
780 chap->error = ret; in nvme_queue_auth_work()
786 __func__, chap->qid); in nvme_queue_auth_work()
788 memset(chap->buf, 0, CHAP_BUF_SIZE); in nvme_queue_auth_work()
789 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, CHAP_BUF_SIZE, in nvme_queue_auth_work()
794 chap->qid, ret < 0 ? "error" : "nvme status", ret); in nvme_queue_auth_work()
795 chap->error = ret; in nvme_queue_auth_work()
798 ret = nvme_auth_receive_validate(ctrl, chap->qid, in nvme_queue_auth_work()
799 chap->buf, chap->transaction, in nvme_queue_auth_work()
802 chap->status = ret; in nvme_queue_auth_work()
803 chap->error = -ECONNREFUSED; in nvme_queue_auth_work()
811 __func__, chap->qid); in nvme_queue_auth_work()
812 ret = nvme_auth_dhchap_setup_ctrl_response(ctrl, chap); in nvme_queue_auth_work()
815 chap->error = ret; in nvme_queue_auth_work()
821 ret = nvme_auth_process_dhchap_success1(ctrl, chap); in nvme_queue_auth_work()
824 chap->error = -ECONNREFUSED; in nvme_queue_auth_work()
828 if (chap->s2) { in nvme_queue_auth_work()
831 __func__, chap->qid); in nvme_queue_auth_work()
832 tl = nvme_auth_set_dhchap_success2_data(ctrl, chap); in nvme_queue_auth_work()
833 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); in nvme_queue_auth_work()
835 chap->error = ret; in nvme_queue_auth_work()
838 chap->error = 0; in nvme_queue_auth_work()
844 __func__, chap->qid, chap->status); in nvme_queue_auth_work()
845 tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap); in nvme_queue_auth_work()
846 ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); in nvme_queue_auth_work()
851 if (ret && !chap->error) in nvme_queue_auth_work()
852 chap->error = ret; in nvme_queue_auth_work()
857 struct nvme_dhchap_queue_context *chap; in nvme_auth_negotiate() local
869 chap = &ctrl->dhchap_ctxs[qid]; in nvme_auth_negotiate()
870 cancel_work_sync(&chap->auth_work); in nvme_auth_negotiate()
871 queue_work(nvme_auth_wq, &chap->auth_work); in nvme_auth_negotiate()
878 struct nvme_dhchap_queue_context *chap; in nvme_auth_wait() local
881 chap = &ctrl->dhchap_ctxs[qid]; in nvme_auth_wait()
882 flush_work(&chap->auth_work); in nvme_auth_wait()
883 ret = chap->error; in nvme_auth_wait()
885 nvme_auth_reset_dhchap(chap); in nvme_auth_wait()
941 struct nvme_dhchap_queue_context *chap; in nvme_auth_init_ctrl() local
961 sizeof(*chap), GFP_KERNEL); in nvme_auth_init_ctrl()
968 chap = &ctrl->dhchap_ctxs[i]; in nvme_auth_init_ctrl()
969 chap->qid = i; in nvme_auth_init_ctrl()
970 chap->ctrl = ctrl; in nvme_auth_init_ctrl()
971 INIT_WORK(&chap->auth_work, nvme_queue_auth_work); in nvme_auth_init_ctrl()