emlxs_dhchap.c (291a2b48) | emlxs_dhchap.c (82527734) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 7 unchanged lines hidden (view full) --- 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2009 Emulex. All rights reserved. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 7 unchanged lines hidden (view full) --- 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright 2009 Emulex. All rights reserved. |
24 * Use is subject to License terms. | 24 * Use is subject to license terms. |
25 */ 26 | 25 */ 26 |
27 |
|
27#include <emlxs.h> 28 29#ifdef DHCHAP_SUPPORT 30 31#include <md5.h> 32#include <sha1.h> 33#ifdef S10 34#include <sha1_consts.h> --- 414 unchanged lines hidden (view full) --- 449 case NODE_STATE_AUTH_DISABLED: 450 node_dhc->nlp_authrsp_tmo = 0; 451 node_dhc->nlp_authrsp_tmocnt = 0; 452 emlxs_dhc_set_reauth_time(port, ndlp, DISABLE); 453 break; 454 455 case NODE_STATE_AUTH_SUCCESS: 456 /* Record auth time */ | 28#include <emlxs.h> 29 30#ifdef DHCHAP_SUPPORT 31 32#include <md5.h> 33#include <sha1.h> 34#ifdef S10 35#include <sha1_consts.h> --- 414 unchanged lines hidden (view full) --- 450 case NODE_STATE_AUTH_DISABLED: 451 node_dhc->nlp_authrsp_tmo = 0; 452 node_dhc->nlp_authrsp_tmocnt = 0; 453 emlxs_dhc_set_reauth_time(port, ndlp, DISABLE); 454 break; 455 456 case NODE_STATE_AUTH_SUCCESS: 457 /* Record auth time */ |
457 if (ndlp->nlp_DID == Fabric_DID) { | 458 if (ndlp->nlp_DID == FABRIC_DID) { |
458 port_dhc->auth_time = DRV_TIME; 459 } else if (node_dhc->parent_auth_cfg) { 460 node_dhc->parent_auth_cfg->auth_time = DRV_TIME; 461 } 462 hba->rdn_flag = 0; 463 node_dhc->nlp_authrsp_tmo = 0; 464 465 if (node_dhc->flag & NLP_SET_REAUTH_TIME) { 466 emlxs_dhc_set_reauth_time(port, ndlp, ENABLE); 467 } 468 break; 469 470 default: 471 break; 472 } 473 474 /* Check for switch port */ | 459 port_dhc->auth_time = DRV_TIME; 460 } else if (node_dhc->parent_auth_cfg) { 461 node_dhc->parent_auth_cfg->auth_time = DRV_TIME; 462 } 463 hba->rdn_flag = 0; 464 node_dhc->nlp_authrsp_tmo = 0; 465 466 if (node_dhc->flag & NLP_SET_REAUTH_TIME) { 467 emlxs_dhc_set_reauth_time(port, ndlp, ENABLE); 468 } 469 break; 470 471 default: 472 break; 473 } 474 475 /* Check for switch port */ |
475 if (ndlp->nlp_DID == Fabric_DID) { | 476 if (ndlp->nlp_DID == FABRIC_DID) { |
476 switch (state) { 477 case NODE_STATE_UNKNOWN: 478 pstate = ELX_FABRIC_STATE_UNKNOWN; 479 break; 480 481 case NODE_STATE_AUTH_DISABLED: 482 pstate = ELX_FABRIC_AUTH_DISABLED; 483 break; --- 51 unchanged lines hidden (view full) --- 535 if (!ndlp || !ndlp->nlp_active || ndlp->node_dhc.state == 536 NODE_STATE_UNKNOWN) { 537 return; 538 } 539 port_dhc = &port->port_dhc; 540 node_dhc = &ndlp->node_dhc; 541 542 /* Get auth status object */ | 477 switch (state) { 478 case NODE_STATE_UNKNOWN: 479 pstate = ELX_FABRIC_STATE_UNKNOWN; 480 break; 481 482 case NODE_STATE_AUTH_DISABLED: 483 pstate = ELX_FABRIC_AUTH_DISABLED; 484 break; --- 51 unchanged lines hidden (view full) --- 536 if (!ndlp || !ndlp->nlp_active || ndlp->node_dhc.state == 537 NODE_STATE_UNKNOWN) { 538 return; 539 } 540 port_dhc = &port->port_dhc; 541 node_dhc = &ndlp->node_dhc; 542 543 /* Get auth status object */ |
543 if (ndlp->nlp_DID == Fabric_DID) { | 544 if (ndlp->nlp_DID == FABRIC_DID) { |
544 auth_status = &port_dhc->auth_status; 545 } else if (node_dhc->parent_auth_cfg) { 546 auth_status = &node_dhc->parent_auth_cfg->auth_status; 547 } else { 548 /* No auth status to be updated */ 549 return; 550 } 551 --- 461 unchanged lines hidden (view full) --- 1013 /* RCV_AUTH_MSG */ 1014 (void *) emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next, 1015 /* CMPL_AUTH_MSG */ 1016 1017}; /* emlxs_dhchap_action[] */ 1018 1019 1020extern int | 545 auth_status = &port_dhc->auth_status; 546 } else if (node_dhc->parent_auth_cfg) { 547 auth_status = &node_dhc->parent_auth_cfg->auth_status; 548 } else { 549 /* No auth status to be updated */ 550 return; 551 } 552 --- 461 unchanged lines hidden (view full) --- 1014 /* RCV_AUTH_MSG */ 1015 (void *) emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next, 1016 /* CMPL_AUTH_MSG */ 1017 1018}; /* emlxs_dhchap_action[] */ 1019 1020 1021extern int |
1021emlxs_dhchap_state_machine(emlxs_port_t *port, RING *rp, | 1022emlxs_dhchap_state_machine(emlxs_port_t *port, CHANNEL *cp, |
1022 IOCBQ *iocbq, MATCHMAP *mp, 1023 NODELIST *ndlp, int evt) 1024{ 1025 emlxs_hba_t *hba = HBA; 1026 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1027 uint32_t rc; | 1023 IOCBQ *iocbq, MATCHMAP *mp, 1024 NODELIST *ndlp, int evt) 1025{ 1026 emlxs_hba_t *hba = HBA; 1027 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1028 uint32_t rc; |
1028 uint32_t(*func) (emlxs_port_t *, RING *, IOCBQ *, MATCHMAP *, | 1029 uint32_t(*func) (emlxs_port_t *, CHANNEL *, IOCBQ *, MATCHMAP *, |
1029 NODELIST *, uint32_t); 1030 1031 mutex_enter(&hba->dhc_lock); 1032 1033 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_event_msg, 1034 "%s: did=0x%x", 1035 emlxs_dhc_event_xlate(evt), ndlp->nlp_DID); 1036 1037 node_dhc->disc_refcnt++; 1038 | 1030 NODELIST *, uint32_t); 1031 1032 mutex_enter(&hba->dhc_lock); 1033 1034 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_event_msg, 1035 "%s: did=0x%x", 1036 emlxs_dhc_event_xlate(evt), ndlp->nlp_DID); 1037 1038 node_dhc->disc_refcnt++; 1039 |
1039 func = (uint32_t(*) (emlxs_port_t *, RING *, IOCBQ *, MATCHMAP *, | 1040 func = (uint32_t(*) (emlxs_port_t *, CHANNEL *, IOCBQ *, MATCHMAP *, |
1040 NODELIST *, uint32_t)) 1041 emlxs_dhchap_action[(node_dhc->state * NODE_EVENT_MAX_EVENT) + evt]; 1042 | 1041 NODELIST *, uint32_t)) 1042 emlxs_dhchap_action[(node_dhc->state * NODE_EVENT_MAX_EVENT) + evt]; 1043 |
1043 rc = (func) (port, rp, iocbq, mp, ndlp, evt); | 1044 rc = (func) (port, cp, iocbq, mp, ndlp, evt); |
1044 1045 node_dhc->disc_refcnt--; 1046 1047 mutex_exit(&hba->dhc_lock); 1048 1049 return (rc); 1050 1051} /* emlxs_dhchap_state_machine() */ 1052 1053/* ARGSUSED */ 1054static uint32_t 1055emlxs_disc_neverdev( 1056emlxs_port_t *port, | 1045 1046 node_dhc->disc_refcnt--; 1047 1048 mutex_exit(&hba->dhc_lock); 1049 1050 return (rc); 1051 1052} /* emlxs_dhchap_state_machine() */ 1053 1054/* ARGSUSED */ 1055static uint32_t 1056emlxs_disc_neverdev( 1057emlxs_port_t *port, |
1057/* RING * rp, */ void *arg1, | 1058/* CHANNEL * rp, */ void *arg1, |
1058/* IOCBQ * iocbq, */ void *arg2, 1059/* MATCHMAP * mp, */ void *arg3, 1060/* NODELIST * ndlp */ void *arg4, 1061uint32_t evt) 1062{ 1063 NODELIST *ndlp = (NODELIST *) arg4; 1064 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1065 --- 125 unchanged lines hidden (view full) --- 1191 DHCHAP_SUCCESS_HDR *ap; 1192 uint8_t *tmp; 1193 uint32_t len; 1194 uint32_t ret; 1195 1196 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 1197 "emlxs_issue_dhchap_success: did=0x%x", ndlp->nlp_DID); 1198 | 1059/* IOCBQ * iocbq, */ void *arg2, 1060/* MATCHMAP * mp, */ void *arg3, 1061/* NODELIST * ndlp */ void *arg4, 1062uint32_t evt) 1063{ 1064 NODELIST *ndlp = (NODELIST *) arg4; 1065 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1066 --- 125 unchanged lines hidden (view full) --- 1192 DHCHAP_SUCCESS_HDR *ap; 1193 uint8_t *tmp; 1194 uint32_t len; 1195 uint32_t ret; 1196 1197 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 1198 "emlxs_issue_dhchap_success: did=0x%x", ndlp->nlp_DID); 1199 |
1199 if (ndlp->nlp_DID == Fabric_DID) { | 1200 if (ndlp->nlp_DID == FABRIC_DID) { |
1200 if (node_dhc->nlp_auth_hashid == AUTH_MD5) 1201 len = MD5_LEN; 1202 else 1203 len = SHA1_LEN; 1204 } else { 1205 len = (node_dhc->nlp_auth_hashid == AUTH_MD5) ? 1206 MD5_LEN : SHA1_LEN; 1207 } --- 38 unchanged lines hidden (view full) --- 1246 */ 1247 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 1248 "emlxs_issue_dhchap_success: 0x%x 0x%x 0x%x 0x%x 0x%x %p", 1249 ndlp->nlp_DID, node_dhc->nlp_auth_hashid, 1250 node_dhc->nlp_auth_tranid_rsp, 1251 node_dhc->nlp_auth_tranid_ini, cmdsize, rsp); 1252 1253 if (rsp == NULL) { | 1201 if (node_dhc->nlp_auth_hashid == AUTH_MD5) 1202 len = MD5_LEN; 1203 else 1204 len = SHA1_LEN; 1205 } else { 1206 len = (node_dhc->nlp_auth_hashid == AUTH_MD5) ? 1207 MD5_LEN : SHA1_LEN; 1208 } --- 38 unchanged lines hidden (view full) --- 1247 */ 1248 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 1249 "emlxs_issue_dhchap_success: 0x%x 0x%x 0x%x 0x%x 0x%x %p", 1250 ndlp->nlp_DID, node_dhc->nlp_auth_hashid, 1251 node_dhc->nlp_auth_tranid_rsp, 1252 node_dhc->nlp_auth_tranid_ini, cmdsize, rsp); 1253 1254 if (rsp == NULL) { |
1254 ap->msg_len = SWAP_DATA32(0x00000004); | 1255 ap->msg_len = LE_SWAP32(0x00000004); |
1255 ap->RspVal_len = 0x0; 1256 1257 node_dhc->fc_dhchap_success_expected = 0; 1258 } else { 1259 node_dhc->fc_dhchap_success_expected = 1; 1260 | 1256 ap->RspVal_len = 0x0; 1257 1258 node_dhc->fc_dhchap_success_expected = 0; 1259 } else { 1260 node_dhc->fc_dhchap_success_expected = 1; 1261 |
1261 ap->msg_len = SWAP_DATA32(4 + len); | 1262 ap->msg_len = LE_SWAP32(4 + len); |
1262 1263 tmp += sizeof (DHCHAP_SUCCESS_HDR) - sizeof (uint32_t); | 1263 1264 tmp += sizeof (DHCHAP_SUCCESS_HDR) - sizeof (uint32_t); |
1264 *(uint32_t *)tmp = SWAP_DATA32(len); | 1265 *(uint32_t *)tmp = LE_SWAP32(len); |
1265 tmp += sizeof (uint32_t); 1266 bcopy((void *)rsp, (void *)tmp, len); 1267 } 1268 1269 if (node_dhc->nlp_reauth_status == NLP_HOST_REAUTH_IN_PROGRESS) { | 1266 tmp += sizeof (uint32_t); 1267 bcopy((void *)rsp, (void *)tmp, len); 1268 } 1269 1270 if (node_dhc->nlp_reauth_status == NLP_HOST_REAUTH_IN_PROGRESS) { |
1270 ap->tran_id = SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1271 ap->tran_id = LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1271 } else { 1272 if (node_dhc->nlp_auth_flag == 2) { 1273 ap->tran_id = | 1272 } else { 1273 if (node_dhc->nlp_auth_flag == 2) { 1274 ap->tran_id = |
1274 SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1275 LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1275 } else if (node_dhc->nlp_auth_flag == 1) { 1276 ap->tran_id = | 1276 } else if (node_dhc->nlp_auth_flag == 1) { 1277 ap->tran_id = |
1277 SWAP_DATA32(node_dhc->nlp_auth_tranid_ini); | 1278 LE_SWAP32(node_dhc->nlp_auth_tranid_ini); |
1278 } else { 1279 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_debug_msg, 1280 "emlxs_is_dhch_success: (1) 0x%x 0x%x 0x%x 0x%x", 1281 ndlp->nlp_DID, node_dhc->nlp_auth_flag, 1282 node_dhc->nlp_auth_tranid_rsp, 1283 node_dhc->nlp_auth_tranid_ini); 1284 1285 return (1); --- 105 unchanged lines hidden (view full) --- 1391 1392 return (1); 1393 } 1394 ap = (AUTH_RJT *) pkt->pkt_cmd; 1395 ap->auth_els_code = ELS_CMD_AUTH_CODE; 1396 ap->auth_els_flags = 0x0; 1397 ap->auth_msg_code = AUTH_REJECT; 1398 ap->proto_version = 0x01; | 1279 } else { 1280 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_debug_msg, 1281 "emlxs_is_dhch_success: (1) 0x%x 0x%x 0x%x 0x%x", 1282 ndlp->nlp_DID, node_dhc->nlp_auth_flag, 1283 node_dhc->nlp_auth_tranid_rsp, 1284 node_dhc->nlp_auth_tranid_ini); 1285 1286 return (1); --- 105 unchanged lines hidden (view full) --- 1392 1393 return (1); 1394 } 1395 ap = (AUTH_RJT *) pkt->pkt_cmd; 1396 ap->auth_els_code = ELS_CMD_AUTH_CODE; 1397 ap->auth_els_flags = 0x0; 1398 ap->auth_msg_code = AUTH_REJECT; 1399 ap->proto_version = 0x01; |
1399 ap->msg_len = SWAP_DATA32(4); | 1400 ap->msg_len = LE_SWAP32(4); |
1400 1401 if (node_dhc->nlp_auth_flag == 2) { | 1401 1402 if (node_dhc->nlp_auth_flag == 2) { |
1402 ap->tran_id = SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1403 ap->tran_id = LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1403 } else if (node_dhc->nlp_auth_flag == 1) { | 1404 } else if (node_dhc->nlp_auth_flag == 1) { |
1404 ap->tran_id = SWAP_DATA32(node_dhc->nlp_auth_tranid_ini); | 1405 ap->tran_id = LE_SWAP32(node_dhc->nlp_auth_tranid_ini); |
1405 } else { 1406 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 1407 "Auth reject failed.Invalid flag=%d. 0x%x %x expl=%x", 1408 ndlp->nlp_DID, node_dhc->nlp_auth_flag, ReasonCode, 1409 ReasonCodeExplanation); 1410 1411 emlxs_pkt_free(pkt); 1412 --- 45 unchanged lines hidden (view full) --- 1458 if (!(pkt = emlxs_pkt_alloc(port, cmd_size, rsp_size, 1459 datalen, sleepflag))) { 1460 return (NULL); 1461 } 1462 pkt->pkt_tran_type = FC_PKT_EXCHANGE; 1463 pkt->pkt_timeout = 35; 1464 1465 /* Build the fc header */ | 1406 } else { 1407 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 1408 "Auth reject failed.Invalid flag=%d. 0x%x %x expl=%x", 1409 ndlp->nlp_DID, node_dhc->nlp_auth_flag, ReasonCode, 1410 ReasonCodeExplanation); 1411 1412 emlxs_pkt_free(pkt); 1413 --- 45 unchanged lines hidden (view full) --- 1459 if (!(pkt = emlxs_pkt_alloc(port, cmd_size, rsp_size, 1460 datalen, sleepflag))) { 1461 return (NULL); 1462 } 1463 pkt->pkt_tran_type = FC_PKT_EXCHANGE; 1464 pkt->pkt_timeout = 35; 1465 1466 /* Build the fc header */ |
1466 pkt->pkt_cmd_fhdr.d_id = SWAP_DATA24_LO(d_id); | 1467 pkt->pkt_cmd_fhdr.d_id = LE_SWAP24_LO(d_id); |
1467 pkt->pkt_cmd_fhdr.r_ctl = R_CTL_ELS_REQ; | 1468 pkt->pkt_cmd_fhdr.r_ctl = R_CTL_ELS_REQ; |
1468 pkt->pkt_cmd_fhdr.s_id = SWAP_DATA24_LO(port->did); | 1469 pkt->pkt_cmd_fhdr.s_id = LE_SWAP24_LO(port->did); |
1469 pkt->pkt_cmd_fhdr.type = FC_TYPE_EXTENDED_LS; 1470 pkt->pkt_cmd_fhdr.f_ctl = 1471 F_CTL_FIRST_SEQ | F_CTL_END_SEQ | F_CTL_SEQ_INITIATIVE; 1472 pkt->pkt_cmd_fhdr.seq_id = 0; 1473 pkt->pkt_cmd_fhdr.df_ctl = 0; 1474 pkt->pkt_cmd_fhdr.seq_cnt = 0; 1475 pkt->pkt_cmd_fhdr.ox_id = 0xFFFF; 1476 pkt->pkt_cmd_fhdr.rx_id = 0xFFFF; --- 154 unchanged lines hidden (view full) --- 1631 /* Fill in AUTH_MSG_NEGOT payload */ 1632 if (flag == 1) { 1633 if (hash_wcnt == 1) { 1634 ap1 = (AUTH_MSG_NEGOT_1 *)pkt->pkt_cmd; 1635 ap1->auth_els_code = ELS_CMD_AUTH_CODE; 1636 ap1->auth_els_flags = 0x00; 1637 ap1->auth_msg_code = AUTH_NEGOTIATE; 1638 ap1->proto_version = 0x01; | 1470 pkt->pkt_cmd_fhdr.type = FC_TYPE_EXTENDED_LS; 1471 pkt->pkt_cmd_fhdr.f_ctl = 1472 F_CTL_FIRST_SEQ | F_CTL_END_SEQ | F_CTL_SEQ_INITIATIVE; 1473 pkt->pkt_cmd_fhdr.seq_id = 0; 1474 pkt->pkt_cmd_fhdr.df_ctl = 0; 1475 pkt->pkt_cmd_fhdr.seq_cnt = 0; 1476 pkt->pkt_cmd_fhdr.ox_id = 0xFFFF; 1477 pkt->pkt_cmd_fhdr.rx_id = 0xFFFF; --- 154 unchanged lines hidden (view full) --- 1632 /* Fill in AUTH_MSG_NEGOT payload */ 1633 if (flag == 1) { 1634 if (hash_wcnt == 1) { 1635 ap1 = (AUTH_MSG_NEGOT_1 *)pkt->pkt_cmd; 1636 ap1->auth_els_code = ELS_CMD_AUTH_CODE; 1637 ap1->auth_els_flags = 0x00; 1638 ap1->auth_msg_code = AUTH_NEGOTIATE; 1639 ap1->proto_version = 0x01; |
1639 ap1->msg_len = SWAP_DATA32(cmdsize - | 1640 ap1->msg_len = LE_SWAP32(cmdsize - |
1640 sizeof (AUTH_MSG_NEGOT_NULL)); 1641 } else { 1642 ap2 = (AUTH_MSG_NEGOT_2 *)pkt->pkt_cmd; 1643 ap2->auth_els_code = ELS_CMD_AUTH_CODE; 1644 ap2->auth_els_flags = 0x00; 1645 ap2->auth_msg_code = AUTH_NEGOTIATE; 1646 ap2->proto_version = 0x01; | 1641 sizeof (AUTH_MSG_NEGOT_NULL)); 1642 } else { 1643 ap2 = (AUTH_MSG_NEGOT_2 *)pkt->pkt_cmd; 1644 ap2->auth_els_code = ELS_CMD_AUTH_CODE; 1645 ap2->auth_els_flags = 0x00; 1646 ap2->auth_msg_code = AUTH_NEGOTIATE; 1647 ap2->proto_version = 0x01; |
1647 ap2->msg_len = SWAP_DATA32(cmdsize - | 1648 ap2->msg_len = LE_SWAP32(cmdsize - |
1648 sizeof (AUTH_MSG_NEGOT_NULL)); 1649 } 1650 } else { 1651 if (node_dhc->auth_cfg.hash_priority[1] == 0x00) { 1652 null_ap1 = (AUTH_MSG_NEGOT_NULL_1 *)pkt->pkt_cmd; 1653 null_ap1->auth_els_code = ELS_CMD_AUTH_CODE; 1654 null_ap1->auth_els_flags = 0x0; 1655 null_ap1->auth_msg_code = AUTH_NEGOTIATE; 1656 null_ap1->proto_version = 0x01; | 1649 sizeof (AUTH_MSG_NEGOT_NULL)); 1650 } 1651 } else { 1652 if (node_dhc->auth_cfg.hash_priority[1] == 0x00) { 1653 null_ap1 = (AUTH_MSG_NEGOT_NULL_1 *)pkt->pkt_cmd; 1654 null_ap1->auth_els_code = ELS_CMD_AUTH_CODE; 1655 null_ap1->auth_els_flags = 0x0; 1656 null_ap1->auth_msg_code = AUTH_NEGOTIATE; 1657 null_ap1->proto_version = 0x01; |
1657 null_ap1->msg_len = SWAP_DATA32(cmdsize - | 1658 null_ap1->msg_len = LE_SWAP32(cmdsize - |
1658 sizeof (AUTH_MSG_NEGOT_NULL)); 1659 1660 } else { 1661 null_ap2 = (AUTH_MSG_NEGOT_NULL_2 *)pkt->pkt_cmd; 1662 null_ap2->auth_els_code = ELS_CMD_AUTH_CODE; 1663 null_ap2->auth_els_flags = 0x0; 1664 null_ap2->auth_msg_code = AUTH_NEGOTIATE; 1665 null_ap2->proto_version = 0x01; | 1659 sizeof (AUTH_MSG_NEGOT_NULL)); 1660 1661 } else { 1662 null_ap2 = (AUTH_MSG_NEGOT_NULL_2 *)pkt->pkt_cmd; 1663 null_ap2->auth_els_code = ELS_CMD_AUTH_CODE; 1664 null_ap2->auth_els_flags = 0x0; 1665 null_ap2->auth_msg_code = AUTH_NEGOTIATE; 1666 null_ap2->proto_version = 0x01; |
1666 null_ap2->msg_len = SWAP_DATA32(cmdsize - | 1667 null_ap2->msg_len = LE_SWAP32(cmdsize - |
1667 sizeof (AUTH_MSG_NEGOT_NULL)); 1668 } 1669 } 1670 1671 /* 1672 * For host reauthentication heart beat, the tran_id is incremented 1673 * by one for each heart beat being fired and round back to 1 when 1674 * 0xffffffff is reached. tran_id 0 is reserved as the initial linkup --- 12 unchanged lines hidden (view full) --- 1687 } 1688 } else { /* !NLP_HOST_REAUTH_IN_PROGRESS */ 1689 node_dhc->nlp_auth_tranid_rsp = 0; 1690 } 1691 1692 if (flag == 1) { 1693 if (hash_wcnt == 1) { 1694 ap1->tran_id = | 1668 sizeof (AUTH_MSG_NEGOT_NULL)); 1669 } 1670 } 1671 1672 /* 1673 * For host reauthentication heart beat, the tran_id is incremented 1674 * by one for each heart beat being fired and round back to 1 when 1675 * 0xffffffff is reached. tran_id 0 is reserved as the initial linkup --- 12 unchanged lines hidden (view full) --- 1688 } 1689 } else { /* !NLP_HOST_REAUTH_IN_PROGRESS */ 1690 node_dhc->nlp_auth_tranid_rsp = 0; 1691 } 1692 1693 if (flag == 1) { 1694 if (hash_wcnt == 1) { 1695 ap1->tran_id = |
1695 SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1696 LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1696 1697 ap1->params.name_tag = AUTH_NAME_ID; 1698 ap1->params.name_len = AUTH_NAME_LEN; 1699 bcopy((void *)&port->wwpn, 1700 (void *) &ap1->params.nodeName, sizeof (NAME_TYPE)); 1701 ap1->params.proto_num = AUTH_PROTO_NUM; | 1697 1698 ap1->params.name_tag = AUTH_NAME_ID; 1699 ap1->params.name_len = AUTH_NAME_LEN; 1700 bcopy((void *)&port->wwpn, 1701 (void *) &ap1->params.nodeName, sizeof (NAME_TYPE)); 1702 ap1->params.proto_num = AUTH_PROTO_NUM; |
1702 ap1->params.para_len = SWAP_DATA32(para_len); | 1703 ap1->params.para_len = LE_SWAP32(para_len); |
1703 ap1->params.proto_id = AUTH_DHCHAP; 1704 ap1->params.HashList_tag = HASH_LIST_TAG; | 1704 ap1->params.proto_id = AUTH_DHCHAP; 1705 ap1->params.HashList_tag = HASH_LIST_TAG; |
1705 ap1->params.HashList_wcnt = SWAP_DATA16(hash_wcnt); | 1706 ap1->params.HashList_wcnt = LE_SWAP16(hash_wcnt); |
1706 ap1->params.HashList_value1 = 1707 node_dhc->auth_cfg.hash_priority[0]; 1708 ap1->params.DHgIDList_tag = DHGID_LIST_TAG; | 1707 ap1->params.HashList_value1 = 1708 node_dhc->auth_cfg.hash_priority[0]; 1709 ap1->params.DHgIDList_tag = DHGID_LIST_TAG; |
1709 ap1->params.DHgIDList_wnt = SWAP_DATA16(dhgp_wcnt); | 1710 ap1->params.DHgIDList_wnt = LE_SWAP16(dhgp_wcnt); |
1710 1711 switch (dhgp_wcnt) { 1712 case 5: 1713 ap1->params.DHgIDList_g4 = 1714 (node_dhc->auth_cfg.dh_group_priority[4]); 1715 ap1->params.DHgIDList_g3 = 1716 (node_dhc->auth_cfg.dh_group_priority[3]); 1717 ap1->params.DHgIDList_g2 = --- 29 unchanged lines hidden (view full) --- 1747 break; 1748 case 1: 1749 ap1->params.DHgIDList_g0 = 1750 (node_dhc->auth_cfg.dh_group_priority[0]); 1751 break; 1752 } 1753 } else { 1754 ap2->tran_id = | 1711 1712 switch (dhgp_wcnt) { 1713 case 5: 1714 ap1->params.DHgIDList_g4 = 1715 (node_dhc->auth_cfg.dh_group_priority[4]); 1716 ap1->params.DHgIDList_g3 = 1717 (node_dhc->auth_cfg.dh_group_priority[3]); 1718 ap1->params.DHgIDList_g2 = --- 29 unchanged lines hidden (view full) --- 1748 break; 1749 case 1: 1750 ap1->params.DHgIDList_g0 = 1751 (node_dhc->auth_cfg.dh_group_priority[0]); 1752 break; 1753 } 1754 } else { 1755 ap2->tran_id = |
1755 SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1756 LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1756 1757 ap2->params.name_tag = AUTH_NAME_ID; 1758 ap2->params.name_len = AUTH_NAME_LEN; 1759 bcopy((void *) &port->wwpn, 1760 (void *) &ap2->params.nodeName, sizeof (NAME_TYPE)); 1761 ap2->params.proto_num = AUTH_PROTO_NUM; | 1757 1758 ap2->params.name_tag = AUTH_NAME_ID; 1759 ap2->params.name_len = AUTH_NAME_LEN; 1760 bcopy((void *) &port->wwpn, 1761 (void *) &ap2->params.nodeName, sizeof (NAME_TYPE)); 1762 ap2->params.proto_num = AUTH_PROTO_NUM; |
1762 ap2->params.para_len = SWAP_DATA32(para_len); | 1763 ap2->params.para_len = LE_SWAP32(para_len); |
1763 ap2->params.proto_id = AUTH_DHCHAP; 1764 ap2->params.HashList_tag = HASH_LIST_TAG; | 1764 ap2->params.proto_id = AUTH_DHCHAP; 1765 ap2->params.HashList_tag = HASH_LIST_TAG; |
1765 ap2->params.HashList_wcnt = SWAP_DATA16(hash_wcnt); | 1766 ap2->params.HashList_wcnt = LE_SWAP16(hash_wcnt); |
1766 ap2->params.HashList_value1 = 1767 (node_dhc->auth_cfg.hash_priority[0]); 1768 ap2->params.HashList_value2 = 1769 (node_dhc->auth_cfg.hash_priority[1]); 1770 1771 ap2->params.DHgIDList_tag = DHGID_LIST_TAG; | 1767 ap2->params.HashList_value1 = 1768 (node_dhc->auth_cfg.hash_priority[0]); 1769 ap2->params.HashList_value2 = 1770 (node_dhc->auth_cfg.hash_priority[1]); 1771 1772 ap2->params.DHgIDList_tag = DHGID_LIST_TAG; |
1772 ap2->params.DHgIDList_wnt = SWAP_DATA16(dhgp_wcnt); | 1773 ap2->params.DHgIDList_wnt = LE_SWAP16(dhgp_wcnt); |
1773 1774 switch (dhgp_wcnt) { 1775 case 5: 1776 ap2->params.DHgIDList_g4 = 1777 (node_dhc->auth_cfg.dh_group_priority[4]); 1778 ap2->params.DHgIDList_g3 = 1779 (node_dhc->auth_cfg.dh_group_priority[3]); 1780 ap2->params.DHgIDList_g2 = --- 31 unchanged lines hidden (view full) --- 1812 ap2->params.DHgIDList_g0 = 1813 (node_dhc->auth_cfg.dh_group_priority[0]); 1814 break; 1815 } 1816 } 1817 } else { 1818 if (num_hs == 1) { 1819 null_ap1->tran_id = | 1774 1775 switch (dhgp_wcnt) { 1776 case 5: 1777 ap2->params.DHgIDList_g4 = 1778 (node_dhc->auth_cfg.dh_group_priority[4]); 1779 ap2->params.DHgIDList_g3 = 1780 (node_dhc->auth_cfg.dh_group_priority[3]); 1781 ap2->params.DHgIDList_g2 = --- 31 unchanged lines hidden (view full) --- 1813 ap2->params.DHgIDList_g0 = 1814 (node_dhc->auth_cfg.dh_group_priority[0]); 1815 break; 1816 } 1817 } 1818 } else { 1819 if (num_hs == 1) { 1820 null_ap1->tran_id = |
1820 SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1821 LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1821 1822 null_ap1->params.name_tag = AUTH_NAME_ID; 1823 null_ap1->params.name_len = AUTH_NAME_LEN; 1824 bcopy((void *) &port->wwpn, 1825 (void *) &null_ap1->params.nodeName, 1826 sizeof (NAME_TYPE)); 1827 null_ap1->params.proto_num = AUTH_PROTO_NUM; | 1822 1823 null_ap1->params.name_tag = AUTH_NAME_ID; 1824 null_ap1->params.name_len = AUTH_NAME_LEN; 1825 bcopy((void *) &port->wwpn, 1826 (void *) &null_ap1->params.nodeName, 1827 sizeof (NAME_TYPE)); 1828 null_ap1->params.proto_num = AUTH_PROTO_NUM; |
1828 null_ap1->params.para_len = SWAP_DATA32(0x00000014); | 1829 null_ap1->params.para_len = LE_SWAP32(0x00000014); |
1829 null_ap1->params.proto_id = AUTH_DHCHAP; 1830 null_ap1->params.HashList_tag = HASH_LIST_TAG; | 1830 null_ap1->params.proto_id = AUTH_DHCHAP; 1831 null_ap1->params.HashList_tag = HASH_LIST_TAG; |
1831 null_ap1->params.HashList_wcnt = SWAP_DATA16(0x0001); | 1832 null_ap1->params.HashList_wcnt = LE_SWAP16(0x0001); |
1832 null_ap1->params.HashList_value1 = 1833 (node_dhc->auth_cfg.hash_priority[0]); 1834 null_ap1->params.DHgIDList_tag = DHGID_LIST_TAG; | 1833 null_ap1->params.HashList_value1 = 1834 (node_dhc->auth_cfg.hash_priority[0]); 1835 null_ap1->params.DHgIDList_tag = DHGID_LIST_TAG; |
1835 null_ap1->params.DHgIDList_wnt = SWAP_DATA16(0x0001); | 1836 null_ap1->params.DHgIDList_wnt = LE_SWAP16(0x0001); |
1836 null_ap1->params.DHgIDList_g0 = 0x0; 1837 } else { 1838 null_ap2->tran_id = | 1837 null_ap1->params.DHgIDList_g0 = 0x0; 1838 } else { 1839 null_ap2->tran_id = |
1839 SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 1840 LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
1840 1841 null_ap2->params.name_tag = AUTH_NAME_ID; 1842 null_ap2->params.name_len = AUTH_NAME_LEN; 1843 bcopy((void *) &port->wwpn, 1844 (void *) &null_ap2->params.nodeName, 1845 sizeof (NAME_TYPE)); 1846 null_ap2->params.proto_num = AUTH_PROTO_NUM; | 1841 1842 null_ap2->params.name_tag = AUTH_NAME_ID; 1843 null_ap2->params.name_len = AUTH_NAME_LEN; 1844 bcopy((void *) &port->wwpn, 1845 (void *) &null_ap2->params.nodeName, 1846 sizeof (NAME_TYPE)); 1847 null_ap2->params.proto_num = AUTH_PROTO_NUM; |
1847 null_ap2->params.para_len = SWAP_DATA32(0x00000018); | 1848 null_ap2->params.para_len = LE_SWAP32(0x00000018); |
1848 null_ap2->params.proto_id = AUTH_DHCHAP; 1849 1850 null_ap2->params.HashList_tag = HASH_LIST_TAG; | 1849 null_ap2->params.proto_id = AUTH_DHCHAP; 1850 1851 null_ap2->params.HashList_tag = HASH_LIST_TAG; |
1851 null_ap2->params.HashList_wcnt = SWAP_DATA16(0x0002); | 1852 null_ap2->params.HashList_wcnt = LE_SWAP16(0x0002); |
1852 null_ap2->params.HashList_value1 = 1853 (node_dhc->auth_cfg.hash_priority[0]); 1854 null_ap2->params.HashList_value2 = 1855 (node_dhc->auth_cfg.hash_priority[1]); 1856 1857 null_ap2->params.DHgIDList_tag = DHGID_LIST_TAG; | 1853 null_ap2->params.HashList_value1 = 1854 (node_dhc->auth_cfg.hash_priority[0]); 1855 null_ap2->params.HashList_value2 = 1856 (node_dhc->auth_cfg.hash_priority[1]); 1857 1858 null_ap2->params.DHgIDList_tag = DHGID_LIST_TAG; |
1858 null_ap2->params.DHgIDList_wnt = SWAP_DATA16(0x0001); | 1859 null_ap2->params.DHgIDList_wnt = LE_SWAP16(0x0001); |
1859 null_ap2->params.DHgIDList_g0 = 0x0; 1860 } 1861 } 1862 1863 pkt->pkt_comp = emlxs_cmpl_auth_negotiate_issue; 1864 1865 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_debug_msg, 1866 "issue_auth_negotiate: %x flag=%d size=%d hash=%x,%x tid=%x,%x", --- 74 unchanged lines hidden (view full) --- 1941 return; 1942 1943} /* emlxs_cmpl_auth_negotiate_issue */ 1944 1945 1946/* 1947 * ! emlxs_cmpl_auth_msg_auth_negotiate_issue 1948 * | 1860 null_ap2->params.DHgIDList_g0 = 0x0; 1861 } 1862 } 1863 1864 pkt->pkt_comp = emlxs_cmpl_auth_negotiate_issue; 1865 1866 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_debug_msg, 1867 "issue_auth_negotiate: %x flag=%d size=%d hash=%x,%x tid=%x,%x", --- 74 unchanged lines hidden (view full) --- 1942 return; 1943 1944} /* emlxs_cmpl_auth_negotiate_issue */ 1945 1946 1947/* 1948 * ! emlxs_cmpl_auth_msg_auth_negotiate_issue 1949 * |
1949 * \pre \post \param port \param RING * rp \param arg \param evt | 1950 * \pre \post \param port \param CHANNEL * rp \param arg \param evt |
1950 * \return uint32_t \b Description: 1951 * 1952 * This routine is invoked when the host receive the solicited ACC/RJT ELS 1953 * cmd from an NxPort or FxPort that has received the ELS 1954 * AUTH Negotiate msg from the host. in case of RJT, Auth_Negotiate should 1955 * be retried in emlxs_cmpl_auth_negotiate_issue 1956 * call. in case of ACC, the host must be the initiator because its current 1957 * state could be "AUTH_NEGOTIATE_RCV" if it is the 1958 * responder. Then the next stat = AUTH_NEGOTIATE_CMPL_WAIT4NEXT 1959 */ 1960/* ARGSUSED */ 1961static uint32_t 1962emlxs_cmpl_auth_msg_auth_negotiate_issue( 1963emlxs_port_t *port, | 1951 * \return uint32_t \b Description: 1952 * 1953 * This routine is invoked when the host receive the solicited ACC/RJT ELS 1954 * cmd from an NxPort or FxPort that has received the ELS 1955 * AUTH Negotiate msg from the host. in case of RJT, Auth_Negotiate should 1956 * be retried in emlxs_cmpl_auth_negotiate_issue 1957 * call. in case of ACC, the host must be the initiator because its current 1958 * state could be "AUTH_NEGOTIATE_RCV" if it is the 1959 * responder. Then the next stat = AUTH_NEGOTIATE_CMPL_WAIT4NEXT 1960 */ 1961/* ARGSUSED */ 1962static uint32_t 1963emlxs_cmpl_auth_msg_auth_negotiate_issue( 1964emlxs_port_t *port, |
1964/* RING * rp, */ void *arg1, | 1965/* CHANNEL * rp, */ void *arg1, |
1965/* IOCBQ * iocbq, */ void *arg2, 1966/* MATCHMAP * mp, */ void *arg3, 1967/* NODELIST * ndlp, */ void *arg4, 1968uint32_t evt) 1969{ 1970 NODELIST *ndlp = (NODELIST *)arg4; 1971 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1972 --- 46 unchanged lines hidden (view full) --- 2019 * its own transaction upon receipt of the AUTH_Reject message. The new state 2020 * will be "AUTH_NEGOTIATE_RCV" and mark the host as 2021 * auth_responder. 2022 */ 2023/* ARGSUSED */ 2024static uint32_t 2025emlxs_rcv_auth_msg_auth_negotiate_issue( 2026emlxs_port_t *port, | 1966/* IOCBQ * iocbq, */ void *arg2, 1967/* MATCHMAP * mp, */ void *arg3, 1968/* NODELIST * ndlp, */ void *arg4, 1969uint32_t evt) 1970{ 1971 NODELIST *ndlp = (NODELIST *)arg4; 1972 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 1973 --- 46 unchanged lines hidden (view full) --- 2020 * its own transaction upon receipt of the AUTH_Reject message. The new state 2021 * will be "AUTH_NEGOTIATE_RCV" and mark the host as 2022 * auth_responder. 2023 */ 2024/* ARGSUSED */ 2025static uint32_t 2026emlxs_rcv_auth_msg_auth_negotiate_issue( 2027emlxs_port_t *port, |
2027/* RING * rp, */ void *arg1, | 2028/* CHANNEL * rp, */ void *arg1, |
2028/* IOCBQ * iocbq, */ void *arg2, 2029/* MATCHMAP * mp, */ void *arg3, 2030/* NODELIST * ndlp */ void *arg4, 2031uint32_t evt) 2032{ 2033 NODELIST *ndlp = (NODELIST *)arg4; 2034 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 2035 IOCBQ *iocbq = (IOCBQ *) arg2; --- 180 unchanged lines hidden (view full) --- 2216 2217 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2218 "emlxs_issue_dhchap_challenge: 0x%x 0x%x 0x%x %d 0x%x 0x%x 0x%x", 2219 ndlp->nlp_DID, node_dhc->nlp_auth_tranid_ini, 2220 node_dhc->nlp_auth_tranid_rsp, 2221 cmdsize, tran_id, hash_id, dhgp_id); 2222 2223 /* store the tran_id : ndlp is the initiator */ | 2029/* IOCBQ * iocbq, */ void *arg2, 2030/* MATCHMAP * mp, */ void *arg3, 2031/* NODELIST * ndlp */ void *arg4, 2032uint32_t evt) 2033{ 2034 NODELIST *ndlp = (NODELIST *)arg4; 2035 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 2036 IOCBQ *iocbq = (IOCBQ *) arg2; --- 180 unchanged lines hidden (view full) --- 2217 2218 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2219 "emlxs_issue_dhchap_challenge: 0x%x 0x%x 0x%x %d 0x%x 0x%x 0x%x", 2220 ndlp->nlp_DID, node_dhc->nlp_auth_tranid_ini, 2221 node_dhc->nlp_auth_tranid_rsp, 2222 cmdsize, tran_id, hash_id, dhgp_id); 2223 2224 /* store the tran_id : ndlp is the initiator */ |
2224 node_dhc->nlp_auth_tranid_ini = SWAP_DATA32(tran_id); | 2225 node_dhc->nlp_auth_tranid_ini = LE_SWAP32(tran_id); |
2225 2226 tmp += sizeof (uint32_t); 2227 2228 chal = (DHCHAP_CHALL *)pCmd; 2229 chal->cnul.msg_hdr.auth_els_code = ELS_CMD_AUTH_CODE; 2230 chal->cnul.msg_hdr.auth_els_flags = 0x0; 2231 chal->cnul.msg_hdr.auth_msg_code = DHCHAP_CHALLENGE; 2232 chal->cnul.msg_hdr.proto_version = 0x01; | 2226 2227 tmp += sizeof (uint32_t); 2228 2229 chal = (DHCHAP_CHALL *)pCmd; 2230 chal->cnul.msg_hdr.auth_els_code = ELS_CMD_AUTH_CODE; 2231 chal->cnul.msg_hdr.auth_els_flags = 0x0; 2232 chal->cnul.msg_hdr.auth_msg_code = DHCHAP_CHALLENGE; 2233 chal->cnul.msg_hdr.proto_version = 0x01; |
2233 chal->cnul.msg_hdr.msg_len = SWAP_DATA32(cmdsize - 12); | 2234 chal->cnul.msg_hdr.msg_len = LE_SWAP32(cmdsize - 12); |
2234 chal->cnul.msg_hdr.tran_id = tran_id; 2235 chal->cnul.msg_hdr.name_tag = (AUTH_NAME_ID); 2236 chal->cnul.msg_hdr.name_len = (AUTH_NAME_LEN); 2237 2238 bcopy((void *) &port->wwpn, 2239 (void *) &chal->cnul.msg_hdr.nodeName, sizeof (NAME_TYPE)); 2240 2241 chal->cnul.hash_id = hash_id; 2242 chal->cnul.dhgp_id = dhgp_id; 2243 2244 chal->cnul.cval_len = ((chal->cnul.hash_id == AUTH_SHA1) ? | 2235 chal->cnul.msg_hdr.tran_id = tran_id; 2236 chal->cnul.msg_hdr.name_tag = (AUTH_NAME_ID); 2237 chal->cnul.msg_hdr.name_len = (AUTH_NAME_LEN); 2238 2239 bcopy((void *) &port->wwpn, 2240 (void *) &chal->cnul.msg_hdr.nodeName, sizeof (NAME_TYPE)); 2241 2242 chal->cnul.hash_id = hash_id; 2243 chal->cnul.dhgp_id = dhgp_id; 2244 2245 chal->cnul.cval_len = ((chal->cnul.hash_id == AUTH_SHA1) ? |
2245 SWAP_DATA32(SHA1_LEN) : SWAP_DATA32(MD5_LEN)); | 2246 LE_SWAP32(SHA1_LEN) : LE_SWAP32(MD5_LEN)); |
2246 2247 tmp = (uint8_t *)pCmd; 2248 tmp += sizeof (DHCHAP_CHALL_NULL); 2249 2250#ifdef RAND 2251 /* generate a random number as the challenge */ | 2247 2248 tmp = (uint8_t *)pCmd; 2249 tmp += sizeof (DHCHAP_CHALL_NULL); 2250 2251#ifdef RAND 2252 /* generate a random number as the challenge */ |
2252 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len)); | 2253 bzero(random_number, LE_SWAP32(chal->cnul.cval_len)); |
2253 2254 if (hba->rdn_flag == 1) { 2255 emlxs_get_random_bytes(ndlp, random_number, 20); 2256 } else { 2257 random_get_pseudo_bytes(random_number, | 2254 2255 if (hba->rdn_flag == 1) { 2256 emlxs_get_random_bytes(ndlp, random_number, 20); 2257 } else { 2258 random_get_pseudo_bytes(random_number, |
2258 SWAP_DATA32(chal->cnul.cval_len)); | 2259 LE_SWAP32(chal->cnul.cval_len)); |
2259 } 2260 2261 /* 2262 * the host should store the challenge for later usage when later on 2263 * host get the reply msg, host needs to verify it by using its old 2264 * challenge, its private key as the input to the hash function. the 2265 * challenge as the random_number should be stored in 2266 * node_dhc->hrsp_cval[] 2267 */ | 2260 } 2261 2262 /* 2263 * the host should store the challenge for later usage when later on 2264 * host get the reply msg, host needs to verify it by using its old 2265 * challenge, its private key as the input to the hash function. the 2266 * challenge as the random_number should be stored in 2267 * node_dhc->hrsp_cval[] 2268 */ |
2268 if (ndlp->nlp_DID == Fabric_DID) { | 2269 if (ndlp->nlp_DID == FABRIC_DID) { |
2269 bcopy((void *) &random_number[0], 2270 (void *) &node_dhc->hrsp_cval[0], | 2270 bcopy((void *) &random_number[0], 2271 (void *) &node_dhc->hrsp_cval[0], |
2271 SWAP_DATA32(chal->cnul.cval_len)); | 2272 LE_SWAP32(chal->cnul.cval_len)); |
2272 /* save another copy in partner's ndlp */ 2273 bcopy((void *) &random_number[0], 2274 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], | 2273 /* save another copy in partner's ndlp */ 2274 bcopy((void *) &random_number[0], 2275 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], |
2275 SWAP_DATA32(chal->cnul.cval_len)); | 2276 LE_SWAP32(chal->cnul.cval_len)); |
2276 } else { 2277 bcopy((void *) &random_number[0], 2278 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], | 2277 } else { 2278 bcopy((void *) &random_number[0], 2279 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], |
2279 SWAP_DATA32(chal->cnul.cval_len)); | 2280 LE_SWAP32(chal->cnul.cval_len)); |
2280 } 2281 bcopy((void *) &random_number[0], (void *) tmp, | 2281 } 2282 bcopy((void *) &random_number[0], (void *) tmp, |
2282 SWAP_DATA32(chal->cnul.cval_len)); | 2283 LE_SWAP32(chal->cnul.cval_len)); |
2283 2284#endif /* RAND */ 2285 2286 /* for test only hardcode the challenge value */ 2287#ifdef MYRAND | 2284 2285#endif /* RAND */ 2286 2287 /* for test only hardcode the challenge value */ 2288#ifdef MYRAND |
2288 if (ndlp->nlp_DID == Fabric_DID) { | 2289 if (ndlp->nlp_DID == FABRIC_DID) { |
2289 bcopy((void *) myrand, (void *) &node_dhc->hrsp_cval[0], | 2290 bcopy((void *) myrand, (void *) &node_dhc->hrsp_cval[0], |
2290 SWAP_DATA32(chal->cnul.cval_len)); | 2291 LE_SWAP32(chal->cnul.cval_len)); |
2291 /* save another copy in partner's ndlp */ 2292 bcopy((void *) myrand, 2293 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], | 2292 /* save another copy in partner's ndlp */ 2293 bcopy((void *) myrand, 2294 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], |
2294 SWAP_DATA32(chal->cnul.cval_len)); | 2295 LE_SWAP32(chal->cnul.cval_len)); |
2295 } else { 2296 bcopy((void *) myrand, 2297 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], | 2296 } else { 2297 bcopy((void *) myrand, 2298 (void *) &node_dhc->nlp_auth_misc.hrsp_cval[0], |
2298 SWAP_DATA32(chal->cnul.cval_len)); | 2299 LE_SWAP32(chal->cnul.cval_len)); |
2299 } 2300 bcopy((void *) myrand, (void *) tmp, | 2300 } 2301 bcopy((void *) myrand, (void *) tmp, |
2301 SWAP_DATA32(chal->cnul.cval_len)); | 2302 LE_SWAP32(chal->cnul.cval_len)); |
2302 2303#endif /* MYRAND */ 2304 | 2303 2304#endif /* MYRAND */ 2305 |
2305 if (ndlp->nlp_DID == Fabric_DID) { 2306 node_dhc->hrsp_cval_len = SWAP_DATA32(chal->cnul.cval_len); | 2306 if (ndlp->nlp_DID == FABRIC_DID) { 2307 node_dhc->hrsp_cval_len = LE_SWAP32(chal->cnul.cval_len); |
2307 node_dhc->nlp_auth_misc.hrsp_cval_len = | 2308 node_dhc->nlp_auth_misc.hrsp_cval_len = |
2308 SWAP_DATA32(chal->cnul.cval_len); | 2309 LE_SWAP32(chal->cnul.cval_len); |
2309 } else { 2310 node_dhc->nlp_auth_misc.hrsp_cval_len = | 2310 } else { 2311 node_dhc->nlp_auth_misc.hrsp_cval_len = |
2311 SWAP_DATA32(chal->cnul.cval_len); | 2312 LE_SWAP32(chal->cnul.cval_len); |
2312 } 2313 | 2313 } 2314 |
2314 tmp += SWAP_DATA32(chal->cnul.cval_len); | 2315 tmp += LE_SWAP32(chal->cnul.cval_len); |
2315 2316 /* 2317 * we need another random number as the private key x which will be 2318 * used to compute the public key i.e. g^x mod p we intentionally set 2319 * the length of private key as the same length of challenge. we have 2320 * to store the private key in node_dhc->hrsp_priv_key[20]. 2321 */ 2322#ifdef RAND 2323 2324 if (dhgp_id != GROUP_NULL) { 2325 | 2316 2317 /* 2318 * we need another random number as the private key x which will be 2319 * used to compute the public key i.e. g^x mod p we intentionally set 2320 * the length of private key as the same length of challenge. we have 2321 * to store the private key in node_dhc->hrsp_priv_key[20]. 2322 */ 2323#ifdef RAND 2324 2325 if (dhgp_id != GROUP_NULL) { 2326 |
2326 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len)); | 2327 bzero(random_number, LE_SWAP32(chal->cnul.cval_len)); |
2327 2328 if (hba->rdn_flag == 1) { 2329 emlxs_get_random_bytes(ndlp, random_number, 20); 2330 } else { 2331 random_get_pseudo_bytes(random_number, | 2328 2329 if (hba->rdn_flag == 1) { 2330 emlxs_get_random_bytes(ndlp, random_number, 20); 2331 } else { 2332 random_get_pseudo_bytes(random_number, |
2332 SWAP_DATA32(chal->cnul.cval_len)); | 2333 LE_SWAP32(chal->cnul.cval_len)); |
2333 } 2334 | 2334 } 2335 |
2335 if (ndlp->nlp_DID == Fabric_DID) { | 2336 if (ndlp->nlp_DID == FABRIC_DID) { |
2336 bcopy((void *) &random_number[0], 2337 (void *) node_dhc->hrsp_priv_key, | 2337 bcopy((void *) &random_number[0], 2338 (void *) node_dhc->hrsp_priv_key, |
2338 SWAP_DATA32(chal->cnul.cval_len)); | 2339 LE_SWAP32(chal->cnul.cval_len)); |
2339 bcopy((void *) &random_number[0], 2340 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, | 2340 bcopy((void *) &random_number[0], 2341 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, |
2341 SWAP_DATA32(chal->cnul.cval_len)); | 2342 LE_SWAP32(chal->cnul.cval_len)); |
2342 } else { 2343 bcopy((void *) &random_number[0], 2344 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, | 2343 } else { 2344 bcopy((void *) &random_number[0], 2345 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, |
2345 SWAP_DATA32(chal->cnul.cval_len)); | 2346 LE_SWAP32(chal->cnul.cval_len)); |
2346 } 2347 } 2348#endif /* RAND */ 2349 2350#ifdef MYRAND 2351 if (dhgp_id != GROUP_NULL) { 2352 /* For test only we hardcode the priv_key here */ 2353 bcopy((void *) myrand, (void *) node_dhc->hrsp_priv_key, | 2347 } 2348 } 2349#endif /* RAND */ 2350 2351#ifdef MYRAND 2352 if (dhgp_id != GROUP_NULL) { 2353 /* For test only we hardcode the priv_key here */ 2354 bcopy((void *) myrand, (void *) node_dhc->hrsp_priv_key, |
2354 SWAP_DATA32(chal->cnul.cval_len)); | 2355 LE_SWAP32(chal->cnul.cval_len)); |
2355 | 2356 |
2356 if (ndlp->nlp_DID == Fabric_DID) { | 2357 if (ndlp->nlp_DID == FABRIC_DID) { |
2357 bcopy((void *) myrand, 2358 (void *) node_dhc->hrsp_priv_key, | 2358 bcopy((void *) myrand, 2359 (void *) node_dhc->hrsp_priv_key, |
2359 SWAP_DATA32(chal->cnul.cval_len)); | 2360 LE_SWAP32(chal->cnul.cval_len)); |
2360 bcopy((void *) myrand, 2361 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, | 2361 bcopy((void *) myrand, 2362 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, |
2362 SWAP_DATA32(chal->cnul.cval_len)); | 2363 LE_SWAP32(chal->cnul.cval_len)); |
2363 } else { 2364 bcopy((void *) myrand, 2365 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, | 2364 } else { 2365 bcopy((void *) myrand, 2366 (void *) node_dhc->nlp_auth_misc.hrsp_priv_key, |
2366 SWAP_DATA32(chal->cnul.cval_len)); | 2367 LE_SWAP32(chal->cnul.cval_len)); |
2367 } 2368 } 2369#endif /* MYRAND */ 2370 2371 /* also store the hash function and dhgp_id being used in challenge. */ 2372 /* These information could be configurable through HBAnyware */ 2373 node_dhc->nlp_auth_hashid = hash_id; 2374 node_dhc->nlp_auth_dhgpid = dhgp_id; --- 6 unchanged lines hidden (view full) --- 2381 2382#ifdef MYRAND 2383 2384 /* to get (g^x mod p) with x private key */ 2385 if (dhgp_id != GROUP_NULL) { 2386 2387 err = emlxs_BIGNUM_get_dhval(port, port_dhc, ndlp, dhval, 2388 &dhval_len, chal->cnul.dhgp_id, | 2368 } 2369 } 2370#endif /* MYRAND */ 2371 2372 /* also store the hash function and dhgp_id being used in challenge. */ 2373 /* These information could be configurable through HBAnyware */ 2374 node_dhc->nlp_auth_hashid = hash_id; 2375 node_dhc->nlp_auth_dhgpid = dhgp_id; --- 6 unchanged lines hidden (view full) --- 2382 2383#ifdef MYRAND 2384 2385 /* to get (g^x mod p) with x private key */ 2386 if (dhgp_id != GROUP_NULL) { 2387 2388 err = emlxs_BIGNUM_get_dhval(port, port_dhc, ndlp, dhval, 2389 &dhval_len, chal->cnul.dhgp_id, |
2389 myrand, SWAP_DATA32(chal->cnul.cval_len)); | 2390 myrand, LE_SWAP32(chal->cnul.cval_len)); |
2390 2391 if (err != BIG_OK) { 2392 emlxs_pkt_free(pkt); 2393 2394 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2395 "emlxs_issue_dhchap_challenge: error. 0x%x", 2396 err); 2397 2398 return (1); 2399 } 2400 /* we are not going to use dhval and dhval_len */ 2401 2402 /* *(uint32_t *)tmp = dhval_len; */ | 2391 2392 if (err != BIG_OK) { 2393 emlxs_pkt_free(pkt); 2394 2395 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2396 "emlxs_issue_dhchap_challenge: error. 0x%x", 2397 err); 2398 2399 return (1); 2400 } 2401 /* we are not going to use dhval and dhval_len */ 2402 2403 /* *(uint32_t *)tmp = dhval_len; */ |
2403 if (ndlp->nlp_DID == Fabric_DID) { | 2404 if (ndlp->nlp_DID == FABRIC_DID) { |
2404 *(uint32_t *)tmp = | 2405 *(uint32_t *)tmp = |
2405 SWAP_DATA32(node_dhc->hrsp_pubkey_len); | 2406 LE_SWAP32(node_dhc->hrsp_pubkey_len); |
2406 } else { 2407 *(uint32_t *)tmp = | 2407 } else { 2408 *(uint32_t *)tmp = |
2408 SWAP_DATA32( | 2409 LE_SWAP32( |
2409 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2410 } 2411 2412 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2413 "emlxs_issue_dhchap_challenge: 0x%x: 0x%x 0x%x", 2414 ndlp->nlp_DID, *(uint32_t *)tmp, dhval_len); 2415 2416 tmp += sizeof (uint32_t); 2417 | 2410 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2411 } 2412 2413 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2414 "emlxs_issue_dhchap_challenge: 0x%x: 0x%x 0x%x", 2415 ndlp->nlp_DID, *(uint32_t *)tmp, dhval_len); 2416 2417 tmp += sizeof (uint32_t); 2418 |
2418 if (ndlp->nlp_DID == Fabric_DID) { | 2419 if (ndlp->nlp_DID == FABRIC_DID) { |
2419 bcopy((void *) node_dhc->hrsp_pub_key, (void *)tmp, 2420 node_dhc->hrsp_pubkey_len); 2421 } else { 2422 bcopy((void *) node_dhc->nlp_auth_misc.hrsp_pub_key, 2423 (void *)tmp, 2424 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2425 } 2426 } else { --- 5 unchanged lines hidden (view full) --- 2432 2433#ifdef RAND 2434 2435 /* to get (g^x mod p) with x private key */ 2436 if (dhgp_id != GROUP_NULL) { 2437 2438 err = emlxs_BIGNUM_get_dhval(port, port_dhc, ndlp, dhval, 2439 &dhval_len, chal->cnul.dhgp_id, | 2420 bcopy((void *) node_dhc->hrsp_pub_key, (void *)tmp, 2421 node_dhc->hrsp_pubkey_len); 2422 } else { 2423 bcopy((void *) node_dhc->nlp_auth_misc.hrsp_pub_key, 2424 (void *)tmp, 2425 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2426 } 2427 } else { --- 5 unchanged lines hidden (view full) --- 2433 2434#ifdef RAND 2435 2436 /* to get (g^x mod p) with x private key */ 2437 if (dhgp_id != GROUP_NULL) { 2438 2439 err = emlxs_BIGNUM_get_dhval(port, port_dhc, ndlp, dhval, 2440 &dhval_len, chal->cnul.dhgp_id, |
2440 random_number, SWAP_DATA32(chal->cnul.cval_len)); | 2441 random_number, LE_SWAP32(chal->cnul.cval_len)); |
2441 2442 if (err != BIG_OK) { 2443 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2444 "emlxs_issue_dhchap_challenge: error. 0x%x", 2445 err); 2446 2447 emlxs_pkt_free(pkt); 2448 return (1); 2449 } 2450 /* we are not going to use dhval and dhval_len */ 2451 2452 /* *(uint32_t *)tmp = dhval_len; */ | 2442 2443 if (err != BIG_OK) { 2444 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2445 "emlxs_issue_dhchap_challenge: error. 0x%x", 2446 err); 2447 2448 emlxs_pkt_free(pkt); 2449 return (1); 2450 } 2451 /* we are not going to use dhval and dhval_len */ 2452 2453 /* *(uint32_t *)tmp = dhval_len; */ |
2453 if (ndlp->nlp_DID == Fabric_DID) { | 2454 if (ndlp->nlp_DID == FABRIC_DID) { |
2454 *(uint32_t *)tmp = | 2455 *(uint32_t *)tmp = |
2455 SWAP_DATA32(node_dhc->hrsp_pubkey_len); | 2456 LE_SWAP32(node_dhc->hrsp_pubkey_len); |
2456 } else { 2457 *(uint32_t *)tmp = | 2457 } else { 2458 *(uint32_t *)tmp = |
2458 SWAP_DATA32( | 2459 LE_SWAP32( |
2459 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2460 } 2461 2462 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2463 "emlxs_issue_dhchap_challenge: did=0x%x: pubkey_len=0x%x", 2464 ndlp->nlp_DID, *(uint32_t *)tmp); 2465 2466 tmp += sizeof (uint32_t); 2467 | 2460 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2461 } 2462 2463 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2464 "emlxs_issue_dhchap_challenge: did=0x%x: pubkey_len=0x%x", 2465 ndlp->nlp_DID, *(uint32_t *)tmp); 2466 2467 tmp += sizeof (uint32_t); 2468 |
2468 if (ndlp->nlp_DID == Fabric_DID) { | 2469 if (ndlp->nlp_DID == FABRIC_DID) { |
2469 bcopy((void *) node_dhc->hrsp_pub_key, (void *)tmp, 2470 node_dhc->hrsp_pubkey_len); 2471 } else { 2472 bcopy((void *) node_dhc->nlp_auth_misc.hrsp_pub_key, 2473 (void *)tmp, 2474 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2475 } 2476 } else { --- 51 unchanged lines hidden (view full) --- 2528 DHCHAP_REPLY_HDR *ap; 2529 uint8_t *pCmd; 2530 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 2531 2532 /* Header size */ 2533 cmdsize = sizeof (DHCHAP_REPLY_HDR); 2534 2535 /* Rsp value len size (4) + Response value size */ | 2470 bcopy((void *) node_dhc->hrsp_pub_key, (void *)tmp, 2471 node_dhc->hrsp_pubkey_len); 2472 } else { 2473 bcopy((void *) node_dhc->nlp_auth_misc.hrsp_pub_key, 2474 (void *)tmp, 2475 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 2476 } 2477 } else { --- 51 unchanged lines hidden (view full) --- 2529 DHCHAP_REPLY_HDR *ap; 2530 uint8_t *pCmd; 2531 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 2532 2533 /* Header size */ 2534 cmdsize = sizeof (DHCHAP_REPLY_HDR); 2535 2536 /* Rsp value len size (4) + Response value size */ |
2536 if (ndlp->nlp_DID == Fabric_DID) { | 2537 if (ndlp->nlp_DID == FABRIC_DID) { |
2537 if (node_dhc->hash_id == AUTH_MD5) { 2538 cmdsize += 4 + MD5_LEN; 2539 } 2540 if (node_dhc->hash_id == AUTH_SHA1) { 2541 cmdsize += 4 + SHA1_LEN; 2542 } 2543 } else { 2544 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { 2545 cmdsize += 4 + MD5_LEN; 2546 } 2547 if (node_dhc->nlp_auth_hashid == AUTH_SHA1) { 2548 cmdsize += 4 + SHA1_LEN; 2549 } 2550 } 2551 2552 /* DH value len size (4) + DH value size */ | 2538 if (node_dhc->hash_id == AUTH_MD5) { 2539 cmdsize += 4 + MD5_LEN; 2540 } 2541 if (node_dhc->hash_id == AUTH_SHA1) { 2542 cmdsize += 4 + SHA1_LEN; 2543 } 2544 } else { 2545 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { 2546 cmdsize += 4 + MD5_LEN; 2547 } 2548 if (node_dhc->nlp_auth_hashid == AUTH_SHA1) { 2549 cmdsize += 4 + SHA1_LEN; 2550 } 2551 } 2552 2553 /* DH value len size (4) + DH value size */ |
2553 if (ndlp->nlp_DID == Fabric_DID) { | 2554 if (ndlp->nlp_DID == FABRIC_DID) { |
2554 switch (node_dhc->dhgp_id) { 2555 case GROUP_NULL: 2556 2557 break; 2558 2559 case GROUP_1024: 2560 case GROUP_1280: 2561 case GROUP_1536: --- 4 unchanged lines hidden (view full) --- 2566 } 2567 2568 cmdsize += 4 + dhval_len; 2569 2570 /* Challenge value len size (4) + Challenge value size */ 2571 if (node_dhc->auth_cfg.bidirectional == 0) { 2572 cmdsize += 4; 2573 } else { | 2555 switch (node_dhc->dhgp_id) { 2556 case GROUP_NULL: 2557 2558 break; 2559 2560 case GROUP_1024: 2561 case GROUP_1280: 2562 case GROUP_1536: --- 4 unchanged lines hidden (view full) --- 2567 } 2568 2569 cmdsize += 4 + dhval_len; 2570 2571 /* Challenge value len size (4) + Challenge value size */ 2572 if (node_dhc->auth_cfg.bidirectional == 0) { 2573 cmdsize += 4; 2574 } else { |
2574 if (ndlp->nlp_DID == Fabric_DID) { | 2575 if (ndlp->nlp_DID == FABRIC_DID) { |
2575 cmdsize += 4 + ((node_dhc->hash_id == AUTH_MD5) ? 2576 MD5_LEN : SHA1_LEN); 2577 } else { 2578 cmdsize += 4 + 2579 ((node_dhc->nlp_auth_hashid == AUTH_MD5) ? MD5_LEN : 2580 SHA1_LEN); 2581 } 2582 } --- 11 unchanged lines hidden (view full) --- 2594 } 2595 pCmd = (uint8_t *)pkt->pkt_cmd; 2596 2597 ap = (DHCHAP_REPLY_HDR *)pCmd; 2598 ap->auth_els_code = ELS_CMD_AUTH_CODE; 2599 ap->auth_els_flags = 0x0; 2600 ap->auth_msg_code = DHCHAP_REPLY; 2601 ap->proto_version = 0x01; | 2576 cmdsize += 4 + ((node_dhc->hash_id == AUTH_MD5) ? 2577 MD5_LEN : SHA1_LEN); 2578 } else { 2579 cmdsize += 4 + 2580 ((node_dhc->nlp_auth_hashid == AUTH_MD5) ? MD5_LEN : 2581 SHA1_LEN); 2582 } 2583 } --- 11 unchanged lines hidden (view full) --- 2595 } 2596 pCmd = (uint8_t *)pkt->pkt_cmd; 2597 2598 ap = (DHCHAP_REPLY_HDR *)pCmd; 2599 ap->auth_els_code = ELS_CMD_AUTH_CODE; 2600 ap->auth_els_flags = 0x0; 2601 ap->auth_msg_code = DHCHAP_REPLY; 2602 ap->proto_version = 0x01; |
2602 ap->msg_len = SWAP_DATA32(cmdsize - sizeof (DHCHAP_REPLY_HDR)); 2603 ap->tran_id = SWAP_DATA32(node_dhc->nlp_auth_tranid_rsp); | 2603 ap->msg_len = LE_SWAP32(cmdsize - sizeof (DHCHAP_REPLY_HDR)); 2604 ap->tran_id = LE_SWAP32(node_dhc->nlp_auth_tranid_rsp); |
2604 2605 pCmd = (uint8_t *)(pCmd + sizeof (DHCHAP_REPLY_HDR)); 2606 | 2605 2606 pCmd = (uint8_t *)(pCmd + sizeof (DHCHAP_REPLY_HDR)); 2607 |
2607 if (ndlp->nlp_DID == Fabric_DID) { | 2608 if (ndlp->nlp_DID == FABRIC_DID) { |
2608 if (node_dhc->hash_id == AUTH_MD5) { | 2609 if (node_dhc->hash_id == AUTH_MD5) { |
2609 *(uint32_t *)pCmd = SWAP_DATA32(MD5_LEN); | 2610 *(uint32_t *)pCmd = LE_SWAP32(MD5_LEN); |
2610 } else { | 2611 } else { |
2611 *(uint32_t *)pCmd = SWAP_DATA32(SHA1_LEN); | 2612 *(uint32_t *)pCmd = LE_SWAP32(SHA1_LEN); |
2612 } 2613 } else { 2614 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { | 2613 } 2614 } else { 2615 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { |
2615 *(uint32_t *)pCmd = SWAP_DATA32(MD5_LEN); | 2616 *(uint32_t *)pCmd = LE_SWAP32(MD5_LEN); |
2616 } else { | 2617 } else { |
2617 *(uint32_t *)pCmd = SWAP_DATA32(SHA1_LEN); | 2618 *(uint32_t *)pCmd = LE_SWAP32(SHA1_LEN); |
2618 } 2619 } 2620 2621 pCmd = (uint8_t *)(pCmd + 4); 2622 | 2619 } 2620 } 2621 2622 pCmd = (uint8_t *)(pCmd + 4); 2623 |
2623 if (ndlp->nlp_DID == Fabric_DID) { | 2624 if (ndlp->nlp_DID == FABRIC_DID) { |
2624 if (node_dhc->hash_id == AUTH_MD5) { 2625 bcopy((void *)arg1, pCmd, MD5_LEN); 2626 pCmd = (uint8_t *)(pCmd + MD5_LEN); 2627 } else { 2628 bcopy((void *)arg1, (void *)pCmd, SHA1_LEN); 2629 2630 pCmd = (uint8_t *)(pCmd + SHA1_LEN); 2631 } 2632 } else { 2633 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { 2634 bcopy((void *)arg1, pCmd, MD5_LEN); 2635 pCmd = (uint8_t *)(pCmd + MD5_LEN); 2636 } else { 2637 bcopy((void *)arg1, (void *)pCmd, SHA1_LEN); 2638 pCmd = (uint8_t *)(pCmd + SHA1_LEN); 2639 } 2640 } 2641 | 2625 if (node_dhc->hash_id == AUTH_MD5) { 2626 bcopy((void *)arg1, pCmd, MD5_LEN); 2627 pCmd = (uint8_t *)(pCmd + MD5_LEN); 2628 } else { 2629 bcopy((void *)arg1, (void *)pCmd, SHA1_LEN); 2630 2631 pCmd = (uint8_t *)(pCmd + SHA1_LEN); 2632 } 2633 } else { 2634 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { 2635 bcopy((void *)arg1, pCmd, MD5_LEN); 2636 pCmd = (uint8_t *)(pCmd + MD5_LEN); 2637 } else { 2638 bcopy((void *)arg1, (void *)pCmd, SHA1_LEN); 2639 pCmd = (uint8_t *)(pCmd + SHA1_LEN); 2640 } 2641 } 2642 |
2642 *(uint32_t *)pCmd = SWAP_DATA32(dhval_len); | 2643 *(uint32_t *)pCmd = LE_SWAP32(dhval_len); |
2643 2644 if (dhval_len != 0) { 2645 pCmd = (uint8_t *)(pCmd + 4); 2646 2647 switch (node_dhc->dhgp_id) { 2648 case GROUP_NULL: 2649 2650 break; --- 7 unchanged lines hidden (view full) --- 2658 } 2659 /* elx_bcopy((void *)dhval, (void *)pCmd, dhval_len); */ 2660 /* 2661 * The new DH parameter (g^y mod p) is stored in 2662 * node_dhc->pub_key 2663 */ 2664 /* pubkey_len should be equal to dhval_len */ 2665 | 2644 2645 if (dhval_len != 0) { 2646 pCmd = (uint8_t *)(pCmd + 4); 2647 2648 switch (node_dhc->dhgp_id) { 2649 case GROUP_NULL: 2650 2651 break; --- 7 unchanged lines hidden (view full) --- 2659 } 2660 /* elx_bcopy((void *)dhval, (void *)pCmd, dhval_len); */ 2661 /* 2662 * The new DH parameter (g^y mod p) is stored in 2663 * node_dhc->pub_key 2664 */ 2665 /* pubkey_len should be equal to dhval_len */ 2666 |
2666 if (ndlp->nlp_DID == Fabric_DID) { | 2667 if (ndlp->nlp_DID == FABRIC_DID) { |
2667 bcopy((void *) node_dhc->pub_key, (void *)pCmd, 2668 node_dhc->pubkey_len); 2669 } else { 2670 bcopy((void *) node_dhc->nlp_auth_misc.pub_key, 2671 (void *)pCmd, 2672 node_dhc->nlp_auth_misc.pubkey_len); 2673 } 2674 pCmd = (uint8_t *)(pCmd + dhval_len); 2675 } else 2676 pCmd = (uint8_t *)(pCmd + 4); 2677 2678 if (node_dhc->auth_cfg.bidirectional == 0) { 2679 *(uint32_t *)pCmd = 0x0; 2680 } else { | 2668 bcopy((void *) node_dhc->pub_key, (void *)pCmd, 2669 node_dhc->pubkey_len); 2670 } else { 2671 bcopy((void *) node_dhc->nlp_auth_misc.pub_key, 2672 (void *)pCmd, 2673 node_dhc->nlp_auth_misc.pubkey_len); 2674 } 2675 pCmd = (uint8_t *)(pCmd + dhval_len); 2676 } else 2677 pCmd = (uint8_t *)(pCmd + 4); 2678 2679 if (node_dhc->auth_cfg.bidirectional == 0) { 2680 *(uint32_t *)pCmd = 0x0; 2681 } else { |
2681 if (ndlp->nlp_DID == Fabric_DID) { | 2682 if (ndlp->nlp_DID == FABRIC_DID) { |
2682 if (node_dhc->hash_id == AUTH_MD5) { | 2683 if (node_dhc->hash_id == AUTH_MD5) { |
2683 *(uint32_t *)pCmd = SWAP_DATA32(MD5_LEN); | 2684 *(uint32_t *)pCmd = LE_SWAP32(MD5_LEN); |
2684 pCmd = (uint8_t *)(pCmd + 4); 2685 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2686 } else if (node_dhc->hash_id == AUTH_SHA1) { | 2685 pCmd = (uint8_t *)(pCmd + 4); 2686 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2687 } else if (node_dhc->hash_id == AUTH_SHA1) { |
2687 *(uint32_t *)pCmd = SWAP_DATA32(SHA1_LEN); | 2688 *(uint32_t *)pCmd = LE_SWAP32(SHA1_LEN); |
2688 pCmd = (uint8_t *)(pCmd + 4); 2689 /* store the challenge */ 2690 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2691 } 2692 } else { 2693 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { | 2689 pCmd = (uint8_t *)(pCmd + 4); 2690 /* store the challenge */ 2691 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2692 } 2693 } else { 2694 if (node_dhc->nlp_auth_hashid == AUTH_MD5) { |
2694 *(uint32_t *)pCmd = SWAP_DATA32(MD5_LEN); | 2695 *(uint32_t *)pCmd = LE_SWAP32(MD5_LEN); |
2695 pCmd = (uint8_t *)(pCmd + 4); 2696 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2697 } else if (node_dhc->nlp_auth_hashid == AUTH_SHA1) { | 2696 pCmd = (uint8_t *)(pCmd + 4); 2697 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2698 } else if (node_dhc->nlp_auth_hashid == AUTH_SHA1) { |
2698 *(uint32_t *)pCmd = SWAP_DATA32(SHA1_LEN); | 2699 *(uint32_t *)pCmd = LE_SWAP32(SHA1_LEN); |
2699 pCmd = (uint8_t *)(pCmd + 4); 2700 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2701 } 2702 } 2703 } 2704 2705 pkt->pkt_comp = emlxs_cmpl_dhchap_reply_issue; 2706 2707 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2708 "emlxs_issue_dhchap_reply: did=0x%x (%x,%x,%x,%x,%x,%x)", 2709 ndlp->nlp_DID, dhval_len, arg2_len, cmdsize, 2710 node_dhc->hash_id, node_dhc->nlp_auth_hashid, | 2700 pCmd = (uint8_t *)(pCmd + 4); 2701 bcopy((void *)arg2, (void *)pCmd, arg2_len); 2702 } 2703 } 2704 } 2705 2706 pkt->pkt_comp = emlxs_cmpl_dhchap_reply_issue; 2707 2708 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 2709 "emlxs_issue_dhchap_reply: did=0x%x (%x,%x,%x,%x,%x,%x)", 2710 ndlp->nlp_DID, dhval_len, arg2_len, cmdsize, 2711 node_dhc->hash_id, node_dhc->nlp_auth_hashid, |
2711 SWAP_DATA32(ap->tran_id)); | 2712 LE_SWAP32(ap->tran_id)); |
2712 2713 if (emlxs_pkt_send(pkt, 1) != FC_SUCCESS) { 2714 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2715 "emlxs_issue_dhchap_reply failed: Unable to send packet."); 2716 2717 emlxs_pkt_free(pkt); 2718 2719 return (1); --- 24 unchanged lines hidden (view full) --- 2744 * 2745 * If the msg is AUTH_ELS cmd, cancel the nlp_authrsp_timeout timer immediately. 2746 * 2747 */ 2748/* ARGSUSED */ 2749static uint32_t 2750emlxs_rcv_auth_msg_auth_negotiate_cmpl_wait4next( 2751emlxs_port_t *port, | 2713 2714 if (emlxs_pkt_send(pkt, 1) != FC_SUCCESS) { 2715 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2716 "emlxs_issue_dhchap_reply failed: Unable to send packet."); 2717 2718 emlxs_pkt_free(pkt); 2719 2720 return (1); --- 24 unchanged lines hidden (view full) --- 2745 * 2746 * If the msg is AUTH_ELS cmd, cancel the nlp_authrsp_timeout timer immediately. 2747 * 2748 */ 2749/* ARGSUSED */ 2750static uint32_t 2751emlxs_rcv_auth_msg_auth_negotiate_cmpl_wait4next( 2752emlxs_port_t *port, |
2752/* RING * rp, */ void *arg1, | 2753/* CHANNEL * rp, */ void *arg1, |
2753/* IOCBQ * iocbq, */ void *arg2, 2754/* MATCHMAP * mp, */ void *arg3, 2755/* NODELIST * ndlp */ void *arg4, 2756uint32_t evt) 2757{ 2758 emlxs_hba_t *hba = HBA; 2759 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 2760 IOCBQ *iocbq = (IOCBQ *)arg2; --- 105 unchanged lines hidden (view full) --- 2866 ndlp->nlp_DID, ncval->msg_hdr.auth_msg_code); 2867 2868 ReasonCode = AUTHRJT_FAILURE; 2869 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 2870 goto AUTH_Reject; 2871 } 2872 tran_id = ncval->msg_hdr.tran_id; 2873 | 2754/* IOCBQ * iocbq, */ void *arg2, 2755/* MATCHMAP * mp, */ void *arg3, 2756/* NODELIST * ndlp */ void *arg4, 2757uint32_t evt) 2758{ 2759 emlxs_hba_t *hba = HBA; 2760 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 2761 IOCBQ *iocbq = (IOCBQ *)arg2; --- 105 unchanged lines hidden (view full) --- 2867 ndlp->nlp_DID, ncval->msg_hdr.auth_msg_code); 2868 2869 ReasonCode = AUTHRJT_FAILURE; 2870 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 2871 goto AUTH_Reject; 2872 } 2873 tran_id = ncval->msg_hdr.tran_id; 2874 |
2874 if (SWAP_DATA32(tran_id) != node_dhc->nlp_auth_tranid_rsp) { | 2875 if (LE_SWAP32(tran_id) != node_dhc->nlp_auth_tranid_rsp) { |
2875 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2876 "rcv_auth_msg_auth_negotiate_cmpl_wait4next:0x%x %x!=%x", | 2876 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2877 "rcv_auth_msg_auth_negotiate_cmpl_wait4next:0x%x %x!=%x", |
2877 ndlp->nlp_DID, SWAP_DATA32(tran_id), | 2878 ndlp->nlp_DID, LE_SWAP32(tran_id), |
2878 node_dhc->nlp_auth_tranid_rsp); 2879 2880 ReasonCode = AUTHRJT_FAILURE; 2881 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2882 goto AUTH_Reject; 2883 } 2884 node_dhc->nlp_authrsp_tmo = 0; 2885 --- 6 unchanged lines hidden (view full) --- 2892 */ 2893 bcopy((void *)&ncval->msg_hdr.nodeName, 2894 (void *)&node_dhc->nlp_auth_wwn, sizeof (NAME_TYPE)); 2895 } 2896 /* Collect the challenge value */ 2897 tmp = (uint8_t *)((uint8_t *)lp + sizeof (DHCHAP_CHALL_NULL)); 2898 2899 if (ncval->hash_id == AUTH_MD5) { | 2879 node_dhc->nlp_auth_tranid_rsp); 2880 2881 ReasonCode = AUTHRJT_FAILURE; 2882 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2883 goto AUTH_Reject; 2884 } 2885 node_dhc->nlp_authrsp_tmo = 0; 2886 --- 6 unchanged lines hidden (view full) --- 2893 */ 2894 bcopy((void *)&ncval->msg_hdr.nodeName, 2895 (void *)&node_dhc->nlp_auth_wwn, sizeof (NAME_TYPE)); 2896 } 2897 /* Collect the challenge value */ 2898 tmp = (uint8_t *)((uint8_t *)lp + sizeof (DHCHAP_CHALL_NULL)); 2899 2900 if (ncval->hash_id == AUTH_MD5) { |
2900 if (ncval->cval_len != SWAP_DATA32(MD5_LEN)) { | 2901 if (ncval->cval_len != LE_SWAP32(MD5_LEN)) { |
2901 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2902 "rcv_auth_msg_auth_negotiate_cmpl_wait4next:0x%x.%x!=%x", | 2902 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2903 "rcv_auth_msg_auth_negotiate_cmpl_wait4next:0x%x.%x!=%x", |
2903 ndlp->nlp_DID, ncval->cval_len, SWAP_DATA32(MD5_LEN)); | 2904 ndlp->nlp_DID, ncval->cval_len, LE_SWAP32(MD5_LEN)); |
2904 2905 ReasonCode = AUTHRJT_FAILURE; 2906 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2907 goto AUTH_Reject; 2908 } 2909 bzero(un_cval.md5.val, sizeof (MD5_CVAL)); 2910 bcopy((void *)tmp, (void *)un_cval.md5.val, 2911 sizeof (MD5_CVAL)); 2912 tmp += sizeof (MD5_CVAL); 2913 2914 arg2len = MD5_LEN; 2915 2916 } else if (ncval->hash_id == AUTH_SHA1) { | 2905 2906 ReasonCode = AUTHRJT_FAILURE; 2907 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2908 goto AUTH_Reject; 2909 } 2910 bzero(un_cval.md5.val, sizeof (MD5_CVAL)); 2911 bcopy((void *)tmp, (void *)un_cval.md5.val, 2912 sizeof (MD5_CVAL)); 2913 tmp += sizeof (MD5_CVAL); 2914 2915 arg2len = MD5_LEN; 2916 2917 } else if (ncval->hash_id == AUTH_SHA1) { |
2917 if (ncval->cval_len != SWAP_DATA32(SHA1_LEN)) { | 2918 if (ncval->cval_len != LE_SWAP32(SHA1_LEN)) { |
2918 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2919 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x!=%x", | 2919 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2920 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x!=%x", |
2920 ndlp->nlp_DID, ncval->cval_len, SWAP_DATA32(MD5_LEN)); | 2921 ndlp->nlp_DID, ncval->cval_len, LE_SWAP32(MD5_LEN)); |
2921 2922 ReasonCode = AUTHRJT_FAILURE; 2923 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2924 goto AUTH_Reject; 2925 } 2926 bzero(un_cval.sha1.val, sizeof (SHA1_CVAL)); 2927 bcopy((void *)tmp, (void *)un_cval.sha1.val, 2928 sizeof (SHA1_CVAL)); --- 36 unchanged lines hidden (view full) --- 2965 * nport. 2966 */ 2967 2968 dhvallen = *((uint32_t *)(tmp)); 2969 2970 switch (ncval->dhgp_id) { 2971 case GROUP_NULL: 2972 /* null DHCHAP only */ | 2922 2923 ReasonCode = AUTHRJT_FAILURE; 2924 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2925 goto AUTH_Reject; 2926 } 2927 bzero(un_cval.sha1.val, sizeof (SHA1_CVAL)); 2928 bcopy((void *)tmp, (void *)un_cval.sha1.val, 2929 sizeof (SHA1_CVAL)); --- 36 unchanged lines hidden (view full) --- 2966 * nport. 2967 */ 2968 2969 dhvallen = *((uint32_t *)(tmp)); 2970 2971 switch (ncval->dhgp_id) { 2972 case GROUP_NULL: 2973 /* null DHCHAP only */ |
2973 if (SWAP_DATA32(dhvallen) != 0) { | 2974 if (LE_SWAP32(dhvallen) != 0) { |
2974 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2975 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x %x", | 2975 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2976 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x %x", |
2976 ndlp->nlp_DID, ncval->dhgp_id, SWAP_DATA32(dhvallen)); | 2977 ndlp->nlp_DID, ncval->dhgp_id, LE_SWAP32(dhvallen)); |
2977 2978 ReasonCode = AUTHRJT_FAILURE; 2979 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2980 goto AUTH_Reject; 2981 } 2982 break; 2983 2984 case GROUP_1024: 2985 case GROUP_1280: 2986 case GROUP_1536: 2987 case GROUP_2048: 2988 /* Collect the DH Value */ 2989 tmp += sizeof (uint32_t); 2990 | 2978 2979 ReasonCode = AUTHRJT_FAILURE; 2980 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 2981 goto AUTH_Reject; 2982 } 2983 break; 2984 2985 case GROUP_1024: 2986 case GROUP_1280: 2987 case GROUP_1536: 2988 case GROUP_2048: 2989 /* Collect the DH Value */ 2990 tmp += sizeof (uint32_t); 2991 |
2991 dhval = (uint8_t *)kmem_zalloc(SWAP_DATA32(dhvallen), | 2992 dhval = (uint8_t *)kmem_zalloc(LE_SWAP32(dhvallen), |
2992 KM_NOSLEEP); 2993 if (dhval == NULL) { 2994 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2995 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x %x", 2996 ndlp->nlp_DID, ncval->dhgp_id, dhval); 2997 2998 ReasonCode = AUTHRJT_LOGIC_ERR; 2999 ReasonCodeExplanation = AUTHEXP_RESTART_AUTH; 3000 goto AUTH_Reject; 3001 } | 2993 KM_NOSLEEP); 2994 if (dhval == NULL) { 2995 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 2996 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x %x", 2997 ndlp->nlp_DID, ncval->dhgp_id, dhval); 2998 2999 ReasonCode = AUTHRJT_LOGIC_ERR; 3000 ReasonCodeExplanation = AUTHEXP_RESTART_AUTH; 3001 goto AUTH_Reject; 3002 } |
3002 bcopy((void *)tmp, (void *)dhval, SWAP_DATA32(dhvallen)); | 3003 bcopy((void *)tmp, (void *)dhval, LE_SWAP32(dhvallen)); |
3003 break; 3004 3005 default: 3006 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3007 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x.", 3008 ndlp->nlp_DID, ncval->dhgp_id); 3009 3010 ReasonCode = AUTHRJT_FAILURE; 3011 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 3012 goto AUTH_Reject; 3013 } 3014 3015 /* 3016 * Calculate the hash value, hash function, DH group, secret etc. 3017 * could be stored in port_dhc. 3018 */ 3019 3020 /* arg5 has the response with NULL or Full DH group support */ 3021 arg5 = (uint32_t *)emlxs_hash_rsp(port, port_dhc, | 3004 break; 3005 3006 default: 3007 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3008 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x %x.", 3009 ndlp->nlp_DID, ncval->dhgp_id); 3010 3011 ReasonCode = AUTHRJT_FAILURE; 3012 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 3013 goto AUTH_Reject; 3014 } 3015 3016 /* 3017 * Calculate the hash value, hash function, DH group, secret etc. 3018 * could be stored in port_dhc. 3019 */ 3020 3021 /* arg5 has the response with NULL or Full DH group support */ 3022 arg5 = (uint32_t *)emlxs_hash_rsp(port, port_dhc, |
3022 ndlp, tran_id, un_cval, dhval, SWAP_DATA32(dhvallen)); | 3023 ndlp, tran_id, un_cval, dhval, LE_SWAP32(dhvallen)); |
3023 3024 /* Or should check ndlp->auth_cfg..... */ 3025 if (node_dhc->auth_cfg.bidirectional == 1) { 3026 /* get arg2 here */ 3027 /* 3028 * arg2 is the new challenge C2 from initiator if bi-dir auth 3029 * is supported 3030 */ 3031 bzero(&random_number, sizeof (random_number)); 3032 3033 if (hba->rdn_flag == 1) { 3034 emlxs_get_random_bytes(ndlp, random_number, 20); 3035 } else { 3036 random_get_pseudo_bytes(random_number, arg2len); 3037 } 3038 3039 /* cache it for later verification usage */ | 3024 3025 /* Or should check ndlp->auth_cfg..... */ 3026 if (node_dhc->auth_cfg.bidirectional == 1) { 3027 /* get arg2 here */ 3028 /* 3029 * arg2 is the new challenge C2 from initiator if bi-dir auth 3030 * is supported 3031 */ 3032 bzero(&random_number, sizeof (random_number)); 3033 3034 if (hba->rdn_flag == 1) { 3035 emlxs_get_random_bytes(ndlp, random_number, 20); 3036 } else { 3037 random_get_pseudo_bytes(random_number, arg2len); 3038 } 3039 3040 /* cache it for later verification usage */ |
3040 if (ndlp->nlp_DID == Fabric_DID) { | 3041 if (ndlp->nlp_DID == FABRIC_DID) { |
3041 bcopy((void *)&random_number[0], 3042 (void *)&node_dhc->bi_cval[0], arg2len); 3043 node_dhc->bi_cval_len = arg2len; 3044 3045 /* save another copy in our partner's ndlp */ 3046 bcopy((void *)&random_number[0], 3047 (void *)&node_dhc->nlp_auth_misc.bi_cval[0], 3048 arg2len); --- 14 unchanged lines hidden (view full) --- 3063 /* Issue ELS DHCHAP_Reply */ 3064 /* 3065 * arg1 has the response, arg2 has the new challenge if needed (g^y 3066 * mod p) is the pubkey: all are ready and to go 3067 */ 3068 3069 /* return 0 success, otherwise failure */ 3070 if (emlxs_issue_dhchap_reply(port, ndlp, 0, arg5, dhval, | 3042 bcopy((void *)&random_number[0], 3043 (void *)&node_dhc->bi_cval[0], arg2len); 3044 node_dhc->bi_cval_len = arg2len; 3045 3046 /* save another copy in our partner's ndlp */ 3047 bcopy((void *)&random_number[0], 3048 (void *)&node_dhc->nlp_auth_misc.bi_cval[0], 3049 arg2len); --- 14 unchanged lines hidden (view full) --- 3064 /* Issue ELS DHCHAP_Reply */ 3065 /* 3066 * arg1 has the response, arg2 has the new challenge if needed (g^y 3067 * mod p) is the pubkey: all are ready and to go 3068 */ 3069 3070 /* return 0 success, otherwise failure */ 3071 if (emlxs_issue_dhchap_reply(port, ndlp, 0, arg5, dhval, |
3071 SWAP_DATA32(dhvallen), | 3072 LE_SWAP32(dhvallen), |
3072 random_number, arg2len)) { 3073 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3074 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x.failed.", 3075 ndlp->nlp_DID); 3076 | 3073 random_number, arg2len)) { 3074 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3075 "rcv_auth_msg_auth_negotiate_cmpl_wait4next: 0x%x.failed.", 3076 ndlp->nlp_DID); 3077 |
3077 kmem_free(dhval, SWAP_DATA32(dhvallen)); | 3078 kmem_free(dhval, LE_SWAP32(dhvallen)); |
3078 ReasonCode = AUTHRJT_LOGIC_ERR; 3079 ReasonCodeExplanation = AUTHEXP_RESTART_AUTH; 3080 goto AUTH_Reject; 3081 } 3082 return (node_dhc->state); 3083 3084AUTH_Reject: 3085 --- 11 unchanged lines hidden (view full) --- 3097/* 3098 * This routine should be set to emlxs_disc_neverdev 3099 * 3100 */ 3101/* ARGSUSED */ 3102static uint32_t 3103emlxs_cmpl_auth_msg_auth_negotiate_cmpl_wait4next( 3104emlxs_port_t *port, | 3079 ReasonCode = AUTHRJT_LOGIC_ERR; 3080 ReasonCodeExplanation = AUTHEXP_RESTART_AUTH; 3081 goto AUTH_Reject; 3082 } 3083 return (node_dhc->state); 3084 3085AUTH_Reject: 3086 --- 11 unchanged lines hidden (view full) --- 3098/* 3099 * This routine should be set to emlxs_disc_neverdev 3100 * 3101 */ 3102/* ARGSUSED */ 3103static uint32_t 3104emlxs_cmpl_auth_msg_auth_negotiate_cmpl_wait4next( 3105emlxs_port_t *port, |
3105/* RING * rp, */ void *arg1, | 3106/* CHANNEL * rp, */ void *arg1, |
3106/* IOCBQ * iocbq, */ void *arg2, 3107/* MATCHMAP * mp, */ void *arg3, 3108/* NODELIST * ndlp */ void *arg4, 3109uint32_t evt) 3110{ 3111 NODELIST *ndlp = (NODELIST *)arg4; 3112 3113 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 14 unchanged lines hidden (view full) --- 3128 * NxPort or FxPort, as a result, the host will send back ACC and AUTH_Reject 3129 * and set the next state = NPR_NODE. 3130 * 3131 */ 3132/* ARGSUSED */ 3133static uint32_t 3134emlxs_rcv_auth_msg_dhchap_reply_issue( 3135emlxs_port_t *port, | 3107/* IOCBQ * iocbq, */ void *arg2, 3108/* MATCHMAP * mp, */ void *arg3, 3109/* NODELIST * ndlp */ void *arg4, 3110uint32_t evt) 3111{ 3112 NODELIST *ndlp = (NODELIST *)arg4; 3113 3114 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 14 unchanged lines hidden (view full) --- 3129 * NxPort or FxPort, as a result, the host will send back ACC and AUTH_Reject 3130 * and set the next state = NPR_NODE. 3131 * 3132 */ 3133/* ARGSUSED */ 3134static uint32_t 3135emlxs_rcv_auth_msg_dhchap_reply_issue( 3136emlxs_port_t *port, |
3136/* RING * rp, */ void *arg1, | 3137/* CHANNEL * rp, */ void *arg1, |
3137/* IOCBQ * iocbq, */ void *arg2, 3138/* MATCHMAP * mp, */ void *arg3, 3139/* NODELIST * ndlp */ void *arg4, 3140uint32_t evt) 3141{ 3142 NODELIST *ndlp = (NODELIST *)arg4; 3143 3144 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 14 unchanged lines hidden (view full) --- 3159 * or FxPort that already received the ELS DHCHAP_Reply 3160 * msg from the host. in case of ACC, next state = DHCHAP_REPLY_CMPL_WAIT4NEXT 3161 * in case of RJT, next state = NPR_NODE 3162 */ 3163/* ARGSUSED */ 3164static uint32_t 3165emlxs_cmpl_auth_msg_dhchap_reply_issue( 3166emlxs_port_t *port, | 3138/* IOCBQ * iocbq, */ void *arg2, 3139/* MATCHMAP * mp, */ void *arg3, 3140/* NODELIST * ndlp */ void *arg4, 3141uint32_t evt) 3142{ 3143 NODELIST *ndlp = (NODELIST *)arg4; 3144 3145 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 14 unchanged lines hidden (view full) --- 3160 * or FxPort that already received the ELS DHCHAP_Reply 3161 * msg from the host. in case of ACC, next state = DHCHAP_REPLY_CMPL_WAIT4NEXT 3162 * in case of RJT, next state = NPR_NODE 3163 */ 3164/* ARGSUSED */ 3165static uint32_t 3166emlxs_cmpl_auth_msg_dhchap_reply_issue( 3167emlxs_port_t *port, |
3167/* RING * rp, */ void *arg1, | 3168/* CHANNEL * rp, */ void *arg1, |
3168/* IOCBQ * iocbq, */ void *arg2, 3169/* MATCHMAP * mp, */ void *arg3, 3170/* NODELIST * ndlp */ void *arg4, 3171uint32_t evt) 3172{ 3173 NODELIST *ndlp = (NODELIST *) arg4; 3174 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3175 --- 37 unchanged lines hidden (view full) --- 3213 * state = NPR_NODE. if msg is ELS AUTH_Reject, then 3214 * send back ACC and set next state = NPR_NODE if msg is anything else, then 3215 * RJT and set next state = NPR_NODE 3216 */ 3217/* ARGSUSED */ 3218static uint32_t 3219emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next( 3220emlxs_port_t *port, | 3169/* IOCBQ * iocbq, */ void *arg2, 3170/* MATCHMAP * mp, */ void *arg3, 3171/* NODELIST * ndlp */ void *arg4, 3172uint32_t evt) 3173{ 3174 NODELIST *ndlp = (NODELIST *) arg4; 3175 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3176 --- 37 unchanged lines hidden (view full) --- 3214 * state = NPR_NODE. if msg is ELS AUTH_Reject, then 3215 * send back ACC and set next state = NPR_NODE if msg is anything else, then 3216 * RJT and set next state = NPR_NODE 3217 */ 3218/* ARGSUSED */ 3219static uint32_t 3220emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next( 3221emlxs_port_t *port, |
3221/* RING * rp, */ void *arg1, | 3222/* CHANNEL * rp, */ void *arg1, |
3222/* IOCBQ * iocbq, */ void *arg2, 3223/* MATCHMAP * mp, */ void *arg3, 3224/* NODELIST * ndlp */ void *arg4, 3225uint32_t evt) 3226{ 3227 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 3228 IOCBQ *iocbq = (IOCBQ *)arg2; 3229 MATCHMAP *mp = (MATCHMAP *)arg3; --- 90 unchanged lines hidden (view full) --- 3320 } 3321 if (dh_success->auth_msg_code == DHCHAP_SUCCESS) { 3322 3323 /* Verify the tran_id */ 3324 tran_id = dh_success->tran_id; 3325 3326 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 3327 "rcv_auth_msg_dhchap_reply_cmpl_wait4next: 0x%x 0x%x 0x%x 0x%x", | 3223/* IOCBQ * iocbq, */ void *arg2, 3224/* MATCHMAP * mp, */ void *arg3, 3225/* NODELIST * ndlp */ void *arg4, 3226uint32_t evt) 3227{ 3228 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 3229 IOCBQ *iocbq = (IOCBQ *)arg2; 3230 MATCHMAP *mp = (MATCHMAP *)arg3; --- 90 unchanged lines hidden (view full) --- 3321 } 3322 if (dh_success->auth_msg_code == DHCHAP_SUCCESS) { 3323 3324 /* Verify the tran_id */ 3325 tran_id = dh_success->tran_id; 3326 3327 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 3328 "rcv_auth_msg_dhchap_reply_cmpl_wait4next: 0x%x 0x%x 0x%x 0x%x", |
3328 ndlp->nlp_DID, SWAP_DATA32(tran_id), | 3329 ndlp->nlp_DID, LE_SWAP32(tran_id), |
3329 node_dhc->nlp_auth_tranid_rsp, 3330 node_dhc->nlp_auth_tranid_ini); 3331 | 3330 node_dhc->nlp_auth_tranid_rsp, 3331 node_dhc->nlp_auth_tranid_ini); 3332 |
3332 if (SWAP_DATA32(tran_id) != node_dhc->nlp_auth_tranid_rsp) { | 3333 if (LE_SWAP32(tran_id) != node_dhc->nlp_auth_tranid_rsp) { |
3333 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3334 "rcv_auth_msg_dhchap_reply_cmpl_wait4next:0x%x %x!=%x", | 3334 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3335 "rcv_auth_msg_dhchap_reply_cmpl_wait4next:0x%x %x!=%x", |
3335 ndlp->nlp_DID, SWAP_DATA32(tran_id), | 3336 ndlp->nlp_DID, LE_SWAP32(tran_id), |
3336 node_dhc->nlp_auth_tranid_rsp); 3337 3338 ReasonCode = AUTHRJT_FAILURE; 3339 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 3340 goto AUTH_Reject; 3341 } 3342 if (node_dhc->auth_cfg.bidirectional == 0) { 3343 node_dhc->flag |= 3344 (NLP_REMOTE_AUTH | NLP_SET_REAUTH_TIME); 3345 3346 emlxs_dhc_state(port, ndlp, 3347 NODE_STATE_AUTH_SUCCESS, 0, 0); 3348 emlxs_log_auth_event(port, ndlp, ESC_EMLXS_20, 3349 "Host-initiated-unidir-auth-success"); 3350 emlxs_dhc_auth_complete(port, ndlp, 0); 3351 } else { 3352 /* bidir auth needed */ | 3337 node_dhc->nlp_auth_tranid_rsp); 3338 3339 ReasonCode = AUTHRJT_FAILURE; 3340 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 3341 goto AUTH_Reject; 3342 } 3343 if (node_dhc->auth_cfg.bidirectional == 0) { 3344 node_dhc->flag |= 3345 (NLP_REMOTE_AUTH | NLP_SET_REAUTH_TIME); 3346 3347 emlxs_dhc_state(port, ndlp, 3348 NODE_STATE_AUTH_SUCCESS, 0, 0); 3349 emlxs_log_auth_event(port, ndlp, ESC_EMLXS_20, 3350 "Host-initiated-unidir-auth-success"); 3351 emlxs_dhc_auth_complete(port, ndlp, 0); 3352 } else { 3353 /* bidir auth needed */ |
3353 /* if (SWAP_DATA32(dh_success->msg_len) > 4) { */ | 3354 /* if (LE_SWAP32(dh_success->msg_len) > 4) { */ |
3354 3355 tmp = (uint8_t *)((uint8_t *)lp); 3356 tmp += 8; 3357 tran_id = *(uint32_t *)tmp; 3358 tmp += 4; 3359 rsp_size = *(uint32_t *)tmp; 3360 tmp += 4; 3361 3362 /* tmp has the response from responder */ 3363 3364 /* 3365 * node_dhc->bi_cval has the bidir challenge value 3366 * from initiator 3367 */ 3368 | 3355 3356 tmp = (uint8_t *)((uint8_t *)lp); 3357 tmp += 8; 3358 tran_id = *(uint32_t *)tmp; 3359 tmp += 4; 3360 rsp_size = *(uint32_t *)tmp; 3361 tmp += 4; 3362 3363 /* tmp has the response from responder */ 3364 3365 /* 3366 * node_dhc->bi_cval has the bidir challenge value 3367 * from initiator 3368 */ 3369 |
3369 if (SWAP_DATA32(rsp_size) == 16) { 3370 bzero(un_cval.md5.val, SWAP_DATA32(rsp_size)); 3371 if (ndlp->nlp_DID == Fabric_DID) | 3370 if (LE_SWAP32(rsp_size) == 16) { 3371 bzero(un_cval.md5.val, LE_SWAP32(rsp_size)); 3372 if (ndlp->nlp_DID == FABRIC_DID) |
3372 bcopy((void *)node_dhc->bi_cval, 3373 (void *)un_cval.md5.val, | 3373 bcopy((void *)node_dhc->bi_cval, 3374 (void *)un_cval.md5.val, |
3374 SWAP_DATA32(rsp_size)); | 3375 LE_SWAP32(rsp_size)); |
3375 else 3376 bcopy( 3377 (void *)node_dhc->nlp_auth_misc.bi_cval, 3378 (void *)un_cval.md5.val, | 3376 else 3377 bcopy( 3378 (void *)node_dhc->nlp_auth_misc.bi_cval, 3379 (void *)un_cval.md5.val, |
3379 SWAP_DATA32(rsp_size)); | 3380 LE_SWAP32(rsp_size)); |
3380 | 3381 |
3381 } else if (SWAP_DATA32(rsp_size) == 20) { | 3382 } else if (LE_SWAP32(rsp_size) == 20) { |
3382 | 3383 |
3383 bzero(un_cval.sha1.val, SWAP_DATA32(rsp_size)); 3384 if (ndlp->nlp_DID == Fabric_DID) | 3384 bzero(un_cval.sha1.val, LE_SWAP32(rsp_size)); 3385 if (ndlp->nlp_DID == FABRIC_DID) |
3385 bcopy((void *)node_dhc->bi_cval, 3386 (void *)un_cval.sha1.val, | 3386 bcopy((void *)node_dhc->bi_cval, 3387 (void *)un_cval.sha1.val, |
3387 SWAP_DATA32(rsp_size)); | 3388 LE_SWAP32(rsp_size)); |
3388 else 3389 bcopy( 3390 (void *)node_dhc->nlp_auth_misc.bi_cval, 3391 (void *)un_cval.sha1.val, | 3389 else 3390 bcopy( 3391 (void *)node_dhc->nlp_auth_misc.bi_cval, 3392 (void *)un_cval.sha1.val, |
3392 SWAP_DATA32(rsp_size)); | 3393 LE_SWAP32(rsp_size)); |
3393 } 3394 /* verify the response */ 3395 /* NULL DHCHAP works for now */ 3396 /* for DH group as well */ 3397 3398 /* 3399 * Cai2 = H (C2 || ((g^x mod p)^y mod p) ) = H (C2 || 3400 * (g^xy mod p) ) 3401 * 3402 * R = H (Ti || Km || Cai2) R ?= R2 3403 */ 3404 hash_val = emlxs_hash_vrf(port, port_dhc, ndlp, 3405 tran_id, un_cval); 3406 3407 if (bcmp((void *)tmp, (void *)hash_val, | 3394 } 3395 /* verify the response */ 3396 /* NULL DHCHAP works for now */ 3397 /* for DH group as well */ 3398 3399 /* 3400 * Cai2 = H (C2 || ((g^x mod p)^y mod p) ) = H (C2 || 3401 * (g^xy mod p) ) 3402 * 3403 * R = H (Ti || Km || Cai2) R ?= R2 3404 */ 3405 hash_val = emlxs_hash_vrf(port, port_dhc, ndlp, 3406 tran_id, un_cval); 3407 3408 if (bcmp((void *)tmp, (void *)hash_val, |
3408 SWAP_DATA32(rsp_size))) { | 3409 LE_SWAP32(rsp_size))) { |
3409 if (hash_val != NULL) { 3410 /* not identical */ 3411 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 3412 "emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next: 0x%x.failed. %x", 3413 ndlp->nlp_DID, *(uint32_t *)hash_val); 3414 } 3415 ReasonCode = AUTHRJT_FAILURE; 3416 ReasonCodeExplanation = AUTHEXP_AUTH_FAILED; --- 34 unchanged lines hidden (view full) --- 3451/* 3452 * This routine should be set to emlxs_disc_neverdev as it shouldnot happen. 3453 * 3454 */ 3455/* ARGSUSED */ 3456static uint32_t 3457emlxs_cmpl_auth_msg_dhchap_reply_cmpl_wait4next( 3458emlxs_port_t *port, | 3410 if (hash_val != NULL) { 3411 /* not identical */ 3412 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 3413 "emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next: 0x%x.failed. %x", 3414 ndlp->nlp_DID, *(uint32_t *)hash_val); 3415 } 3416 ReasonCode = AUTHRJT_FAILURE; 3417 ReasonCodeExplanation = AUTHEXP_AUTH_FAILED; --- 34 unchanged lines hidden (view full) --- 3452/* 3453 * This routine should be set to emlxs_disc_neverdev as it shouldnot happen. 3454 * 3455 */ 3456/* ARGSUSED */ 3457static uint32_t 3458emlxs_cmpl_auth_msg_dhchap_reply_cmpl_wait4next( 3459emlxs_port_t *port, |
3459/* RING * rp, */ void *arg1, | 3460/* CHANNEL * rp, */ void *arg1, |
3460/* IOCBQ * iocbq, */ void *arg2, 3461/* MATCHMAP * mp, */ void *arg3, 3462/* NODELIST * ndlp */ void *arg4, 3463uint32_t evt) 3464{ 3465 NODELIST *ndlp = (NODELIST *)arg4; 3466 3467 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 26 unchanged lines hidden (view full) --- 3494 * DHCHAP_Reject, which could mean that the auth failed, then host should 3495 * send back ACC and set the next state to NPR_NODE. 3496 * 3497 */ 3498/* ARGSUSED */ 3499static uint32_t 3500emlxs_rcv_auth_msg_dhchap_success_issue_wait4next( 3501emlxs_port_t *port, | 3461/* IOCBQ * iocbq, */ void *arg2, 3462/* MATCHMAP * mp, */ void *arg3, 3463/* NODELIST * ndlp */ void *arg4, 3464uint32_t evt) 3465{ 3466 NODELIST *ndlp = (NODELIST *)arg4; 3467 3468 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 26 unchanged lines hidden (view full) --- 3495 * DHCHAP_Reject, which could mean that the auth failed, then host should 3496 * send back ACC and set the next state to NPR_NODE. 3497 * 3498 */ 3499/* ARGSUSED */ 3500static uint32_t 3501emlxs_rcv_auth_msg_dhchap_success_issue_wait4next( 3502emlxs_port_t *port, |
3502/* RING * rp, */ void *arg1, | 3503/* CHANNEL * rp, */ void *arg1, |
3503/* IOCBQ * iocbq, */ void *arg2, 3504/* MATCHMAP * mp, */ void *arg3, 3505/* NODELIST * ndlp */ void *arg4, 3506uint32_t evt) 3507{ 3508 NODELIST *ndlp = (NODELIST *) arg4; 3509 3510 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 15 unchanged lines hidden (view full) --- 3526 * Msg the host sent before. in case of ACC, set next state = REG_LOGIN. 3527 * in case of RJT, set next state = NPR_NODE. 3528 * 3529 */ 3530/* ARGSUSED */ 3531static uint32_t 3532emlxs_cmpl_auth_msg_dhchap_success_issue_wait4next( 3533emlxs_port_t *port, | 3504/* IOCBQ * iocbq, */ void *arg2, 3505/* MATCHMAP * mp, */ void *arg3, 3506/* NODELIST * ndlp */ void *arg4, 3507uint32_t evt) 3508{ 3509 NODELIST *ndlp = (NODELIST *) arg4; 3510 3511 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 15 unchanged lines hidden (view full) --- 3527 * Msg the host sent before. in case of ACC, set next state = REG_LOGIN. 3528 * in case of RJT, set next state = NPR_NODE. 3529 * 3530 */ 3531/* ARGSUSED */ 3532static uint32_t 3533emlxs_cmpl_auth_msg_dhchap_success_issue_wait4next( 3534emlxs_port_t *port, |
3534/* RING * rp, */ void *arg1, | 3535/* CHANNEL * rp, */ void *arg1, |
3535/* IOCBQ * iocbq, */ void *arg2, 3536/* MATCHMAP * mp, */ void *arg3, 3537/* NODELIST * ndlp */ void *arg4, 3538uint32_t evt) 3539{ 3540 NODELIST *ndlp = (NODELIST *)arg4; 3541 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3542 --- 28 unchanged lines hidden (view full) --- 3571 * The host is the auth responder and the auth transaction is still in 3572 * progress. 3573 * 3574 */ 3575/* ARGSUSED */ 3576static uint32_t 3577emlxs_cmpl_auth_msg_auth_negotiate_rcv( 3578emlxs_port_t *port, | 3536/* IOCBQ * iocbq, */ void *arg2, 3537/* MATCHMAP * mp, */ void *arg3, 3538/* NODELIST * ndlp */ void *arg4, 3539uint32_t evt) 3540{ 3541 NODELIST *ndlp = (NODELIST *)arg4; 3542 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3543 --- 28 unchanged lines hidden (view full) --- 3572 * The host is the auth responder and the auth transaction is still in 3573 * progress. 3574 * 3575 */ 3576/* ARGSUSED */ 3577static uint32_t 3578emlxs_cmpl_auth_msg_auth_negotiate_rcv( 3579emlxs_port_t *port, |
3579/* RING * rp, */ void *arg1, | 3580/* CHANNEL * rp, */ void *arg1, |
3580/* IOCBQ * iocbq, */ void *arg2, 3581/* MATCHMAP * mp, */ void *arg3, 3582/* NODELIST * ndlp */ void *arg4, 3583uint32_t evt) 3584{ 3585 NODELIST *ndlp = (NODELIST *)arg4; 3586 3587 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 17 unchanged lines hidden (view full) --- 3605 * 3606 * If DHCHAP_Reject, ACC and next state = NPR_NODE. anything else, RJT and 3607 * next state = NPR_NODE. 3608 */ 3609/* ARGSUSED */ 3610static uint32_t 3611emlxs_rcv_auth_msg_dhchap_challenge_issue( 3612emlxs_port_t *port, | 3581/* IOCBQ * iocbq, */ void *arg2, 3582/* MATCHMAP * mp, */ void *arg3, 3583/* NODELIST * ndlp */ void *arg4, 3584uint32_t evt) 3585{ 3586 NODELIST *ndlp = (NODELIST *)arg4; 3587 3588 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 17 unchanged lines hidden (view full) --- 3606 * 3607 * If DHCHAP_Reject, ACC and next state = NPR_NODE. anything else, RJT and 3608 * next state = NPR_NODE. 3609 */ 3610/* ARGSUSED */ 3611static uint32_t 3612emlxs_rcv_auth_msg_dhchap_challenge_issue( 3613emlxs_port_t *port, |
3613/* RING * rp, */ void *arg1, | 3614/* CHANNEL * rp, */ void *arg1, |
3614/* IOCBQ * iocbq, */ void *arg2, 3615/* MATCHMAP * mp, */ void *arg3, 3616/* NODELIST * ndlp */ void *arg4, 3617uint32_t evt) 3618{ 3619 NODELIST *ndlp = (NODELIST *)arg4; 3620 3621 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 16 unchanged lines hidden (view full) --- 3638 * host. In case of ACC, the next state = DHCHAP_CHALLENGE_CMPL_WAIT4NEXT 3639 * In case of RJT, the next state = NPR_NODE. 3640 * 3641 */ 3642/* ARGSUSED */ 3643static uint32_t 3644emlxs_cmpl_auth_msg_dhchap_challenge_issue( 3645emlxs_port_t *port, | 3615/* IOCBQ * iocbq, */ void *arg2, 3616/* MATCHMAP * mp, */ void *arg3, 3617/* NODELIST * ndlp */ void *arg4, 3618uint32_t evt) 3619{ 3620 NODELIST *ndlp = (NODELIST *)arg4; 3621 3622 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 16 unchanged lines hidden (view full) --- 3639 * host. In case of ACC, the next state = DHCHAP_CHALLENGE_CMPL_WAIT4NEXT 3640 * In case of RJT, the next state = NPR_NODE. 3641 * 3642 */ 3643/* ARGSUSED */ 3644static uint32_t 3645emlxs_cmpl_auth_msg_dhchap_challenge_issue( 3646emlxs_port_t *port, |
3646/* RING * rp, */ void *arg1, | 3647/* CHANNEL * rp, */ void *arg1, |
3647/* IOCBQ * iocbq, */ void *arg2, 3648/* MATCHMAP * mp, */ void *arg3, 3649/* NODELIST * ndlp */ void *arg4, 3650uint32_t evt) 3651{ 3652 NODELIST *ndlp = (NODELIST *)arg4; 3653 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3654 --- 43 unchanged lines hidden (view full) --- 3698 * For DHCHAP_Reject, send ACC and moved to the next state NPR_NODE. For 3699 * anything else, send RJT and moved to NPR_NODE. 3700 * 3701 */ 3702/* ARGSUSED */ 3703static uint32_t 3704emlxs_rcv_auth_msg_dhchap_challenge_cmpl_wait4next( 3705emlxs_port_t *port, | 3648/* IOCBQ * iocbq, */ void *arg2, 3649/* MATCHMAP * mp, */ void *arg3, 3650/* NODELIST * ndlp */ void *arg4, 3651uint32_t evt) 3652{ 3653 NODELIST *ndlp = (NODELIST *)arg4; 3654 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 3655 --- 43 unchanged lines hidden (view full) --- 3699 * For DHCHAP_Reject, send ACC and moved to the next state NPR_NODE. For 3700 * anything else, send RJT and moved to NPR_NODE. 3701 * 3702 */ 3703/* ARGSUSED */ 3704static uint32_t 3705emlxs_rcv_auth_msg_dhchap_challenge_cmpl_wait4next( 3706emlxs_port_t *port, |
3706/* RING * rp, */ void *arg1, | 3707/* CHANNEL * rp, */ void *arg1, |
3707/* IOCBQ * iocbq, */ void *arg2, 3708/* MATCHMAP * mp, */ void *arg3, 3709/* NODELIST * ndlp */ void *arg4, 3710uint32_t evt) 3711{ 3712 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 3713 IOCBQ *iocbq = (IOCBQ *)arg2; 3714 MATCHMAP *mp = (MATCHMAP *)arg3; --- 26 unchanged lines hidden (view full) --- 3741 * send back ELS AUTH_Reject or DHCHAP_Success msg based on the 3742 * verification result. i.e., hash computation etc. 3743 */ 3744 dh_reply = (DHCHAP_REPLY_HDR *)((uint8_t *)lp); 3745 tmp = (uint8_t *)((uint8_t *)lp); 3746 3747 tran_id = dh_reply->tran_id; 3748 | 3708/* IOCBQ * iocbq, */ void *arg2, 3709/* MATCHMAP * mp, */ void *arg3, 3710/* NODELIST * ndlp */ void *arg4, 3711uint32_t evt) 3712{ 3713 emlxs_port_dhc_t *port_dhc = &port->port_dhc; 3714 IOCBQ *iocbq = (IOCBQ *)arg2; 3715 MATCHMAP *mp = (MATCHMAP *)arg3; --- 26 unchanged lines hidden (view full) --- 3742 * send back ELS AUTH_Reject or DHCHAP_Success msg based on the 3743 * verification result. i.e., hash computation etc. 3744 */ 3745 dh_reply = (DHCHAP_REPLY_HDR *)((uint8_t *)lp); 3746 tmp = (uint8_t *)((uint8_t *)lp); 3747 3748 tran_id = dh_reply->tran_id; 3749 |
3749 if (SWAP_DATA32(tran_id) != node_dhc->nlp_auth_tranid_ini) { | 3750 if (LE_SWAP32(tran_id) != node_dhc->nlp_auth_tranid_ini) { |
3750 3751 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3752 "rcv_auth_msg_dhchap_challenge_cmpl_wait4next:0x%x 0x%x 0x%x", 3753 ndlp->nlp_DID, tran_id, node_dhc->nlp_auth_tranid_ini); 3754 3755 ReasonCode = AUTHRJT_FAILURE; 3756 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 3757 goto Reject; --- 67 unchanged lines hidden (view full) --- 3825 /* We must send out DHCHAP_Success msg and wait for ACC */ 3826 /* _AND_ if bi-dir auth, we have to wait for next */ 3827 3828 /* 3829 * Send back DHCHAP_Success or AUTH_Reject based on the 3830 * verification result 3831 */ 3832 tmp += sizeof (DHCHAP_REPLY_HDR); | 3751 3752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 3753 "rcv_auth_msg_dhchap_challenge_cmpl_wait4next:0x%x 0x%x 0x%x", 3754 ndlp->nlp_DID, tran_id, node_dhc->nlp_auth_tranid_ini); 3755 3756 ReasonCode = AUTHRJT_FAILURE; 3757 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 3758 goto Reject; --- 67 unchanged lines hidden (view full) --- 3826 /* We must send out DHCHAP_Success msg and wait for ACC */ 3827 /* _AND_ if bi-dir auth, we have to wait for next */ 3828 3829 /* 3830 * Send back DHCHAP_Success or AUTH_Reject based on the 3831 * verification result 3832 */ 3833 tmp += sizeof (DHCHAP_REPLY_HDR); |
3833 rsp_len = SWAP_DATA32(*(uint32_t *)tmp); | 3834 rsp_len = LE_SWAP32(*(uint32_t *)tmp); |
3834 tmp += sizeof (uint32_t); 3835 3836 /* collect the response data */ 3837 bcopy((void *)tmp, (void *)rsp, rsp_len); 3838 3839 tmp += rsp_len; | 3835 tmp += sizeof (uint32_t); 3836 3837 /* collect the response data */ 3838 bcopy((void *)tmp, (void *)rsp, rsp_len); 3839 3840 tmp += rsp_len; |
3840 dhval_len = SWAP_DATA32(*(uint32_t *)tmp); | 3841 dhval_len = LE_SWAP32(*(uint32_t *)tmp); |
3841 3842 tmp += sizeof (uint32_t); 3843 3844 3845 3846 if (dhval_len != 0) { 3847 /* collect the DH value */ 3848 bcopy((void *)tmp, (void *)dhval, dhval_len); 3849 tmp += dhval_len; 3850 } 3851 /* 3852 * Check to see if there is any challenge for bi-dir auth in 3853 * the reply msg 3854 */ | 3842 3843 tmp += sizeof (uint32_t); 3844 3845 3846 3847 if (dhval_len != 0) { 3848 /* collect the DH value */ 3849 bcopy((void *)tmp, (void *)dhval, dhval_len); 3850 tmp += dhval_len; 3851 } 3852 /* 3853 * Check to see if there is any challenge for bi-dir auth in 3854 * the reply msg 3855 */ |
3855 cval_len = SWAP_DATA32(*(uint32_t *)tmp); | 3856 cval_len = LE_SWAP32(*(uint32_t *)tmp); |
3856 if (cval_len != 0) { 3857 /* collect challenge value */ 3858 tmp += sizeof (uint32_t); 3859 bcopy((void *)tmp, (void *)cval, cval_len); 3860 | 3857 if (cval_len != 0) { 3858 /* collect challenge value */ 3859 tmp += sizeof (uint32_t); 3860 bcopy((void *)tmp, (void *)cval, cval_len); 3861 |
3861 if (ndlp->nlp_DID == Fabric_DID) { | 3862 if (ndlp->nlp_DID == FABRIC_DID) { |
3862 node_dhc->nlp_auth_bidir = 1; 3863 } else { 3864 node_dhc->nlp_auth_bidir = 1; 3865 } 3866 } else { 3867 node_dhc->nlp_auth_bidir = 0; 3868 } 3869 --- 85 unchanged lines hidden (view full) --- 3955/* 3956 * This routine should be emlxs_disc_neverdev. 3957 * 3958 */ 3959/* ARGSUSED */ 3960static uint32_t 3961emlxs_cmpl_auth_msg_dhchap_challenge_cmpl_wait4next( 3962emlxs_port_t *port, | 3863 node_dhc->nlp_auth_bidir = 1; 3864 } else { 3865 node_dhc->nlp_auth_bidir = 1; 3866 } 3867 } else { 3868 node_dhc->nlp_auth_bidir = 0; 3869 } 3870 --- 85 unchanged lines hidden (view full) --- 3956/* 3957 * This routine should be emlxs_disc_neverdev. 3958 * 3959 */ 3960/* ARGSUSED */ 3961static uint32_t 3962emlxs_cmpl_auth_msg_dhchap_challenge_cmpl_wait4next( 3963emlxs_port_t *port, |
3963/* RING * rp, */ void *arg1, | 3964/* CHANNEL * rp, */ void *arg1, |
3964/* IOCBQ * iocbq, */ void *arg2, 3965/* MATCHMAP * mp, */ void *arg3, 3966/* NODELIST * ndlp */ void *arg4, 3967uint32_t evt) 3968{ 3969 NODELIST *ndlp = (NODELIST *)arg4; 3970 3971 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 16 unchanged lines hidden (view full) --- 3988 * should not happen. If DHCHAP_Reject received, ACC back and move to next 3989 * state NPR_NODE. anything else, RJT and move to 3990 * NPR_NODE. 3991 */ 3992/* ARGSUSED */ 3993static uint32_t 3994emlxs_rcv_auth_msg_dhchap_success_issue( 3995emlxs_port_t *port, | 3965/* IOCBQ * iocbq, */ void *arg2, 3966/* MATCHMAP * mp, */ void *arg3, 3967/* NODELIST * ndlp */ void *arg4, 3968uint32_t evt) 3969{ 3970 NODELIST *ndlp = (NODELIST *)arg4; 3971 3972 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 16 unchanged lines hidden (view full) --- 3989 * should not happen. If DHCHAP_Reject received, ACC back and move to next 3990 * state NPR_NODE. anything else, RJT and move to 3991 * NPR_NODE. 3992 */ 3993/* ARGSUSED */ 3994static uint32_t 3995emlxs_rcv_auth_msg_dhchap_success_issue( 3996emlxs_port_t *port, |
3996/* RING * rp, */ void *arg1, | 3997/* CHANNEL * rp, */ void *arg1, |
3997/* IOCBQ * iocbq, */ void *arg2, 3998/* MATCHMAP * mp, */ void *arg3, 3999/* NODELIST * ndlp */ void *arg4, 4000uint32_t evt) 4001{ 4002 NODELIST *ndlp = (NODELIST *)arg4; 4003 4004 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 17 unchanged lines hidden (view full) --- 4022 * REG_LOGIN for bi-directional authentication, we will expect 4023 * DHCHAP_Success msg. so the next state = DHCHAP_SUCCESS_CMPL_WAIT4NEXT 4024 * and start the emlxs_dhc_authrsp_timeout timer 4025 */ 4026/* ARGSUSED */ 4027static uint32_t 4028emlxs_cmpl_auth_msg_dhchap_success_issue( 4029emlxs_port_t *port, | 3998/* IOCBQ * iocbq, */ void *arg2, 3999/* MATCHMAP * mp, */ void *arg3, 4000/* NODELIST * ndlp */ void *arg4, 4001uint32_t evt) 4002{ 4003 NODELIST *ndlp = (NODELIST *)arg4; 4004 4005 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 17 unchanged lines hidden (view full) --- 4023 * REG_LOGIN for bi-directional authentication, we will expect 4024 * DHCHAP_Success msg. so the next state = DHCHAP_SUCCESS_CMPL_WAIT4NEXT 4025 * and start the emlxs_dhc_authrsp_timeout timer 4026 */ 4027/* ARGSUSED */ 4028static uint32_t 4029emlxs_cmpl_auth_msg_dhchap_success_issue( 4030emlxs_port_t *port, |
4030/* RING * rp, */ void *arg1, | 4031/* CHANNEL * rp, */ void *arg1, |
4031/* IOCBQ * iocbq, */ void *arg2, 4032/* MATCHMAP * mp, */ void *arg3, 4033/* NODELIST * ndlp */ void *arg4, 4034uint32_t evt) 4035{ 4036 NODELIST *ndlp = (NODELIST *)arg4; 4037 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4038 --- 277 unchanged lines hidden (view full) --- 4316 4317} /* emlxs_device_recov_npr_node */ 4318 4319 4320/* ARGSUSED */ 4321static uint32_t 4322emlxs_device_rem_auth( 4323emlxs_port_t *port, | 4032/* IOCBQ * iocbq, */ void *arg2, 4033/* MATCHMAP * mp, */ void *arg3, 4034/* NODELIST * ndlp */ void *arg4, 4035uint32_t evt) 4036{ 4037 NODELIST *ndlp = (NODELIST *)arg4; 4038 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4039 --- 277 unchanged lines hidden (view full) --- 4317 4318} /* emlxs_device_recov_npr_node */ 4319 4320 4321/* ARGSUSED */ 4322static uint32_t 4323emlxs_device_rem_auth( 4324emlxs_port_t *port, |
4324/* RING * rp, */ void *arg1, | 4325/* CHANNEL * rp, */ void *arg1, |
4325/* IOCBQ * iocbq, */ void *arg2, 4326/* MATCHMAP * mp, */ void *arg3, 4327/* NODELIST * ndlp */ void *arg4, 4328uint32_t evt) 4329{ 4330 NODELIST *ndlp = (NODELIST *)arg4; 4331 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4332 --- 10 unchanged lines hidden (view full) --- 4343 4344/* 4345 * This routine is invoked when linkdown event happens during authentication 4346 */ 4347/* ARGSUSED */ 4348static uint32_t 4349emlxs_device_recov_auth( 4350emlxs_port_t *port, | 4326/* IOCBQ * iocbq, */ void *arg2, 4327/* MATCHMAP * mp, */ void *arg3, 4328/* NODELIST * ndlp */ void *arg4, 4329uint32_t evt) 4330{ 4331 NODELIST *ndlp = (NODELIST *)arg4; 4332 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4333 --- 10 unchanged lines hidden (view full) --- 4344 4345/* 4346 * This routine is invoked when linkdown event happens during authentication 4347 */ 4348/* ARGSUSED */ 4349static uint32_t 4350emlxs_device_recov_auth( 4351emlxs_port_t *port, |
4351/* RING * rp, */ void *arg1, | 4352/* CHANNEL * rp, */ void *arg1, |
4352/* IOCBQ * iocbq, */ void *arg2, 4353/* MATCHMAP * mp, */ void *arg3, 4354/* NODELIST * ndlp */ void *arg4, 4355uint32_t evt) 4356{ 4357 NODELIST *ndlp = (NODELIST *)arg4; 4358 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4359 --- 19 unchanged lines hidden (view full) --- 4379 * msg for the bi-directional authentication. 4380 * 4381 * next state should be REG_LOGIN 4382 */ 4383/* ARGSUSED */ 4384static uint32_t 4385emlxs_rcv_auth_msg_dhchap_success_cmpl_wait4next( 4386emlxs_port_t *port, | 4353/* IOCBQ * iocbq, */ void *arg2, 4354/* MATCHMAP * mp, */ void *arg3, 4355/* NODELIST * ndlp */ void *arg4, 4356uint32_t evt) 4357{ 4358 NODELIST *ndlp = (NODELIST *)arg4; 4359 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4360 --- 19 unchanged lines hidden (view full) --- 4380 * msg for the bi-directional authentication. 4381 * 4382 * next state should be REG_LOGIN 4383 */ 4384/* ARGSUSED */ 4385static uint32_t 4386emlxs_rcv_auth_msg_dhchap_success_cmpl_wait4next( 4387emlxs_port_t *port, |
4387/* RING * rp, */ void *arg1, | 4388/* CHANNEL * rp, */ void *arg1, |
4388/* IOCBQ * iocbq, */ void *arg2, 4389/* MATCHMAP * mp, */ void *arg3, 4390/* NODELIST * ndlp */ void *arg4, 4391uint32_t evt) 4392{ 4393 IOCBQ *iocbq = (IOCBQ *)arg2; 4394 MATCHMAP *mp = (MATCHMAP *)arg3; 4395 NODELIST *ndlp = (NODELIST *)arg4; --- 67 unchanged lines hidden (view full) --- 4463 ReasonCodeExplanation = AUTHEXP_AUTH_FAILED; 4464 break; 4465 4466 } 4467 4468 goto Reject; 4469 4470 } else if (dh_success->auth_msg_code == DHCHAP_SUCCESS) { | 4389/* IOCBQ * iocbq, */ void *arg2, 4390/* MATCHMAP * mp, */ void *arg3, 4391/* NODELIST * ndlp */ void *arg4, 4392uint32_t evt) 4393{ 4394 IOCBQ *iocbq = (IOCBQ *)arg2; 4395 MATCHMAP *mp = (MATCHMAP *)arg3; 4396 NODELIST *ndlp = (NODELIST *)arg4; --- 67 unchanged lines hidden (view full) --- 4464 ReasonCodeExplanation = AUTHEXP_AUTH_FAILED; 4465 break; 4466 4467 } 4468 4469 goto Reject; 4470 4471 } else if (dh_success->auth_msg_code == DHCHAP_SUCCESS) { |
4471 if (SWAP_DATA32(dh_success->tran_id) != | 4472 if (LE_SWAP32(dh_success->tran_id) != |
4472 node_dhc->nlp_auth_tranid_ini) { 4473 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4474 "rcv_a_m_dhch_success_cmpl_wait4next: 0x%x 0x%lx, 0x%lx", 4475 ndlp->nlp_DID, dh_success->tran_id, node_dhc->nlp_auth_tranid_ini); 4476 4477 ReasonCode = AUTHRJT_FAILURE; 4478 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 4479 goto Reject; --- 26 unchanged lines hidden (view full) --- 4506 4507} /* emlxs_rcv_auth_msg_dhchap_success_cmpl_wait4next */ 4508 4509 4510/* ARGSUSED */ 4511static uint32_t 4512emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next( 4513emlxs_port_t *port, | 4473 node_dhc->nlp_auth_tranid_ini) { 4474 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4475 "rcv_a_m_dhch_success_cmpl_wait4next: 0x%x 0x%lx, 0x%lx", 4476 ndlp->nlp_DID, dh_success->tran_id, node_dhc->nlp_auth_tranid_ini); 4477 4478 ReasonCode = AUTHRJT_FAILURE; 4479 ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; 4480 goto Reject; --- 26 unchanged lines hidden (view full) --- 4507 4508} /* emlxs_rcv_auth_msg_dhchap_success_cmpl_wait4next */ 4509 4510 4511/* ARGSUSED */ 4512static uint32_t 4513emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next( 4514emlxs_port_t *port, |
4514/* RING * rp, */ void *arg1, | 4515/* CHANNEL * rp, */ void *arg1, |
4515/* IOCBQ * iocbq, */ void *arg2, 4516/* MATCHMAP * mp, */ void *arg3, 4517/* NODELIST * ndlp */ void *arg4, 4518uint32_t evt) 4519{ 4520 4521 return (0); 4522 4523} /* emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next */ 4524 4525 4526/* ARGSUSED */ 4527static uint32_t 4528emlxs_rcv_auth_msg_auth_negotiate_rcv( 4529emlxs_port_t *port, | 4516/* IOCBQ * iocbq, */ void *arg2, 4517/* MATCHMAP * mp, */ void *arg3, 4518/* NODELIST * ndlp */ void *arg4, 4519uint32_t evt) 4520{ 4521 4522 return (0); 4523 4524} /* emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next */ 4525 4526 4527/* ARGSUSED */ 4528static uint32_t 4529emlxs_rcv_auth_msg_auth_negotiate_rcv( 4530emlxs_port_t *port, |
4530/* RING * rp, */ void *arg1, | 4531/* CHANNEL * rp, */ void *arg1, |
4531/* IOCBQ * iocbq, */ void *arg2, 4532/* MATCHMAP * mp, */ void *arg3, 4533/* NODELIST * ndlp */ void *arg4, 4534uint32_t evt) 4535{ 4536 NODELIST *ndlp = (NODELIST *)arg4; 4537 4538 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 4 unchanged lines hidden (view full) --- 4543 4544} /* emlxs_rcv_auth_msg_auth_negotiate_rcv */ 4545 4546 4547/* ARGSUSED */ 4548static uint32_t 4549emlxs_rcv_auth_msg_npr_node( 4550emlxs_port_t *port, | 4532/* IOCBQ * iocbq, */ void *arg2, 4533/* MATCHMAP * mp, */ void *arg3, 4534/* NODELIST * ndlp */ void *arg4, 4535uint32_t evt) 4536{ 4537 NODELIST *ndlp = (NODELIST *)arg4; 4538 4539 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, --- 4 unchanged lines hidden (view full) --- 4544 4545} /* emlxs_rcv_auth_msg_auth_negotiate_rcv */ 4546 4547 4548/* ARGSUSED */ 4549static uint32_t 4550emlxs_rcv_auth_msg_npr_node( 4551emlxs_port_t *port, |
4551/* RING * rp, */ void *arg1, | 4552/* CHANNEL * rp, */ void *arg1, |
4552/* IOCBQ * iocbq, */ void *arg2, 4553/* MATCHMAP * mp, */ void *arg3, 4554/* NODELIST * ndlp */ void *arg4, 4555 uint32_t evt) 4556{ 4557 IOCBQ *iocbq = (IOCBQ *)arg2; 4558 MATCHMAP *mp = (MATCHMAP *)arg3; 4559 NODELIST *ndlp = (NODELIST *)arg4; --- 28 unchanged lines hidden (view full) --- 4588 4589 msg = (AUTH_MSG_HDR *)((uint8_t *)lp); 4590 msglen = msg->msg_len; 4591 tmp = ((uint8_t *)lp); 4592 4593 /* temp is used for error checking */ 4594 temp = (uint8_t *)((uint8_t *)lp); 4595 /* Check the auth_els_code */ | 4553/* IOCBQ * iocbq, */ void *arg2, 4554/* MATCHMAP * mp, */ void *arg3, 4555/* NODELIST * ndlp */ void *arg4, 4556 uint32_t evt) 4557{ 4558 IOCBQ *iocbq = (IOCBQ *)arg2; 4559 MATCHMAP *mp = (MATCHMAP *)arg3; 4560 NODELIST *ndlp = (NODELIST *)arg4; --- 28 unchanged lines hidden (view full) --- 4589 4590 msg = (AUTH_MSG_HDR *)((uint8_t *)lp); 4591 msglen = msg->msg_len; 4592 tmp = ((uint8_t *)lp); 4593 4594 /* temp is used for error checking */ 4595 temp = (uint8_t *)((uint8_t *)lp); 4596 /* Check the auth_els_code */ |
4596 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x90000B01)) { | 4597 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x90000B01)) { |
4597 /* ReasonCode = AUTHRJT_FAILURE; */ 4598 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4599 4600 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4601 "emlxs_rcv_auth_msg_npr_node: payload(1)=0x%x", 4602 (*(uint32_t *)temp)); 4603 4604 goto AUTH_Reject; 4605 } 4606 temp += 3 * sizeof (uint32_t); 4607 /* Check name tag and name length */ | 4598 /* ReasonCode = AUTHRJT_FAILURE; */ 4599 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4600 4601 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4602 "emlxs_rcv_auth_msg_npr_node: payload(1)=0x%x", 4603 (*(uint32_t *)temp)); 4604 4605 goto AUTH_Reject; 4606 } 4607 temp += 3 * sizeof (uint32_t); 4608 /* Check name tag and name length */ |
4608 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x00010008)) { | 4609 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x00010008)) { |
4609 /* ReasonCode = AUTHRJT_FAILURE; */ 4610 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4611 4612 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4613 "emlxs_rcv_auth_msg_npr_node: payload(2)=0x%x", 4614 (*(uint32_t *)temp)); 4615 4616 goto AUTH_Reject; 4617 } 4618 temp += sizeof (uint32_t) + 8; 4619 /* Check proto_num */ | 4610 /* ReasonCode = AUTHRJT_FAILURE; */ 4611 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4612 4613 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4614 "emlxs_rcv_auth_msg_npr_node: payload(2)=0x%x", 4615 (*(uint32_t *)temp)); 4616 4617 goto AUTH_Reject; 4618 } 4619 temp += sizeof (uint32_t) + 8; 4620 /* Check proto_num */ |
4620 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x00000001)) { | 4621 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x00000001)) { |
4621 /* ReasonCode = AUTHRJT_FAILURE; */ 4622 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4623 4624 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4625 "emlxs_rcv_auth_msg_npr_node: payload(3)=0x%x", 4626 (*(uint32_t *)temp)); 4627 4628 goto AUTH_Reject; 4629 } 4630 temp += sizeof (uint32_t); 4631 /* Get para_len */ | 4622 /* ReasonCode = AUTHRJT_FAILURE; */ 4623 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4624 4625 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4626 "emlxs_rcv_auth_msg_npr_node: payload(3)=0x%x", 4627 (*(uint32_t *)temp)); 4628 4629 goto AUTH_Reject; 4630 } 4631 temp += sizeof (uint32_t); 4632 /* Get para_len */ |
4632 /* para_len = SWAP_DATA32(*(uint32_t *)temp); */ | 4633 /* para_len = LE_SWAP32(*(uint32_t *)temp); */ |
4633 4634 temp += sizeof (uint32_t); 4635 /* Check proto_id */ 4636 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != AUTH_DHCHAP) { 4637 /* ReasonCode = AUTHRJT_FAILURE; */ 4638 /* ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; */ 4639 4640 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4641 "emlxs_rcv_auth_msg_npr_node: payload(4)=0x%x", 4642 (*(uint32_t *)temp)); 4643 4644 goto AUTH_Reject; 4645 } 4646 temp += sizeof (uint32_t); 4647 /* Check hashlist tag */ | 4634 4635 temp += sizeof (uint32_t); 4636 /* Check proto_id */ 4637 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != AUTH_DHCHAP) { 4638 /* ReasonCode = AUTHRJT_FAILURE; */ 4639 /* ReasonCodeExplanation = AUTHEXP_BAD_PROTOCOL; */ 4640 4641 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4642 "emlxs_rcv_auth_msg_npr_node: payload(4)=0x%x", 4643 (*(uint32_t *)temp)); 4644 4645 goto AUTH_Reject; 4646 } 4647 temp += sizeof (uint32_t); 4648 /* Check hashlist tag */ |
4648 if ((SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4649 SWAP_DATA16(HASH_LIST_TAG)) { | 4649 if ((LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4650 LE_SWAP16(HASH_LIST_TAG)) { |
4650 /* ReasonCode = AUTHRJT_FAILURE; */ 4651 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4652 4653 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4654 "emlxs_rcv_auth_msg_npr_node: payload(5)=0x%x", | 4651 /* ReasonCode = AUTHRJT_FAILURE; */ 4652 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4653 4654 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4655 "emlxs_rcv_auth_msg_npr_node: payload(5)=0x%x", |
4655 (SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16); | 4656 (LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16); |
4656 4657 goto AUTH_Reject; 4658 } 4659 /* Get num_hs */ | 4657 4658 goto AUTH_Reject; 4659 } 4660 /* Get num_hs */ |
4660 num_hs = SWAP_DATA32(*(uint32_t *)temp) & 0x0000FFFF; | 4661 num_hs = LE_SWAP32(*(uint32_t *)temp) & 0x0000FFFF; |
4661 4662 temp += sizeof (uint32_t); 4663 /* Check HashList_value1 */ 4664 hs_id[0] = *(uint32_t *)temp; 4665 4666 if ((hs_id[0] != AUTH_MD5) && (hs_id[0] != AUTH_SHA1)) { 4667 /* ReasonCode = AUTHRJT_LOGIC_ERR; */ 4668 /* ReasonCodeExplanation = AUTHEXP_HASHFUNC_UNUSABLE; */ --- 67 unchanged lines hidden (view full) --- 4736 * Since the initiator specified two hashs, we always select 4737 * our first one. 4738 */ 4739 hash_id = node_dhc->auth_cfg.hash_priority[0]; 4740 } 4741 4742 temp += sizeof (uint32_t); 4743 /* Check DHgIDList_tag */ | 4662 4663 temp += sizeof (uint32_t); 4664 /* Check HashList_value1 */ 4665 hs_id[0] = *(uint32_t *)temp; 4666 4667 if ((hs_id[0] != AUTH_MD5) && (hs_id[0] != AUTH_SHA1)) { 4668 /* ReasonCode = AUTHRJT_LOGIC_ERR; */ 4669 /* ReasonCodeExplanation = AUTHEXP_HASHFUNC_UNUSABLE; */ --- 67 unchanged lines hidden (view full) --- 4737 * Since the initiator specified two hashs, we always select 4738 * our first one. 4739 */ 4740 hash_id = node_dhc->auth_cfg.hash_priority[0]; 4741 } 4742 4743 temp += sizeof (uint32_t); 4744 /* Check DHgIDList_tag */ |
4744 if ((SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4745 SWAP_DATA16(DHGID_LIST_TAG)) { | 4745 if ((LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4746 LE_SWAP16(DHGID_LIST_TAG)) { |
4746 /* ReasonCode = AUTHRJT_FAILURE; */ 4747 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4748 4749 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4750 "emlxs_rcv_auth_msg_npr_node: payload(11)=0x%lx", 4751 (*(uint32_t *)temp)); 4752 4753 goto AUTH_Reject; 4754 } 4755 /* Get num_dh */ | 4747 /* ReasonCode = AUTHRJT_FAILURE; */ 4748 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4749 4750 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4751 "emlxs_rcv_auth_msg_npr_node: payload(11)=0x%lx", 4752 (*(uint32_t *)temp)); 4753 4754 goto AUTH_Reject; 4755 } 4756 /* Get num_dh */ |
4756 num_dh = SWAP_DATA32(*(uint32_t *)temp) & 0x0000FFFF; | 4757 num_dh = LE_SWAP32(*(uint32_t *)temp) & 0x0000FFFF; |
4757 4758 if (num_dh == 0) { 4759 /* ReasonCode = AUTHRJT_FAILURE; */ 4760 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4761 4762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4763 "emlxs_rcv_auth_msg_npr_node: payload(12)=0x%lx", 4764 (*(uint32_t *)temp)); --- 30 unchanged lines hidden (view full) --- 4795 /* We should update the tran_id */ 4796 node_dhc->nlp_auth_tranid_ini = msg->tran_id; 4797 4798 if (msg->auth_msg_code == AUTH_NEGOTIATE) { 4799 node_dhc->nlp_auth_flag = 1; /* ndlp is the initiator */ 4800 4801 /* Send back the DHCHAP_Challenge with the proper paramaters */ 4802 if (emlxs_issue_dhchap_challenge(port, ndlp, 0, tmp, | 4758 4759 if (num_dh == 0) { 4760 /* ReasonCode = AUTHRJT_FAILURE; */ 4761 /* ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; */ 4762 4763 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 4764 "emlxs_rcv_auth_msg_npr_node: payload(12)=0x%lx", 4765 (*(uint32_t *)temp)); --- 30 unchanged lines hidden (view full) --- 4796 /* We should update the tran_id */ 4797 node_dhc->nlp_auth_tranid_ini = msg->tran_id; 4798 4799 if (msg->auth_msg_code == AUTH_NEGOTIATE) { 4800 node_dhc->nlp_auth_flag = 1; /* ndlp is the initiator */ 4801 4802 /* Send back the DHCHAP_Challenge with the proper paramaters */ 4803 if (emlxs_issue_dhchap_challenge(port, ndlp, 0, tmp, |
4803 SWAP_DATA32(msglen), | 4804 LE_SWAP32(msglen), |
4804 hash_id, dhgp_id)) { 4805 goto AUTH_Reject; 4806 } 4807 emlxs_dhc_state(port, ndlp, 4808 NODE_STATE_DHCHAP_CHALLENGE_ISSUE, 0, 0); 4809 4810 } else { 4811 goto AUTH_Reject; --- 10 unchanged lines hidden (view full) --- 4822 4823} /* emlxs_rcv_auth_msg_npr_node */ 4824 4825 4826/* ARGSUSED */ 4827static uint32_t 4828emlxs_cmpl_auth_msg_npr_node( 4829emlxs_port_t *port, | 4805 hash_id, dhgp_id)) { 4806 goto AUTH_Reject; 4807 } 4808 emlxs_dhc_state(port, ndlp, 4809 NODE_STATE_DHCHAP_CHALLENGE_ISSUE, 0, 0); 4810 4811 } else { 4812 goto AUTH_Reject; --- 10 unchanged lines hidden (view full) --- 4823 4824} /* emlxs_rcv_auth_msg_npr_node */ 4825 4826 4827/* ARGSUSED */ 4828static uint32_t 4829emlxs_cmpl_auth_msg_npr_node( 4830emlxs_port_t *port, |
4830/* RING * rp, */ void *arg1, | 4831/* CHANNEL * rp, */ void *arg1, |
4831/* IOCBQ * iocbq, */ void *arg2, 4832/* MATCHMAP * mp, */ void *arg3, 4833/* NODELIST * ndlp */ void *arg4, 4834uint32_t evt) 4835{ 4836 NODELIST *ndlp = (NODELIST *)arg4; 4837 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4838 --- 45 unchanged lines hidden (view full) --- 4884 * authentication initiator, while the Fx_Port shall become 4885 * the authentication responder. 4886 * 4887 */ 4888/* ARGSUSED */ 4889static uint32_t 4890emlxs_rcv_auth_msg_unmapped_node( 4891emlxs_port_t *port, | 4832/* IOCBQ * iocbq, */ void *arg2, 4833/* MATCHMAP * mp, */ void *arg3, 4834/* NODELIST * ndlp */ void *arg4, 4835uint32_t evt) 4836{ 4837 NODELIST *ndlp = (NODELIST *)arg4; 4838 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 4839 --- 45 unchanged lines hidden (view full) --- 4885 * authentication initiator, while the Fx_Port shall become 4886 * the authentication responder. 4887 * 4888 */ 4889/* ARGSUSED */ 4890static uint32_t 4891emlxs_rcv_auth_msg_unmapped_node( 4892emlxs_port_t *port, |
4892/* RING * rp, */ void *arg1, | 4893/* CHANNEL * rp, */ void *arg1, |
4893/* IOCBQ * iocbq, */ void *arg2, 4894/* MATCHMAP * mp, */ void *arg3, 4895/* NODELIST * ndlp */ void *arg4, 4896 uint32_t evt) 4897{ 4898 IOCBQ *iocbq = (IOCBQ *)arg2; 4899 MATCHMAP *mp = (MATCHMAP *)arg3; 4900 NODELIST *ndlp = (NODELIST *)arg4; --- 30 unchanged lines hidden (view full) --- 4931 msg = (AUTH_MSG_HDR *)((uint8_t *)lp); 4932 msglen = msg->msg_len; 4933 4934 tmp = ((uint8_t *)lp); 4935 4936 /* temp is used for error checking */ 4937 temp = (uint8_t *)((uint8_t *)lp); 4938 /* Check the auth_els_code */ | 4894/* IOCBQ * iocbq, */ void *arg2, 4895/* MATCHMAP * mp, */ void *arg3, 4896/* NODELIST * ndlp */ void *arg4, 4897 uint32_t evt) 4898{ 4899 IOCBQ *iocbq = (IOCBQ *)arg2; 4900 MATCHMAP *mp = (MATCHMAP *)arg3; 4901 NODELIST *ndlp = (NODELIST *)arg4; --- 30 unchanged lines hidden (view full) --- 4932 msg = (AUTH_MSG_HDR *)((uint8_t *)lp); 4933 msglen = msg->msg_len; 4934 4935 tmp = ((uint8_t *)lp); 4936 4937 /* temp is used for error checking */ 4938 temp = (uint8_t *)((uint8_t *)lp); 4939 /* Check the auth_els_code */ |
4939 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x90000B01)) { | 4940 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x90000B01)) { |
4940 ReasonCode = AUTHRJT_FAILURE; 4941 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4942 4943 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4944 "emlxs_rcv_auth_msg_unmapped_node: payload(1)=0x%x", 4945 (*(uint32_t *)temp)); 4946 4947 goto AUTH_Reject; 4948 } 4949 temp += 3 * sizeof (uint32_t); 4950 /* Check name tag and name length */ | 4941 ReasonCode = AUTHRJT_FAILURE; 4942 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4943 4944 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4945 "emlxs_rcv_auth_msg_unmapped_node: payload(1)=0x%x", 4946 (*(uint32_t *)temp)); 4947 4948 goto AUTH_Reject; 4949 } 4950 temp += 3 * sizeof (uint32_t); 4951 /* Check name tag and name length */ |
4951 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x00010008)) { | 4952 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x00010008)) { |
4952 ReasonCode = AUTHRJT_FAILURE; 4953 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4954 4955 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4956 "emlxs_rcv_auth_msg_unmapped_node: payload(2)=0x%x", 4957 (*(uint32_t *)temp)); 4958 4959 goto AUTH_Reject; 4960 } 4961 temp += sizeof (uint32_t) + 8; 4962 /* Check proto_num */ | 4953 ReasonCode = AUTHRJT_FAILURE; 4954 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4955 4956 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4957 "emlxs_rcv_auth_msg_unmapped_node: payload(2)=0x%x", 4958 (*(uint32_t *)temp)); 4959 4960 goto AUTH_Reject; 4961 } 4962 temp += sizeof (uint32_t) + 8; 4963 /* Check proto_num */ |
4963 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != SWAP_DATA32(0x00000001)) { | 4964 if (((*(uint32_t *)temp) & 0xFFFFFFFF) != LE_SWAP32(0x00000001)) { |
4964 ReasonCode = AUTHRJT_FAILURE; 4965 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4966 4967 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4968 "emlxs_rcv_auth_msg_unmapped_node: payload(3)=0x%x", 4969 (*(uint32_t *)temp)); 4970 4971 goto AUTH_Reject; --- 12 unchanged lines hidden (view full) --- 4984 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4985 "emlxs_rcv_auth_msg_unmapped_node: payload(4)=0x%x", 4986 (*(uint32_t *)temp)); 4987 4988 goto AUTH_Reject; 4989 } 4990 temp += sizeof (uint32_t); 4991 /* Check hashlist tag */ | 4965 ReasonCode = AUTHRJT_FAILURE; 4966 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4967 4968 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4969 "emlxs_rcv_auth_msg_unmapped_node: payload(3)=0x%x", 4970 (*(uint32_t *)temp)); 4971 4972 goto AUTH_Reject; --- 12 unchanged lines hidden (view full) --- 4985 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4986 "emlxs_rcv_auth_msg_unmapped_node: payload(4)=0x%x", 4987 (*(uint32_t *)temp)); 4988 4989 goto AUTH_Reject; 4990 } 4991 temp += sizeof (uint32_t); 4992 /* Check hashlist tag */ |
4992 if ((SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4993 SWAP_DATA16(HASH_LIST_TAG)) { | 4993 if ((LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 4994 LE_SWAP16(HASH_LIST_TAG)) { |
4994 ReasonCode = AUTHRJT_FAILURE; 4995 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4996 4997 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4998 "emlxs_rcv_auth_msg_unmapped_node: payload(5)=0x%x", | 4995 ReasonCode = AUTHRJT_FAILURE; 4996 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 4997 4998 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 4999 "emlxs_rcv_auth_msg_unmapped_node: payload(5)=0x%x", |
4999 (SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16); | 5000 (LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16); |
5000 5001 goto AUTH_Reject; 5002 } 5003 /* Get num_hs */ | 5001 5002 goto AUTH_Reject; 5003 } 5004 /* Get num_hs */ |
5004 num_hs = SWAP_DATA32(*(uint32_t *)temp) & 0x0000FFFF; | 5005 num_hs = LE_SWAP32(*(uint32_t *)temp) & 0x0000FFFF; |
5005 5006 temp += sizeof (uint32_t); 5007 /* Check HashList_value1 */ 5008 hs_id[0] = *(uint32_t *)temp; 5009 5010 if ((hs_id[0] != AUTH_MD5) && (hs_id[0] != AUTH_SHA1)) { 5011 ReasonCode = AUTHRJT_LOGIC_ERR; 5012 ReasonCodeExplanation = AUTHEXP_HASHFUNC_UNUSABLE; --- 67 unchanged lines hidden (view full) --- 5080 * Since the initiator specified two hashs, we always select 5081 * our first one. 5082 */ 5083 hash_id = node_dhc->auth_cfg.hash_priority[0]; 5084 } 5085 5086 temp += sizeof (uint32_t); 5087 /* Check DHgIDList_tag */ | 5006 5007 temp += sizeof (uint32_t); 5008 /* Check HashList_value1 */ 5009 hs_id[0] = *(uint32_t *)temp; 5010 5011 if ((hs_id[0] != AUTH_MD5) && (hs_id[0] != AUTH_SHA1)) { 5012 ReasonCode = AUTHRJT_LOGIC_ERR; 5013 ReasonCodeExplanation = AUTHEXP_HASHFUNC_UNUSABLE; --- 67 unchanged lines hidden (view full) --- 5081 * Since the initiator specified two hashs, we always select 5082 * our first one. 5083 */ 5084 hash_id = node_dhc->auth_cfg.hash_priority[0]; 5085 } 5086 5087 temp += sizeof (uint32_t); 5088 /* Check DHgIDList_tag */ |
5088 if ((SWAP_DATA32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 5089 SWAP_DATA16(DHGID_LIST_TAG)) { | 5089 if ((LE_SWAP32(*(uint32_t *)temp) & 0xFFFF0000) >> 16 != 5090 LE_SWAP16(DHGID_LIST_TAG)) { |
5090 ReasonCode = AUTHRJT_FAILURE; 5091 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 5092 5093 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5094 "emlxs_rcv_auth_msg_unmapped_node: payload(11)=0x%x", 5095 (*(uint32_t *)temp)); 5096 5097 goto AUTH_Reject; 5098 } 5099 /* Get num_dh */ | 5091 ReasonCode = AUTHRJT_FAILURE; 5092 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 5093 5094 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5095 "emlxs_rcv_auth_msg_unmapped_node: payload(11)=0x%x", 5096 (*(uint32_t *)temp)); 5097 5098 goto AUTH_Reject; 5099 } 5100 /* Get num_dh */ |
5100 num_dh = SWAP_DATA32(*(uint32_t *)temp) & 0x0000FFFF; | 5101 num_dh = LE_SWAP32(*(uint32_t *)temp) & 0x0000FFFF; |
5101 5102 if (num_dh == 0) { 5103 ReasonCode = AUTHRJT_FAILURE; 5104 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 5105 5106 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5107 "emlxs_rcv_auth_msg_unmapped_node: payload(12)=0x%x", 5108 (*(uint32_t *)temp)); --- 30 unchanged lines hidden (view full) --- 5139 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5140 "emlxs_rcv_auth_msg_unmapped_node: 0x%x 0x%x 0x%x 0x%x 0x%x", 5141 hash_id, dhgp_id, msg->auth_msg_code, msglen, msg->tran_id); 5142 5143 /* 5144 * since ndlp is the initiator, tran_id is store in 5145 * nlp_auth_tranid_ini 5146 */ | 5102 5103 if (num_dh == 0) { 5104 ReasonCode = AUTHRJT_FAILURE; 5105 ReasonCodeExplanation = AUTHEXP_BAD_PAYLOAD; 5106 5107 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5108 "emlxs_rcv_auth_msg_unmapped_node: payload(12)=0x%x", 5109 (*(uint32_t *)temp)); --- 30 unchanged lines hidden (view full) --- 5140 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5141 "emlxs_rcv_auth_msg_unmapped_node: 0x%x 0x%x 0x%x 0x%x 0x%x", 5142 hash_id, dhgp_id, msg->auth_msg_code, msglen, msg->tran_id); 5143 5144 /* 5145 * since ndlp is the initiator, tran_id is store in 5146 * nlp_auth_tranid_ini 5147 */ |
5147 node_dhc->nlp_auth_tranid_ini = SWAP_DATA32(msg->tran_id); | 5148 node_dhc->nlp_auth_tranid_ini = LE_SWAP32(msg->tran_id); |
5148 5149 if (msg->auth_msg_code == AUTH_NEGOTIATE) { 5150 5151 /* 5152 * at this point, we know for sure we received the 5153 * auth-negotiate msg from another entity, so cancel the 5154 * auth-rsp timeout timer if we are expecting it. should 5155 * never happen? --- 18 unchanged lines hidden (view full) --- 5174 5175 ReasonCode = AUTHRJT_LOGIC_ERR; 5176 ReasonCodeExplanation = AUTHEXP_AUTHTRAN_STARTED; 5177 5178 goto AUTH_Reject; 5179 } 5180 /* Send back the DHCHAP_Challenge with the proper paramaters */ 5181 if (emlxs_issue_dhchap_challenge(port, ndlp, 0, tmp, | 5149 5150 if (msg->auth_msg_code == AUTH_NEGOTIATE) { 5151 5152 /* 5153 * at this point, we know for sure we received the 5154 * auth-negotiate msg from another entity, so cancel the 5155 * auth-rsp timeout timer if we are expecting it. should 5156 * never happen? --- 18 unchanged lines hidden (view full) --- 5175 5176 ReasonCode = AUTHRJT_LOGIC_ERR; 5177 ReasonCodeExplanation = AUTHEXP_AUTHTRAN_STARTED; 5178 5179 goto AUTH_Reject; 5180 } 5181 /* Send back the DHCHAP_Challenge with the proper paramaters */ 5182 if (emlxs_issue_dhchap_challenge(port, ndlp, 0, tmp, |
5182 SWAP_DATA32(msglen), | 5183 LE_SWAP32(msglen), |
5183 hash_id, dhgp_id)) { 5184 5185 goto AUTH_Reject; 5186 } 5187 /* setup the proper state */ 5188 emlxs_dhc_state(port, ndlp, 5189 NODE_STATE_DHCHAP_CHALLENGE_ISSUE, 0, 0); 5190 --- 79 unchanged lines hidden (view full) --- 5270 SHA1_CTX sha1ctx; 5271 uint8_t sha1_digest[20]; 5272 uint8_t md5_digest[16]; 5273 uint8_t mytran_id = 0x00; 5274 5275 char *remote_key; 5276 5277 tran_id = (AUTH_TRAN_ID_MASK & tran_id); | 5184 hash_id, dhgp_id)) { 5185 5186 goto AUTH_Reject; 5187 } 5188 /* setup the proper state */ 5189 emlxs_dhc_state(port, ndlp, 5190 NODE_STATE_DHCHAP_CHALLENGE_ISSUE, 0, 0); 5191 --- 79 unchanged lines hidden (view full) --- 5271 SHA1_CTX sha1ctx; 5272 uint8_t sha1_digest[20]; 5273 uint8_t md5_digest[16]; 5274 uint8_t mytran_id = 0x00; 5275 5276 char *remote_key; 5277 5278 tran_id = (AUTH_TRAN_ID_MASK & tran_id); |
5278 mytran_id = (uint8_t)(SWAP_DATA32(tran_id)); | 5279 mytran_id = (uint8_t)(LE_SWAP32(tran_id)); |
5279 5280 | 5280 5281 |
5281 if (ndlp->nlp_DID == Fabric_DID) { | 5282 if (ndlp->nlp_DID == FABRIC_DID) { |
5282 remote_key = (char *)node_dhc->auth_key.remote_password; 5283 hash_id = node_dhc->hash_id; 5284 dhgp_id = node_dhc->dhgp_id; 5285 } else { 5286 remote_key = (char *)node_dhc->auth_key.remote_password; 5287 hash_id = node_dhc->nlp_auth_hashid; 5288 dhgp_id = node_dhc->nlp_auth_dhgpid; 5289 } --- 78 unchanged lines hidden (view full) --- 5368 bzero(&mdctx, sizeof (MD5_CTX)); 5369 hash_size = MD5_LEN; 5370 5371 MD5Init(&mdctx); 5372 5373 MD5Update(&mdctx, 5374 (void *)&(un_cval.md5.val[0]), MD5_LEN); 5375 | 5283 remote_key = (char *)node_dhc->auth_key.remote_password; 5284 hash_id = node_dhc->hash_id; 5285 dhgp_id = node_dhc->dhgp_id; 5286 } else { 5287 remote_key = (char *)node_dhc->auth_key.remote_password; 5288 hash_id = node_dhc->nlp_auth_hashid; 5289 dhgp_id = node_dhc->nlp_auth_dhgpid; 5290 } --- 78 unchanged lines hidden (view full) --- 5369 bzero(&mdctx, sizeof (MD5_CTX)); 5370 hash_size = MD5_LEN; 5371 5372 MD5Init(&mdctx); 5373 5374 MD5Update(&mdctx, 5375 (void *)&(un_cval.md5.val[0]), MD5_LEN); 5376 |
5376 if (ndlp->nlp_DID == Fabric_DID) { | 5377 if (ndlp->nlp_DID == FABRIC_DID) { |
5377 MD5Update(&mdctx, 5378 (void *)&node_dhc->ses_key[0], 5379 node_dhc->seskey_len); 5380 } else { 5381 /* ses_key is obtained in emlxs_hash_rsp */ 5382 MD5Update(&mdctx, 5383 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5384 node_dhc->nlp_auth_misc.seskey_len); --- 25 unchanged lines hidden (view full) --- 5410 bzero(&sha1ctx, sizeof (SHA1_CTX)); 5411 hash_size = SHA1_LEN; 5412 5413 SHA1Init(&sha1ctx); 5414 5415 SHA1Update(&sha1ctx, 5416 (void *)&(un_cval.sha1.val[0]), SHA1_LEN); 5417 | 5378 MD5Update(&mdctx, 5379 (void *)&node_dhc->ses_key[0], 5380 node_dhc->seskey_len); 5381 } else { 5382 /* ses_key is obtained in emlxs_hash_rsp */ 5383 MD5Update(&mdctx, 5384 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5385 node_dhc->nlp_auth_misc.seskey_len); --- 25 unchanged lines hidden (view full) --- 5411 bzero(&sha1ctx, sizeof (SHA1_CTX)); 5412 hash_size = SHA1_LEN; 5413 5414 SHA1Init(&sha1ctx); 5415 5416 SHA1Update(&sha1ctx, 5417 (void *)&(un_cval.sha1.val[0]), SHA1_LEN); 5418 |
5418 if (ndlp->nlp_DID == Fabric_DID) { | 5419 if (ndlp->nlp_DID == FABRIC_DID) { |
5419 SHA1Update(&sha1ctx, 5420 (void *)&node_dhc->ses_key[0], 5421 node_dhc->seskey_len); 5422 } else { 5423 /* ses_key was obtained in emlxs_hash_rsp */ 5424 SHA1Update(&sha1ctx, 5425 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5426 node_dhc->nlp_auth_misc.seskey_len); --- 55 unchanged lines hidden (view full) --- 5482 SHA1_CTX sha1ctx; 5483 uint8_t sha1_digest[20]; 5484 uint8_t md5_digest[16]; 5485 uint8_t Cai[20]; 5486 uint8_t mytran_id = 0x00; 5487 char *mykey; 5488 BIG_ERR_CODE err = BIG_OK; 5489 | 5420 SHA1Update(&sha1ctx, 5421 (void *)&node_dhc->ses_key[0], 5422 node_dhc->seskey_len); 5423 } else { 5424 /* ses_key was obtained in emlxs_hash_rsp */ 5425 SHA1Update(&sha1ctx, 5426 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5427 node_dhc->nlp_auth_misc.seskey_len); --- 55 unchanged lines hidden (view full) --- 5483 SHA1_CTX sha1ctx; 5484 uint8_t sha1_digest[20]; 5485 uint8_t md5_digest[16]; 5486 uint8_t Cai[20]; 5487 uint8_t mytran_id = 0x00; 5488 char *mykey; 5489 BIG_ERR_CODE err = BIG_OK; 5490 |
5490 if (ndlp->nlp_DID == Fabric_DID) { | 5491 if (ndlp->nlp_DID == FABRIC_DID) { |
5491 hash_id = node_dhc->hash_id; 5492 dhgp_id = node_dhc->dhgp_id; 5493 } else { 5494 hash_id = node_dhc->nlp_auth_hashid; 5495 dhgp_id = node_dhc->nlp_auth_dhgpid; 5496 } 5497 5498 tran_id = (AUTH_TRAN_ID_MASK & tran_id); | 5492 hash_id = node_dhc->hash_id; 5493 dhgp_id = node_dhc->dhgp_id; 5494 } else { 5495 hash_id = node_dhc->nlp_auth_hashid; 5496 dhgp_id = node_dhc->nlp_auth_dhgpid; 5497 } 5498 5499 tran_id = (AUTH_TRAN_ID_MASK & tran_id); |
5499 mytran_id = (uint8_t)(SWAP_DATA32(tran_id)); | 5500 mytran_id = (uint8_t)(LE_SWAP32(tran_id)); |
5500 5501 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5502 "emlxs_hash_rsp: 0x%x 0x%x 0x%x 0x%x dhvallen=0x%x", 5503 ndlp->nlp_DID, hash_id, dhgp_id, mytran_id, dhvallen); 5504 | 5501 5502 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 5503 "emlxs_hash_rsp: 0x%x 0x%x 0x%x 0x%x dhvallen=0x%x", 5504 ndlp->nlp_DID, hash_id, dhgp_id, mytran_id, dhvallen); 5505 |
5505 if (ndlp->nlp_DID == Fabric_DID) { | 5506 if (ndlp->nlp_DID == FABRIC_DID) { |
5506 mykey = (char *)node_dhc->auth_key.local_password; 5507 5508 } else { 5509 mykey = (char *)node_dhc->auth_key.local_password; 5510 } 5511 5512 if (dhval == NULL) { 5513 /* NULL DHCHAP */ --- 167 unchanged lines hidden (view full) --- 5681 uint32_t hash_id; 5682 MD5_CTX mdctx; 5683 SHA1_CTX sha1ctx; 5684 uint8_t sha1_digest[20]; 5685 uint8_t md5_digest[16]; 5686 uint32_t hash_size; 5687 BIG_ERR_CODE err = BIG_OK; 5688 | 5507 mykey = (char *)node_dhc->auth_key.local_password; 5508 5509 } else { 5510 mykey = (char *)node_dhc->auth_key.local_password; 5511 } 5512 5513 if (dhval == NULL) { 5514 /* NULL DHCHAP */ --- 167 unchanged lines hidden (view full) --- 5682 uint32_t hash_id; 5683 MD5_CTX mdctx; 5684 SHA1_CTX sha1ctx; 5685 uint8_t sha1_digest[20]; 5686 uint8_t md5_digest[16]; 5687 uint32_t hash_size; 5688 BIG_ERR_CODE err = BIG_OK; 5689 |
5689 if (ndlp->nlp_DID == Fabric_DID) { | 5690 if (ndlp->nlp_DID == FABRIC_DID) { |
5690 hash_id = node_dhc->hash_id; 5691 dhgp_id = node_dhc->dhgp_id; 5692 } else { 5693 hash_id = node_dhc->nlp_auth_hashid; 5694 dhgp_id = node_dhc->nlp_auth_dhgpid; 5695 } 5696 5697 if (hash_id == AUTH_MD5) { --- 8 unchanged lines hidden (view full) --- 5706 * p) and stored them in the partner's ndlp structure 5707 */ 5708 err = emlxs_BIGNUM_get_pubkey(port, port_dhc, ndlp, 5709 dhval, dhvallen, hash_size, dhgp_id); 5710 5711 if (err != BIG_OK) { 5712 return (err); 5713 } | 5691 hash_id = node_dhc->hash_id; 5692 dhgp_id = node_dhc->dhgp_id; 5693 } else { 5694 hash_id = node_dhc->nlp_auth_hashid; 5695 dhgp_id = node_dhc->nlp_auth_dhgpid; 5696 } 5697 5698 if (hash_id == AUTH_MD5) { --- 8 unchanged lines hidden (view full) --- 5707 * p) and stored them in the partner's ndlp structure 5708 */ 5709 err = emlxs_BIGNUM_get_pubkey(port, port_dhc, ndlp, 5710 dhval, dhvallen, hash_size, dhgp_id); 5711 5712 if (err != BIG_OK) { 5713 return (err); 5714 } |
5714 if (ndlp->nlp_DID == Fabric_DID) { | 5715 if (ndlp->nlp_DID == FABRIC_DID) { |
5715 MD5Update(&mdctx, 5716 (unsigned char *)&node_dhc->ses_key[0], 5717 node_dhc->seskey_len); 5718 } else { 5719 MD5Update(&mdctx, 5720 (unsigned char *)&node_dhc->nlp_auth_misc.ses_key[0], 5721 node_dhc->nlp_auth_misc.seskey_len); 5722 } --- 13 unchanged lines hidden (view full) --- 5736 5737 /* get the pub key and session key */ 5738 err = emlxs_BIGNUM_get_pubkey(port, port_dhc, ndlp, 5739 dhval, dhvallen, hash_size, dhgp_id); 5740 5741 if (err != BIG_OK) { 5742 return (err); 5743 } | 5716 MD5Update(&mdctx, 5717 (unsigned char *)&node_dhc->ses_key[0], 5718 node_dhc->seskey_len); 5719 } else { 5720 MD5Update(&mdctx, 5721 (unsigned char *)&node_dhc->nlp_auth_misc.ses_key[0], 5722 node_dhc->nlp_auth_misc.seskey_len); 5723 } --- 13 unchanged lines hidden (view full) --- 5737 5738 /* get the pub key and session key */ 5739 err = emlxs_BIGNUM_get_pubkey(port, port_dhc, ndlp, 5740 dhval, dhvallen, hash_size, dhgp_id); 5741 5742 if (err != BIG_OK) { 5743 return (err); 5744 } |
5744 if (ndlp->nlp_DID == Fabric_DID) { | 5745 if (ndlp->nlp_DID == FABRIC_DID) { |
5745 SHA1Update(&sha1ctx, (void *)&node_dhc->ses_key[0], 5746 node_dhc->seskey_len); 5747 } else { 5748 SHA1Update(&sha1ctx, 5749 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5750 node_dhc->nlp_auth_misc.seskey_len); 5751 } 5752 --- 154 unchanged lines hidden (view full) --- 5907 5908 if (big_modexp(&result, &a, &e, &n, NULL) != BIG_OK) { 5909 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 5910 "emlxs_BIGNUM_get_pubkey: big_modexp result error"); 5911 err = BIG_NO_MEM; 5912 goto ret4; 5913 } 5914 /* convert big number ses_key to bytestring */ | 5746 SHA1Update(&sha1ctx, (void *)&node_dhc->ses_key[0], 5747 node_dhc->seskey_len); 5748 } else { 5749 SHA1Update(&sha1ctx, 5750 (void *)&node_dhc->nlp_auth_misc.ses_key[0], 5751 node_dhc->nlp_auth_misc.seskey_len); 5752 } 5753 --- 154 unchanged lines hidden (view full) --- 5908 5909 if (big_modexp(&result, &a, &e, &n, NULL) != BIG_OK) { 5910 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 5911 "emlxs_BIGNUM_get_pubkey: big_modexp result error"); 5912 err = BIG_NO_MEM; 5913 goto ret4; 5914 } 5915 /* convert big number ses_key to bytestring */ |
5915 if (ndlp->nlp_DID == Fabric_DID) { | 5916 if (ndlp->nlp_DID == FABRIC_DID) { |
5916 /* 5917 * This call converts from big number format to 5918 * byte-big-endian format. big number format is words in 5919 * little endian order, but bytes within words in native byte 5920 * order 5921 */ 5922 bignum2bytestring(node_dhc->ses_key, &result, 5923 sizeof (BIG_CHUNK_TYPE) * (result.len)); --- 39 unchanged lines hidden (view full) --- 5963 5964 if (big_modexp(&result1, &g, &e, &n, NULL) != BIG_OK) { 5965 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 5966 "emlxs_BIGNUM_get_pubkey: big_modexp result1 error"); 5967 err = BIG_NO_MEM; 5968 goto ret6; 5969 } 5970 /* convert big number pub_key to bytestring */ | 5917 /* 5918 * This call converts from big number format to 5919 * byte-big-endian format. big number format is words in 5920 * little endian order, but bytes within words in native byte 5921 * order 5922 */ 5923 bignum2bytestring(node_dhc->ses_key, &result, 5924 sizeof (BIG_CHUNK_TYPE) * (result.len)); --- 39 unchanged lines hidden (view full) --- 5964 5965 if (big_modexp(&result1, &g, &e, &n, NULL) != BIG_OK) { 5966 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 5967 "emlxs_BIGNUM_get_pubkey: big_modexp result1 error"); 5968 err = BIG_NO_MEM; 5969 goto ret6; 5970 } 5971 /* convert big number pub_key to bytestring */ |
5971 if (ndlp->nlp_DID == Fabric_DID) { | 5972 if (ndlp->nlp_DID == FABRIC_DID) { |
5972 5973 bignum2bytestring(node_dhc->pub_key, &result1, 5974 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 5975 node_dhc->pubkey_len = (result1.len) * sizeof (BIG_CHUNK_TYPE); 5976 5977 /* save another copy in ndlp */ 5978 bignum2bytestring(node_dhc->nlp_auth_misc.pub_key, &result1, 5979 sizeof (BIG_CHUNK_TYPE) * (result1.len)); --- 129 unchanged lines hidden (view full) --- 6109 if (big_modexp(&result1, &g, &e, &n, NULL) != BIG_OK) { 6110 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6111 "emlxs_BIGNUM_get_dhval: big_modexp result1 error"); 6112 6113 err = BIG_GENERAL_ERR; 6114 goto ret4; 6115 } 6116 /* convert big number pub_key to bytestring */ | 5973 5974 bignum2bytestring(node_dhc->pub_key, &result1, 5975 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 5976 node_dhc->pubkey_len = (result1.len) * sizeof (BIG_CHUNK_TYPE); 5977 5978 /* save another copy in ndlp */ 5979 bignum2bytestring(node_dhc->nlp_auth_misc.pub_key, &result1, 5980 sizeof (BIG_CHUNK_TYPE) * (result1.len)); --- 129 unchanged lines hidden (view full) --- 6110 if (big_modexp(&result1, &g, &e, &n, NULL) != BIG_OK) { 6111 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6112 "emlxs_BIGNUM_get_dhval: big_modexp result1 error"); 6113 6114 err = BIG_GENERAL_ERR; 6115 goto ret4; 6116 } 6117 /* convert big number pub_key to bytestring */ |
6117 if (ndlp->nlp_DID == Fabric_DID) { | 6118 if (ndlp->nlp_DID == FABRIC_DID) { |
6118 bignum2bytestring(node_dhc->hrsp_pub_key, &result1, 6119 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 6120 node_dhc->hrsp_pubkey_len = 6121 (result1.len) * sizeof (BIG_CHUNK_TYPE); 6122 6123 /* save another copy in partner's ndlp */ 6124 bignum2bytestring(node_dhc->nlp_auth_misc.hrsp_pub_key, 6125 &result1, --- 5 unchanged lines hidden (view full) --- 6131 bignum2bytestring(node_dhc->nlp_auth_misc.hrsp_pub_key, 6132 &result1, 6133 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 6134 node_dhc->nlp_auth_misc.hrsp_pubkey_len = 6135 (result1.len) * sizeof (BIG_CHUNK_TYPE); 6136 } 6137 6138 | 6119 bignum2bytestring(node_dhc->hrsp_pub_key, &result1, 6120 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 6121 node_dhc->hrsp_pubkey_len = 6122 (result1.len) * sizeof (BIG_CHUNK_TYPE); 6123 6124 /* save another copy in partner's ndlp */ 6125 bignum2bytestring(node_dhc->nlp_auth_misc.hrsp_pub_key, 6126 &result1, --- 5 unchanged lines hidden (view full) --- 6132 bignum2bytestring(node_dhc->nlp_auth_misc.hrsp_pub_key, 6133 &result1, 6134 sizeof (BIG_CHUNK_TYPE) * (result1.len)); 6135 node_dhc->nlp_auth_misc.hrsp_pubkey_len = 6136 (result1.len) * sizeof (BIG_CHUNK_TYPE); 6137 } 6138 6139 |
6139 if (ndlp->nlp_DID == Fabric_DID) { | 6140 if (ndlp->nlp_DID == FABRIC_DID) { |
6140 bcopy((void *)node_dhc->hrsp_pub_key, (void *)dhval, 6141 node_dhc->hrsp_pubkey_len); 6142 } else { 6143 bcopy((void *)node_dhc->nlp_auth_misc.hrsp_pub_key, 6144 (void *)dhval, 6145 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 6146 } 6147 --- 192 unchanged lines hidden (view full) --- 6340 } 6341 if (pubkey_len == 0) { 6342 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6343 "emlxs_hash_Cai: MD5 BIGNUM_pubkey error: len=0"); 6344 6345 err = BIG_GENERAL_ERR; 6346 return (err); 6347 } | 6141 bcopy((void *)node_dhc->hrsp_pub_key, (void *)dhval, 6142 node_dhc->hrsp_pubkey_len); 6143 } else { 6144 bcopy((void *)node_dhc->nlp_auth_misc.hrsp_pub_key, 6145 (void *)dhval, 6146 node_dhc->nlp_auth_misc.hrsp_pubkey_len); 6147 } 6148 --- 192 unchanged lines hidden (view full) --- 6341 } 6342 if (pubkey_len == 0) { 6343 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6344 "emlxs_hash_Cai: MD5 BIGNUM_pubkey error: len=0"); 6345 6346 err = BIG_GENERAL_ERR; 6347 return (err); 6348 } |
6348 if (ndlp->nlp_DID == Fabric_DID) { | 6349 if (ndlp->nlp_DID == FABRIC_DID) { |
6349 bcopy((void *)pubkey, 6350 (void *)node_dhc->hrsp_ses_key, pubkey_len); 6351 node_dhc->hrsp_seskey_len = pubkey_len; 6352 6353 /* store extra copy */ 6354 bcopy((void *)pubkey, 6355 (void *)node_dhc->nlp_auth_misc.hrsp_ses_key, 6356 pubkey_len); --- 29 unchanged lines hidden (view full) --- 6386 } 6387 if (pubkey_len == 0) { 6388 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6389 "emlxs_hash_Cai: SA1 BUM_pubkey error: key_len=0"); 6390 6391 err = BIG_GENERAL_ERR; 6392 return (err); 6393 } | 6350 bcopy((void *)pubkey, 6351 (void *)node_dhc->hrsp_ses_key, pubkey_len); 6352 node_dhc->hrsp_seskey_len = pubkey_len; 6353 6354 /* store extra copy */ 6355 bcopy((void *)pubkey, 6356 (void *)node_dhc->nlp_auth_misc.hrsp_ses_key, 6357 pubkey_len); --- 29 unchanged lines hidden (view full) --- 6387 } 6388 if (pubkey_len == 0) { 6389 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_error_msg, 6390 "emlxs_hash_Cai: SA1 BUM_pubkey error: key_len=0"); 6391 6392 err = BIG_GENERAL_ERR; 6393 return (err); 6394 } |
6394 if (ndlp->nlp_DID == Fabric_DID) { | 6395 if (ndlp->nlp_DID == FABRIC_DID) { |
6395 bcopy((void *)pubkey, 6396 (void *)node_dhc->hrsp_ses_key, 6397 pubkey_len); 6398 node_dhc->hrsp_seskey_len = pubkey_len; 6399 6400 /* store extra copy */ 6401 bcopy((void *)pubkey, 6402 (void *)node_dhc->nlp_auth_misc.hrsp_ses_key, --- 53 unchanged lines hidden (view full) --- 6456 uint8_t key[20]; 6457 uint8_t cval[20]; 6458 uint32_t cval_len; 6459 uint8_t mytran_id = 0x00; 6460 char *remote_key; 6461 BIG_ERR_CODE err = BIG_OK; 6462 6463 tran_id = (AUTH_TRAN_ID_MASK & tran_id); | 6396 bcopy((void *)pubkey, 6397 (void *)node_dhc->hrsp_ses_key, 6398 pubkey_len); 6399 node_dhc->hrsp_seskey_len = pubkey_len; 6400 6401 /* store extra copy */ 6402 bcopy((void *)pubkey, 6403 (void *)node_dhc->nlp_auth_misc.hrsp_ses_key, --- 53 unchanged lines hidden (view full) --- 6457 uint8_t key[20]; 6458 uint8_t cval[20]; 6459 uint32_t cval_len; 6460 uint8_t mytran_id = 0x00; 6461 char *remote_key; 6462 BIG_ERR_CODE err = BIG_OK; 6463 6464 tran_id = (AUTH_TRAN_ID_MASK & tran_id); |
6464 mytran_id = (uint8_t)(SWAP_DATA32(tran_id)); | 6465 mytran_id = (uint8_t)(LE_SWAP32(tran_id)); |
6465 | 6466 |
6466 if (ndlp->nlp_DID == Fabric_DID) { | 6467 if (ndlp->nlp_DID == FABRIC_DID) { |
6467 remote_key = (char *)node_dhc->auth_key.remote_password; 6468 } else { 6469 /* 6470 * in case of end-to-end auth, this remote password should be 6471 * the password associated with the remote entity. (i.e.,) 6472 * for now it is actually local_password. 6473 */ 6474 remote_key = (char *)node_dhc->auth_key.remote_password; --- 15 unchanged lines hidden (view full) --- 6490 /* NULL DHCHAP group */ 6491 if (hash_id == AUTH_MD5) { 6492 bzero(&mdctx, sizeof (MD5_CTX)); 6493 hash_size = MD5_LEN; 6494 MD5Init(&mdctx); 6495 6496 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6497 | 6468 remote_key = (char *)node_dhc->auth_key.remote_password; 6469 } else { 6470 /* 6471 * in case of end-to-end auth, this remote password should be 6472 * the password associated with the remote entity. (i.e.,) 6473 * for now it is actually local_password. 6474 */ 6475 remote_key = (char *)node_dhc->auth_key.remote_password; --- 15 unchanged lines hidden (view full) --- 6491 /* NULL DHCHAP group */ 6492 if (hash_id == AUTH_MD5) { 6493 bzero(&mdctx, sizeof (MD5_CTX)); 6494 hash_size = MD5_LEN; 6495 MD5Init(&mdctx); 6496 6497 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6498 |
6498 if (ndlp->nlp_DID == Fabric_DID) { | 6499 if (ndlp->nlp_DID == FABRIC_DID) { |
6499 MD5Update(&mdctx, 6500 (unsigned char *)remote_key, 6501 node_dhc->auth_key.remote_password_length); 6502 } else { 6503 MD5Update(&mdctx, 6504 (unsigned char *)remote_key, 6505 node_dhc->auth_key.remote_password_length); 6506 } 6507 | 6500 MD5Update(&mdctx, 6501 (unsigned char *)remote_key, 6502 node_dhc->auth_key.remote_password_length); 6503 } else { 6504 MD5Update(&mdctx, 6505 (unsigned char *)remote_key, 6506 node_dhc->auth_key.remote_password_length); 6507 } 6508 |
6508 if (ndlp->nlp_DID == Fabric_DID) { | 6509 if (ndlp->nlp_DID == FABRIC_DID) { |
6509 MD5Update(&mdctx, 6510 (unsigned char *)&node_dhc->hrsp_cval[0], 6511 MD5_LEN); 6512 } else { 6513 MD5Update(&mdctx, 6514 (unsigned char *)&node_dhc->nlp_auth_misc.hrsp_cval[0], 6515 MD5_LEN); 6516 } --- 13 unchanged lines hidden (view full) --- 6530 } 6531 } 6532 if (hash_id == AUTH_SHA1) { 6533 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6534 hash_size = SHA1_LEN; 6535 SHA1Init(&sha1ctx); 6536 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6537 | 6510 MD5Update(&mdctx, 6511 (unsigned char *)&node_dhc->hrsp_cval[0], 6512 MD5_LEN); 6513 } else { 6514 MD5Update(&mdctx, 6515 (unsigned char *)&node_dhc->nlp_auth_misc.hrsp_cval[0], 6516 MD5_LEN); 6517 } --- 13 unchanged lines hidden (view full) --- 6531 } 6532 } 6533 if (hash_id == AUTH_SHA1) { 6534 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6535 hash_size = SHA1_LEN; 6536 SHA1Init(&sha1ctx); 6537 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6538 |
6538 if (ndlp->nlp_DID == Fabric_DID) { | 6539 if (ndlp->nlp_DID == FABRIC_DID) { |
6539 SHA1Update(&sha1ctx, (void *)remote_key, 6540 node_dhc->auth_key.remote_password_length); 6541 } else { 6542 SHA1Update(&sha1ctx, (void *)remote_key, 6543 node_dhc->auth_key.remote_password_length); 6544 } 6545 | 6540 SHA1Update(&sha1ctx, (void *)remote_key, 6541 node_dhc->auth_key.remote_password_length); 6542 } else { 6543 SHA1Update(&sha1ctx, (void *)remote_key, 6544 node_dhc->auth_key.remote_password_length); 6545 } 6546 |
6546 if (ndlp->nlp_DID == Fabric_DID) { | 6547 if (ndlp->nlp_DID == FABRIC_DID) { |
6547 SHA1Update(&sha1ctx, 6548 (void *)&node_dhc->hrsp_cval[0], 6549 SHA1_LEN); 6550 } else { 6551 SHA1Update(&sha1ctx, 6552 (void *)&node_dhc->nlp_auth_misc.hrsp_cval[0], 6553 SHA1_LEN); 6554 } --- 24 unchanged lines hidden (view full) --- 6579 * private key y as node_dhc->hrsp_priv_key[] host has its 6580 * original challenge c as node_dhc->hrsp_cval[] 6581 * 6582 * H(c || (g^x mod p)^y mod p) = Cai H(Ti || Km || Cai) = 6583 * hash_val returned. Ti : tran_id, Km : shared secret, Cai: 6584 * obtained above. 6585 */ 6586 if (hash_id == AUTH_MD5) { | 6548 SHA1Update(&sha1ctx, 6549 (void *)&node_dhc->hrsp_cval[0], 6550 SHA1_LEN); 6551 } else { 6552 SHA1Update(&sha1ctx, 6553 (void *)&node_dhc->nlp_auth_misc.hrsp_cval[0], 6554 SHA1_LEN); 6555 } --- 24 unchanged lines hidden (view full) --- 6580 * private key y as node_dhc->hrsp_priv_key[] host has its 6581 * original challenge c as node_dhc->hrsp_cval[] 6582 * 6583 * H(c || (g^x mod p)^y mod p) = Cai H(Ti || Km || Cai) = 6584 * hash_val returned. Ti : tran_id, Km : shared secret, Cai: 6585 * obtained above. 6586 */ 6587 if (hash_id == AUTH_MD5) { |
6587 if (ndlp->nlp_DID == Fabric_DID) { | 6588 if (ndlp->nlp_DID == FABRIC_DID) { |
6588 bcopy((void *)node_dhc->hrsp_priv_key, 6589 (void *)key, MD5_LEN); 6590 } else { 6591 bcopy( 6592 (void *)node_dhc->nlp_auth_misc.hrsp_priv_key, 6593 (void *)key, MD5_LEN); 6594 } 6595 } 6596 if (hash_id == AUTH_SHA1) { | 6589 bcopy((void *)node_dhc->hrsp_priv_key, 6590 (void *)key, MD5_LEN); 6591 } else { 6592 bcopy( 6593 (void *)node_dhc->nlp_auth_misc.hrsp_priv_key, 6594 (void *)key, MD5_LEN); 6595 } 6596 } 6597 if (hash_id == AUTH_SHA1) { |
6597 if (ndlp->nlp_DID == Fabric_DID) { | 6598 if (ndlp->nlp_DID == FABRIC_DID) { |
6598 bcopy((void *)node_dhc->hrsp_priv_key, 6599 (void *)key, SHA1_LEN); 6600 } else { 6601 bcopy( 6602 (void *)node_dhc->nlp_auth_misc.hrsp_priv_key, 6603 (void *)key, SHA1_LEN); 6604 } 6605 } | 6599 bcopy((void *)node_dhc->hrsp_priv_key, 6600 (void *)key, SHA1_LEN); 6601 } else { 6602 bcopy( 6603 (void *)node_dhc->nlp_auth_misc.hrsp_priv_key, 6604 (void *)key, SHA1_LEN); 6605 } 6606 } |
6606 if (ndlp->nlp_DID == Fabric_DID) { | 6607 if (ndlp->nlp_DID == FABRIC_DID) { |
6607 bcopy((void *)node_dhc->hrsp_cval, 6608 (void *)cval, node_dhc->hrsp_cval_len); 6609 cval_len = node_dhc->hrsp_cval_len; 6610 } else { 6611 bcopy((void *)node_dhc->nlp_auth_misc.hrsp_cval, 6612 (void *)cval, 6613 node_dhc->nlp_auth_misc.hrsp_cval_len); 6614 cval_len = node_dhc->nlp_auth_misc.hrsp_cval_len; --- 17 unchanged lines hidden (view full) --- 6632 } 6633 if (hash_id == AUTH_MD5) { 6634 bzero(&mdctx, sizeof (MD5_CTX)); 6635 hash_size = MD5_LEN; 6636 6637 MD5Init(&mdctx); 6638 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6639 | 6608 bcopy((void *)node_dhc->hrsp_cval, 6609 (void *)cval, node_dhc->hrsp_cval_len); 6610 cval_len = node_dhc->hrsp_cval_len; 6611 } else { 6612 bcopy((void *)node_dhc->nlp_auth_misc.hrsp_cval, 6613 (void *)cval, 6614 node_dhc->nlp_auth_misc.hrsp_cval_len); 6615 cval_len = node_dhc->nlp_auth_misc.hrsp_cval_len; --- 17 unchanged lines hidden (view full) --- 6633 } 6634 if (hash_id == AUTH_MD5) { 6635 bzero(&mdctx, sizeof (MD5_CTX)); 6636 hash_size = MD5_LEN; 6637 6638 MD5Init(&mdctx); 6639 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6640 |
6640 if (ndlp->nlp_DID == Fabric_DID) { | 6641 if (ndlp->nlp_DID == FABRIC_DID) { |
6641 MD5Update(&mdctx, 6642 (unsigned char *)remote_key, 6643 node_dhc->auth_key.remote_password_length); 6644 } else { 6645 MD5Update(&mdctx, 6646 (unsigned char *)remote_key, 6647 node_dhc->auth_key.remote_password_length); 6648 } --- 15 unchanged lines hidden (view full) --- 6664 } 6665 if (hash_id == AUTH_SHA1) { 6666 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6667 hash_size = SHA1_LEN; 6668 6669 SHA1Init(&sha1ctx); 6670 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6671 | 6642 MD5Update(&mdctx, 6643 (unsigned char *)remote_key, 6644 node_dhc->auth_key.remote_password_length); 6645 } else { 6646 MD5Update(&mdctx, 6647 (unsigned char *)remote_key, 6648 node_dhc->auth_key.remote_password_length); 6649 } --- 15 unchanged lines hidden (view full) --- 6665 } 6666 if (hash_id == AUTH_SHA1) { 6667 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6668 hash_size = SHA1_LEN; 6669 6670 SHA1Init(&sha1ctx); 6671 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6672 |
6672 if (ndlp->nlp_DID == Fabric_DID) { | 6673 if (ndlp->nlp_DID == FABRIC_DID) { |
6673 SHA1Update(&sha1ctx, (void *)remote_key, 6674 node_dhc->auth_key.remote_password_length); 6675 } else { 6676 SHA1Update(&sha1ctx, (void *)remote_key, 6677 node_dhc->auth_key.remote_password_length); 6678 } 6679 6680 SHA1Update(&sha1ctx, (void *)Cai, SHA1_LEN); --- 69 unchanged lines hidden (view full) --- 6750 /* union challenge_val un_cval; */ 6751 uint8_t key[20]; 6752 uint32_t cval_len; 6753 uint8_t mytran_id = 0x00; 6754 6755 char *mykey; 6756 BIG_ERR_CODE err = BIG_OK; 6757 | 6674 SHA1Update(&sha1ctx, (void *)remote_key, 6675 node_dhc->auth_key.remote_password_length); 6676 } else { 6677 SHA1Update(&sha1ctx, (void *)remote_key, 6678 node_dhc->auth_key.remote_password_length); 6679 } 6680 6681 SHA1Update(&sha1ctx, (void *)Cai, SHA1_LEN); --- 69 unchanged lines hidden (view full) --- 6751 /* union challenge_val un_cval; */ 6752 uint8_t key[20]; 6753 uint32_t cval_len; 6754 uint8_t mytran_id = 0x00; 6755 6756 char *mykey; 6757 BIG_ERR_CODE err = BIG_OK; 6758 |
6758 if (ndlp->nlp_DID == Fabric_DID) { | 6759 if (ndlp->nlp_DID == FABRIC_DID) { |
6759 dhgp_id = node_dhc->nlp_auth_dhgpid; 6760 hash_id = node_dhc->nlp_auth_hashid; 6761 } else { 6762 if (flag == 0) { 6763 dhgp_id = node_dhc->dhgp_id; 6764 hash_id = node_dhc->hash_id; 6765 } else { 6766 dhgp_id = node_dhc->nlp_auth_dhgpid; 6767 hash_id = node_dhc->nlp_auth_hashid; 6768 } 6769 } 6770 6771 tran_id = (AUTH_TRAN_ID_MASK & tran_id); | 6760 dhgp_id = node_dhc->nlp_auth_dhgpid; 6761 hash_id = node_dhc->nlp_auth_hashid; 6762 } else { 6763 if (flag == 0) { 6764 dhgp_id = node_dhc->dhgp_id; 6765 hash_id = node_dhc->hash_id; 6766 } else { 6767 dhgp_id = node_dhc->nlp_auth_dhgpid; 6768 hash_id = node_dhc->nlp_auth_hashid; 6769 } 6770 } 6771 6772 tran_id = (AUTH_TRAN_ID_MASK & tran_id); |
6772 mytran_id = (uint8_t)(SWAP_DATA32(tran_id)); | 6773 mytran_id = (uint8_t)(LE_SWAP32(tran_id)); |
6773 6774 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 6775 "emlxs_hash_get_R2:0x%x 0x%x dhgp_id=0x%x mytran_id=0x%x", 6776 ndlp->nlp_DID, hash_id, dhgp_id, mytran_id); 6777 | 6774 6775 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fcsp_detail_msg, 6776 "emlxs_hash_get_R2:0x%x 0x%x dhgp_id=0x%x mytran_id=0x%x", 6777 ndlp->nlp_DID, hash_id, dhgp_id, mytran_id); 6778 |
6778 if (ndlp->nlp_DID == Fabric_DID) { | 6779 if (ndlp->nlp_DID == FABRIC_DID) { |
6779 mykey = (char *)node_dhc->auth_key.local_password; 6780 6781 } else { 6782 /* in case of end-to-end mykey should be remote_password */ 6783 mykey = (char *)node_dhc->auth_key.remote_password; 6784 } 6785 6786 if (dhval_len == 0) { 6787 /* NULL DHCHAP group */ 6788 if (hash_id == AUTH_MD5) { 6789 bzero(&mdctx, sizeof (MD5_CTX)); 6790 hash_size = MD5_LEN; 6791 MD5Init(&mdctx); 6792 6793 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6794 | 6780 mykey = (char *)node_dhc->auth_key.local_password; 6781 6782 } else { 6783 /* in case of end-to-end mykey should be remote_password */ 6784 mykey = (char *)node_dhc->auth_key.remote_password; 6785 } 6786 6787 if (dhval_len == 0) { 6788 /* NULL DHCHAP group */ 6789 if (hash_id == AUTH_MD5) { 6790 bzero(&mdctx, sizeof (MD5_CTX)); 6791 hash_size = MD5_LEN; 6792 MD5Init(&mdctx); 6793 6794 MD5Update(&mdctx, (unsigned char *)&mytran_id, 1); 6795 |
6795 if (ndlp->nlp_DID == Fabric_DID) { | 6796 if (ndlp->nlp_DID == FABRIC_DID) { |
6796 MD5Update(&mdctx, (unsigned char *)mykey, 6797 node_dhc->auth_key.local_password_length); 6798 } else { 6799 MD5Update(&mdctx, (unsigned char *)mykey, 6800 node_dhc->auth_key.remote_password_length); 6801 } 6802 6803 MD5Update(&mdctx, (unsigned char *)bi_cval, MD5_LEN); --- 10 unchanged lines hidden (view full) --- 6814 } 6815 } 6816 if (hash_id == AUTH_SHA1) { 6817 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6818 hash_size = SHA1_LEN; 6819 SHA1Init(&sha1ctx); 6820 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6821 | 6797 MD5Update(&mdctx, (unsigned char *)mykey, 6798 node_dhc->auth_key.local_password_length); 6799 } else { 6800 MD5Update(&mdctx, (unsigned char *)mykey, 6801 node_dhc->auth_key.remote_password_length); 6802 } 6803 6804 MD5Update(&mdctx, (unsigned char *)bi_cval, MD5_LEN); --- 10 unchanged lines hidden (view full) --- 6815 } 6816 } 6817 if (hash_id == AUTH_SHA1) { 6818 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6819 hash_size = SHA1_LEN; 6820 SHA1Init(&sha1ctx); 6821 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6822 |
6822 if (ndlp->nlp_DID == Fabric_DID) { | 6823 if (ndlp->nlp_DID == FABRIC_DID) { |
6823 SHA1Update(&sha1ctx, (void *)mykey, 6824 node_dhc->auth_key.local_password_length); 6825 } else { 6826 SHA1Update(&sha1ctx, (void *)mykey, 6827 node_dhc->auth_key.remote_password_length); 6828 } 6829 6830 SHA1Update(&sha1ctx, (void *)bi_cval, SHA1_LEN); --- 4 unchanged lines hidden (view full) --- 6835 return (NULL); 6836 } else { 6837 bcopy((void *)sha1_digest, 6838 (void *)hash_val, SHA1_LEN); 6839 } 6840 } 6841 } else { 6842 /* NON-NULL DHCHAP */ | 6824 SHA1Update(&sha1ctx, (void *)mykey, 6825 node_dhc->auth_key.local_password_length); 6826 } else { 6827 SHA1Update(&sha1ctx, (void *)mykey, 6828 node_dhc->auth_key.remote_password_length); 6829 } 6830 6831 SHA1Update(&sha1ctx, (void *)bi_cval, SHA1_LEN); --- 4 unchanged lines hidden (view full) --- 6836 return (NULL); 6837 } else { 6838 bcopy((void *)sha1_digest, 6839 (void *)hash_val, SHA1_LEN); 6840 } 6841 } 6842 } else { 6843 /* NON-NULL DHCHAP */ |
6843 if (ndlp->nlp_DID == Fabric_DID) { | 6844 if (ndlp->nlp_DID == FABRIC_DID) { |
6844 if (hash_id == AUTH_MD5) { 6845 bcopy((void *)node_dhc->hrsp_priv_key, 6846 (void *)key, MD5_LEN); 6847 } 6848 if (hash_id == AUTH_SHA1) { 6849 bcopy((void *)node_dhc->hrsp_priv_key, 6850 (void *)key, SHA1_LEN); 6851 } --- 39 unchanged lines hidden (view full) --- 6891 MD5Init(&mdctx); 6892 MD5Update(&mdctx, (unsigned char *) &mytran_id, 1); 6893 6894 /* 6895 * Here we use the same key: mykey, note: this mykey 6896 * should be the key associated with the 6897 * authentication responder i.e. the remote key. 6898 */ | 6845 if (hash_id == AUTH_MD5) { 6846 bcopy((void *)node_dhc->hrsp_priv_key, 6847 (void *)key, MD5_LEN); 6848 } 6849 if (hash_id == AUTH_SHA1) { 6850 bcopy((void *)node_dhc->hrsp_priv_key, 6851 (void *)key, SHA1_LEN); 6852 } --- 39 unchanged lines hidden (view full) --- 6892 MD5Init(&mdctx); 6893 MD5Update(&mdctx, (unsigned char *) &mytran_id, 1); 6894 6895 /* 6896 * Here we use the same key: mykey, note: this mykey 6897 * should be the key associated with the 6898 * authentication responder i.e. the remote key. 6899 */ |
6899 if (ndlp->nlp_DID == Fabric_DID) | 6900 if (ndlp->nlp_DID == FABRIC_DID) |
6900 MD5Update(&mdctx, (unsigned char *)mykey, 6901 node_dhc->auth_key.local_password_length); 6902 else 6903 MD5Update(&mdctx, (unsigned char *)mykey, 6904 node_dhc->auth_key.remote_password_length); 6905 6906 MD5Update(&mdctx, (unsigned char *)Cai, MD5_LEN); 6907 MD5Final((uint8_t *)md5_digest, &mdctx); --- 12 unchanged lines hidden (view full) --- 6920 } 6921 if (hash_id == AUTH_SHA1) { 6922 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6923 hash_size = SHA1_LEN; 6924 6925 SHA1Init(&sha1ctx); 6926 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6927 | 6901 MD5Update(&mdctx, (unsigned char *)mykey, 6902 node_dhc->auth_key.local_password_length); 6903 else 6904 MD5Update(&mdctx, (unsigned char *)mykey, 6905 node_dhc->auth_key.remote_password_length); 6906 6907 MD5Update(&mdctx, (unsigned char *)Cai, MD5_LEN); 6908 MD5Final((uint8_t *)md5_digest, &mdctx); --- 12 unchanged lines hidden (view full) --- 6921 } 6922 if (hash_id == AUTH_SHA1) { 6923 bzero(&sha1ctx, sizeof (SHA1_CTX)); 6924 hash_size = SHA1_LEN; 6925 6926 SHA1Init(&sha1ctx); 6927 SHA1Update(&sha1ctx, (void *)&mytran_id, 1); 6928 |
6928 if (ndlp->nlp_DID == Fabric_DID) { | 6929 if (ndlp->nlp_DID == FABRIC_DID) { |
6929 SHA1Update(&sha1ctx, (void *)mykey, 6930 node_dhc->auth_key.local_password_length); 6931 } else { 6932 SHA1Update(&sha1ctx, (void *)mykey, 6933 node_dhc->auth_key.remote_password_length); 6934 } 6935 6936 SHA1Update(&sha1ctx, (void *)Cai, SHA1_LEN); --- 125 unchanged lines hidden (view full) --- 7062 emlxs_auth_key_t *auth_key; 7063 uint32_t i; 7064 uint32_t fabric; 7065 uint32_t fabric_switch; 7066 7067 /* The ubp represents an unsolicted PLOGI */ 7068 /* The sbp represents a solicted PLOGI */ 7069 | 6930 SHA1Update(&sha1ctx, (void *)mykey, 6931 node_dhc->auth_key.local_password_length); 6932 } else { 6933 SHA1Update(&sha1ctx, (void *)mykey, 6934 node_dhc->auth_key.remote_password_length); 6935 } 6936 6937 SHA1Update(&sha1ctx, (void *)Cai, SHA1_LEN); --- 125 unchanged lines hidden (view full) --- 7063 emlxs_auth_key_t *auth_key; 7064 uint32_t i; 7065 uint32_t fabric; 7066 uint32_t fabric_switch; 7067 7068 /* The ubp represents an unsolicted PLOGI */ 7069 /* The sbp represents a solicted PLOGI */ 7070 |
7070 fabric = ((ndlp->nlp_DID & Fabric_DID_MASK) == Fabric_DID_MASK) ? 1 : 0; 7071 fabric_switch = ((ndlp->nlp_DID == Fabric_DID) ? 1 : 0); | 7071 fabric = ((ndlp->nlp_DID & FABRIC_DID_MASK) == FABRIC_DID_MASK) ? 1 : 0; 7072 fabric_switch = ((ndlp->nlp_DID == FABRIC_DID) ? 1 : 0); |
7072 7073 /* Return is authentication is not enabled */ 7074 if (cfg[CFG_AUTH_ENABLE].current == 0) { 7075 EMLXS_MSGF(EMLXS_CONTEXT, 7076 &emlxs_fcsp_start_msg, 7077 "Not started. Auth disabled. did=0x%x", ndlp->nlp_DID); 7078 7079 emlxs_dhc_state(port, ndlp, NODE_STATE_AUTH_DISABLED, 0, 0); --- 362 unchanged lines hidden (view full) --- 7442 } 7443 if (ndlp) { 7444 node_dhc = &ndlp->node_dhc; 7445 7446 if (node_dhc->state == NODE_STATE_UNKNOWN) { 7447 /* Nothing to stop */ 7448 return; 7449 } | 7073 7074 /* Return is authentication is not enabled */ 7075 if (cfg[CFG_AUTH_ENABLE].current == 0) { 7076 EMLXS_MSGF(EMLXS_CONTEXT, 7077 &emlxs_fcsp_start_msg, 7078 "Not started. Auth disabled. did=0x%x", ndlp->nlp_DID); 7079 7080 emlxs_dhc_state(port, ndlp, NODE_STATE_AUTH_DISABLED, 0, 0); --- 362 unchanged lines hidden (view full) --- 7443 } 7444 if (ndlp) { 7445 node_dhc = &ndlp->node_dhc; 7446 7447 if (node_dhc->state == NODE_STATE_UNKNOWN) { 7448 /* Nothing to stop */ 7449 return; 7450 } |
7450 if (ndlp->nlp_DID != Fabric_DID) { | 7451 if (ndlp->nlp_DID != FABRIC_DID) { |
7451 emlxs_dhc_state(port, ndlp, NODE_STATE_UNKNOWN, 0, 0); 7452 } 7453 emlxs_dhc_auth_complete(port, ndlp, 2); 7454 } else { /* Lost connection to all nodes for this port */ 7455 rw_enter(&port->node_rwlock, RW_READER); 7456 for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) { 7457 ndlp = port->node_table[i]; 7458 7459 if (!ndlp) { 7460 continue; 7461 } 7462 node_dhc = &ndlp->node_dhc; 7463 7464 if (node_dhc->state == NODE_STATE_UNKNOWN) { 7465 continue; 7466 } | 7452 emlxs_dhc_state(port, ndlp, NODE_STATE_UNKNOWN, 0, 0); 7453 } 7454 emlxs_dhc_auth_complete(port, ndlp, 2); 7455 } else { /* Lost connection to all nodes for this port */ 7456 rw_enter(&port->node_rwlock, RW_READER); 7457 for (i = 0; i < EMLXS_NUM_HASH_QUES; i++) { 7458 ndlp = port->node_table[i]; 7459 7460 if (!ndlp) { 7461 continue; 7462 } 7463 node_dhc = &ndlp->node_dhc; 7464 7465 if (node_dhc->state == NODE_STATE_UNKNOWN) { 7466 continue; 7467 } |
7467 if (ndlp->nlp_DID != Fabric_DID) { | 7468 if (ndlp->nlp_DID != FABRIC_DID) { |
7468 emlxs_dhc_state(port, ndlp, 7469 NODE_STATE_UNKNOWN, 0, 0); 7470 } 7471 emlxs_dhc_auth_complete(port, ndlp, 2); 7472 } 7473 rw_exit(&port->node_rwlock); 7474 } 7475 --- 13 unchanged lines hidden (view full) --- 7489 uint32_t status) 7490{ 7491 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 7492 emlxs_buf_t *sbp; 7493 fc_unsol_buf_t *ubp; 7494 uint32_t fabric; 7495 uint32_t fabric_switch; 7496 | 7469 emlxs_dhc_state(port, ndlp, 7470 NODE_STATE_UNKNOWN, 0, 0); 7471 } 7472 emlxs_dhc_auth_complete(port, ndlp, 2); 7473 } 7474 rw_exit(&port->node_rwlock); 7475 } 7476 --- 13 unchanged lines hidden (view full) --- 7490 uint32_t status) 7491{ 7492 emlxs_node_dhc_t *node_dhc = &ndlp->node_dhc; 7493 emlxs_buf_t *sbp; 7494 fc_unsol_buf_t *ubp; 7495 uint32_t fabric; 7496 uint32_t fabric_switch; 7497 |
7497 fabric = ((ndlp->nlp_DID & Fabric_DID_MASK) == Fabric_DID_MASK) ? 1 : 0; 7498 fabric_switch = ((ndlp->nlp_DID == Fabric_DID) ? 1 : 0); | 7498 fabric = ((ndlp->nlp_DID & FABRIC_DID_MASK) == FABRIC_DID_MASK) ? 1 : 0; 7499 fabric_switch = ((ndlp->nlp_DID == FABRIC_DID) ? 1 : 0); |
7499 7500 EMLXS_MSGF(EMLXS_CONTEXT, 7501 &emlxs_fcsp_complete_msg, 7502 "did=0x%x status=%d sbp=%p ubp=%p", 7503 ndlp->nlp_DID, status, node_dhc->deferred_sbp, 7504 node_dhc->deferred_ubp); 7505 7506 if (status == 1) { --- 82 unchanged lines hidden (view full) --- 7589{ 7590 emlxs_hba_t *hba = HBA; 7591 emlxs_config_t *cfg = &CFG; 7592 uint32_t fabric; 7593 uint32_t fabric_switch; 7594 emlxs_auth_cfg_t *auth_cfg = NULL; 7595 emlxs_auth_key_t *auth_key = NULL; 7596 | 7500 7501 EMLXS_MSGF(EMLXS_CONTEXT, 7502 &emlxs_fcsp_complete_msg, 7503 "did=0x%x status=%d sbp=%p ubp=%p", 7504 ndlp->nlp_DID, status, node_dhc->deferred_sbp, 7505 node_dhc->deferred_ubp); 7506 7507 if (status == 1) { --- 82 unchanged lines hidden (view full) --- 7590{ 7591 emlxs_hba_t *hba = HBA; 7592 emlxs_config_t *cfg = &CFG; 7593 uint32_t fabric; 7594 uint32_t fabric_switch; 7595 emlxs_auth_cfg_t *auth_cfg = NULL; 7596 emlxs_auth_key_t *auth_key = NULL; 7597 |
7597 fabric = ((did & Fabric_DID_MASK) == Fabric_DID_MASK) ? 1 : 0; 7598 fabric_switch = ((did == Fabric_DID) ? 1 : 0); | 7598 fabric = ((did & FABRIC_DID_MASK) == FABRIC_DID_MASK) ? 1 : 0; 7599 fabric_switch = ((did == FABRIC_DID) ? 1 : 0); |
7599 7600 /* Return is authentication is not enabled */ 7601 if (cfg[CFG_AUTH_ENABLE].current == 0) { 7602 sp->cmn.fcsp_support = 0; 7603 bcopy("fcsp:Disabled (0)", (void *) &msg[0], 7604 sizeof ("fcsp:Disabled (0)")); 7605 return; 7606 } --- 46 unchanged lines hidden (view full) --- 7653{ 7654 emlxs_hba_t *hba = HBA; 7655 emlxs_config_t *cfg = &CFG; 7656 emlxs_auth_cfg_t *auth_cfg; 7657 emlxs_auth_key_t *auth_key; 7658 uint32_t fabric; 7659 uint32_t fabric_switch; 7660 | 7600 7601 /* Return is authentication is not enabled */ 7602 if (cfg[CFG_AUTH_ENABLE].current == 0) { 7603 sp->cmn.fcsp_support = 0; 7604 bcopy("fcsp:Disabled (0)", (void *) &msg[0], 7605 sizeof ("fcsp:Disabled (0)")); 7606 return; 7607 } --- 46 unchanged lines hidden (view full) --- 7654{ 7655 emlxs_hba_t *hba = HBA; 7656 emlxs_config_t *cfg = &CFG; 7657 emlxs_auth_cfg_t *auth_cfg; 7658 emlxs_auth_key_t *auth_key; 7659 uint32_t fabric; 7660 uint32_t fabric_switch; 7661 |
7661 fabric = ((sid & Fabric_DID_MASK) == Fabric_DID_MASK) ? 1 : 0; 7662 fabric_switch = ((sid == Fabric_DID) ? 1 : 0); | 7662 fabric = ((sid & FABRIC_DID_MASK) == FABRIC_DID_MASK) ? 1 : 0; 7663 fabric_switch = ((sid == FABRIC_DID) ? 1 : 0); |
7663 7664 if (port->port_dhc.state == ELX_FABRIC_AUTH_FAILED) { 7665 /* Reject login */ 7666 return (1); 7667 } 7668 /* Remote host supports FCSP */ 7669 if (sp->cmn.fcsp_support) { 7670 /* Continue login */ --- 188 unchanged lines hidden (view full) --- 7859 if ((status == ENABLE) && 7860 node_dhc->auth_cfg.reauthenticate_time_interval) { 7861 7862 timeout = 7863 (60 * node_dhc->auth_cfg.reauthenticate_time_interval); 7864 drv_time = DRV_TIME; 7865 7866 /* Get last successful auth time */ | 7664 7665 if (port->port_dhc.state == ELX_FABRIC_AUTH_FAILED) { 7666 /* Reject login */ 7667 return (1); 7668 } 7669 /* Remote host supports FCSP */ 7670 if (sp->cmn.fcsp_support) { 7671 /* Continue login */ --- 188 unchanged lines hidden (view full) --- 7860 if ((status == ENABLE) && 7861 node_dhc->auth_cfg.reauthenticate_time_interval) { 7862 7863 timeout = 7864 (60 * node_dhc->auth_cfg.reauthenticate_time_interval); 7865 drv_time = DRV_TIME; 7866 7867 /* Get last successful auth time */ |
7867 if (ndlp->nlp_DID == Fabric_DID) { | 7868 if (ndlp->nlp_DID == FABRIC_DID) { |
7868 last_auth_time = port_dhc->auth_time; 7869 } else if (node_dhc->parent_auth_cfg) { 7870 last_auth_time = node_dhc->parent_auth_cfg->auth_time; 7871 } else { 7872 last_auth_time = 0; 7873 } 7874 7875 if (last_auth_time) { --- 1417 unchanged lines hidden (view full) --- 9293 bzero(auth_key, sizeof (emlxs_auth_key_t)); 9294 return (0); 9295 } 9296 return (1); 9297 9298} /* emlxs_auth_key_parse() */ 9299 9300 | 7869 last_auth_time = port_dhc->auth_time; 7870 } else if (node_dhc->parent_auth_cfg) { 7871 last_auth_time = node_dhc->parent_auth_cfg->auth_time; 7872 } else { 7873 last_auth_time = 0; 7874 } 7875 7876 if (last_auth_time) { --- 1417 unchanged lines hidden (view full) --- 9294 bzero(auth_key, sizeof (emlxs_auth_key_t)); 9295 return (0); 9296 } 9297 return (1); 9298 9299} /* emlxs_auth_key_parse() */ 9300 9301 |
9301#ifdef DFC_SUPPORT | |
9302/* ************************** AUTH DFCLIB SUPPORT *********************** */ 9303 9304/* Provides DFC support for emlxs_dfc_init_auth() */ 9305extern uint32_t 9306emlxs_dhc_init_auth(emlxs_hba_t *hba, uint8_t *lwwpn, uint8_t *rwwpn) 9307{ 9308 emlxs_port_t *port = &PPORT; 9309 emlxs_config_t *cfg = &CFG; --- 26 unchanged lines hidden (view full) --- 9336 &emlxs_dfc_error_msg, 9337 "emlxs_dhc_init_auth: lwwpn not found. %s", 9338 emlxs_wwn_xlate(s_wwpn, lwwpn)); 9339 9340 return (DFC_AUTH_WWN_NOT_FOUND); 9341 } 9342 if (bcmp(rwwpn, emlxs_fabric_wwn, 8) == 0) { 9343 /* Scan for fabric node */ | 9302/* ************************** AUTH DFCLIB SUPPORT *********************** */ 9303 9304/* Provides DFC support for emlxs_dfc_init_auth() */ 9305extern uint32_t 9306emlxs_dhc_init_auth(emlxs_hba_t *hba, uint8_t *lwwpn, uint8_t *rwwpn) 9307{ 9308 emlxs_port_t *port = &PPORT; 9309 emlxs_config_t *cfg = &CFG; --- 26 unchanged lines hidden (view full) --- 9336 &emlxs_dfc_error_msg, 9337 "emlxs_dhc_init_auth: lwwpn not found. %s", 9338 emlxs_wwn_xlate(s_wwpn, lwwpn)); 9339 9340 return (DFC_AUTH_WWN_NOT_FOUND); 9341 } 9342 if (bcmp(rwwpn, emlxs_fabric_wwn, 8) == 0) { 9343 /* Scan for fabric node */ |
9344 if ((ndlp = emlxs_node_find_did(port, Fabric_DID)) == NULL) { | 9344 if ((ndlp = emlxs_node_find_did(port, FABRIC_DID)) == NULL) { |
9345 EMLXS_MSGF(EMLXS_CONTEXT, 9346 &emlxs_dfc_error_msg, 9347 "emlxs_dhc_init_auth: fabric node not found."); 9348 9349 return (DFC_AUTH_WWN_NOT_FOUND); 9350 } 9351 } else { 9352 /* Scan for rwwpn match */ 9353 if ((ndlp = emlxs_node_find_wwpn(port, rwwpn)) == NULL) { 9354 EMLXS_MSGF(EMLXS_CONTEXT, 9355 &emlxs_dfc_error_msg, 9356 "emlxs_dhc_init_auth: rwwpn not found. %s", 9357 emlxs_wwn_xlate(s_wwpn, rwwpn)); 9358 9359 return (DFC_AUTH_WWN_NOT_FOUND); 9360 } 9361 } 9362 | 9345 EMLXS_MSGF(EMLXS_CONTEXT, 9346 &emlxs_dfc_error_msg, 9347 "emlxs_dhc_init_auth: fabric node not found."); 9348 9349 return (DFC_AUTH_WWN_NOT_FOUND); 9350 } 9351 } else { 9352 /* Scan for rwwpn match */ 9353 if ((ndlp = emlxs_node_find_wwpn(port, rwwpn)) == NULL) { 9354 EMLXS_MSGF(EMLXS_CONTEXT, 9355 &emlxs_dfc_error_msg, 9356 "emlxs_dhc_init_auth: rwwpn not found. %s", 9357 emlxs_wwn_xlate(s_wwpn, rwwpn)); 9358 9359 return (DFC_AUTH_WWN_NOT_FOUND); 9360 } 9361 } 9362 |
9363 if ((ndlp->nlp_DID != Fabric_DID) && | 9363 if ((ndlp->nlp_DID != FABRIC_DID) && |
9364 ((port->port_dhc.state != ELX_FABRIC_AUTH_SUCCESS))) { 9365 return (DFC_IO_ERROR); 9366 } 9367 if (ndlp->node_dhc.state >= NODE_STATE_AUTH_NEGOTIATE_ISSUE) { 9368 return (DFC_AUTH_AUTHENTICATION_GOINGON); 9369 } 9370 if (ndlp->node_dhc.state == NODE_STATE_AUTH_SUCCESS) { 9371 ndlp->node_dhc.nlp_reauth_status = NLP_HOST_REAUTH_IN_PROGRESS; --- 161 unchanged lines hidden (view full) --- 9533 continue; 9534 } 9535 /* Port match found */ 9536 9537 if (bcmp((uint8_t *)&fcsp_cfg->rwwpn, 9538 emlxs_fabric_wwn, 8) == 0) { 9539 /* Scan for fabric node */ 9540 if ((ndlp = emlxs_node_find_did(port, | 9364 ((port->port_dhc.state != ELX_FABRIC_AUTH_SUCCESS))) { 9365 return (DFC_IO_ERROR); 9366 } 9367 if (ndlp->node_dhc.state >= NODE_STATE_AUTH_NEGOTIATE_ISSUE) { 9368 return (DFC_AUTH_AUTHENTICATION_GOINGON); 9369 } 9370 if (ndlp->node_dhc.state == NODE_STATE_AUTH_SUCCESS) { 9371 ndlp->node_dhc.nlp_reauth_status = NLP_HOST_REAUTH_IN_PROGRESS; --- 161 unchanged lines hidden (view full) --- 9533 continue; 9534 } 9535 /* Port match found */ 9536 9537 if (bcmp((uint8_t *)&fcsp_cfg->rwwpn, 9538 emlxs_fabric_wwn, 8) == 0) { 9539 /* Scan for fabric node */ 9540 if ((ndlp = emlxs_node_find_did(port, |
9541 Fabric_DID)) == NULL) { | 9541 FABRIC_DID)) == NULL) { |
9542 break; 9543 } 9544 } else { 9545 /* Scan for rwwpn match */ 9546 if ((ndlp = emlxs_node_find_wwpn(port, 9547 (uint8_t *)&fcsp_cfg->rwwpn)) == NULL) { 9548 break; 9549 } --- 382 unchanged lines hidden (view full) --- 9932 mutex_exit(&hba->auth_lock); 9933 9934 return (DFC_AUTH_NOT_CONFIGURED); 9935 } 9936 if (bcmp((uint8_t *)&fcsp_status->rwwpn, 9937 (uint8_t *)emlxs_fabric_wwn, 8) == 0) { 9938 auth_status = &port->port_dhc.auth_status; 9939 auth_time = port->port_dhc.auth_time; | 9542 break; 9543 } 9544 } else { 9545 /* Scan for rwwpn match */ 9546 if ((ndlp = emlxs_node_find_wwpn(port, 9547 (uint8_t *)&fcsp_cfg->rwwpn)) == NULL) { 9548 break; 9549 } --- 382 unchanged lines hidden (view full) --- 9932 mutex_exit(&hba->auth_lock); 9933 9934 return (DFC_AUTH_NOT_CONFIGURED); 9935 } 9936 if (bcmp((uint8_t *)&fcsp_status->rwwpn, 9937 (uint8_t *)emlxs_fabric_wwn, 8) == 0) { 9938 auth_status = &port->port_dhc.auth_status; 9939 auth_time = port->port_dhc.auth_time; |
9940 ndlp = emlxs_node_find_did(port, Fabric_DID); | 9940 ndlp = emlxs_node_find_did(port, FABRIC_DID); |
9941 } else { 9942 auth_status = &auth_cfg->auth_status; 9943 auth_time = auth_cfg->auth_time; 9944 ndlp = auth_cfg->node; 9945 } 9946 9947 update = 0; 9948 --- 140 unchanged lines hidden (view full) --- 10089 10090 auth_pwd++; 10091 } 10092 10093 return (0); 10094 10095} /* emlxs_dhc_get_auth_key_table() */ 10096 | 9941 } else { 9942 auth_status = &auth_cfg->auth_status; 9943 auth_time = auth_cfg->auth_time; 9944 ndlp = auth_cfg->node; 9945 } 9946 9947 update = 0; 9948 --- 140 unchanged lines hidden (view full) --- 10089 10090 auth_pwd++; 10091 } 10092 10093 return (0); 10094 10095} /* emlxs_dhc_get_auth_key_table() */ 10096 |
10097 10098#endif /* DFC_SUPPORT */ 10099 | |
10100#endif /* DHCHAP_SUPPORT */ | 10097#endif /* DHCHAP_SUPPORT */ |