emlxs_dhchap.c (728bdc9b) emlxs_dhchap.c (291a2b48)
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

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
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/*
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

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
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 2008 Emulex. All rights reserved.
23 * Copyright 2009 Emulex. All rights reserved.
24 * Use is subject to License terms.
25 */
26
24 * Use is subject to License terms.
25 */
26
27#include <emlxs.h>
27
28
28#include "emlxs.h"
29
30#ifdef DHCHAP_SUPPORT
31
32#include <md5.h>
33#include <sha1.h>
29#ifdef DHCHAP_SUPPORT
30
31#include <md5.h>
32#include <sha1.h>
33#ifdef S10
34#include <sha1_consts.h>
35#else
34#include <sys/sha1_consts.h>
36#include <sys/sha1_consts.h>
37#endif /* S10 */
35#include <bignum.h>
36#include <sys/time.h>
37
38#ifdef S10
39#define BIGNUM_CHUNK_32
40#define BIG_CHUNK_TYPE uint32_t
41#define CHARLEN2BIGNUMLEN(_val) (_val/4)
42#endif /* S10 */

--- 2203 unchanged lines hidden (view full) ---

2246
2247#ifdef RAND
2248 /* generate a random number as the challenge */
2249 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len));
2250
2251 if (hba->rdn_flag == 1) {
2252 emlxs_get_random_bytes(ndlp, random_number, 20);
2253 } else {
38#include <bignum.h>
39#include <sys/time.h>
40
41#ifdef S10
42#define BIGNUM_CHUNK_32
43#define BIG_CHUNK_TYPE uint32_t
44#define CHARLEN2BIGNUMLEN(_val) (_val/4)
45#endif /* S10 */

--- 2203 unchanged lines hidden (view full) ---

2249
2250#ifdef RAND
2251 /* generate a random number as the challenge */
2252 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len));
2253
2254 if (hba->rdn_flag == 1) {
2255 emlxs_get_random_bytes(ndlp, random_number, 20);
2256 } else {
2254 (void) random_get_pseudo_bytes(random_number,
2257 random_get_pseudo_bytes(random_number,
2255 SWAP_DATA32(chal->cnul.cval_len));
2256 }
2257
2258 /*
2259 * the host should store the challenge for later usage when later on
2260 * host get the reply msg, host needs to verify it by using its old
2261 * challenge, its private key as the input to the hash function. the
2262 * challenge as the random_number should be stored in

--- 57 unchanged lines hidden (view full) ---

2320
2321 if (dhgp_id != GROUP_NULL) {
2322
2323 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len));
2324
2325 if (hba->rdn_flag == 1) {
2326 emlxs_get_random_bytes(ndlp, random_number, 20);
2327 } else {
2258 SWAP_DATA32(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

--- 57 unchanged lines hidden (view full) ---

2323
2324 if (dhgp_id != GROUP_NULL) {
2325
2326 bzero(random_number, SWAP_DATA32(chal->cnul.cval_len));
2327
2328 if (hba->rdn_flag == 1) {
2329 emlxs_get_random_bytes(ndlp, random_number, 20);
2330 } else {
2328 (void) random_get_pseudo_bytes(random_number,
2331 random_get_pseudo_bytes(random_number,
2329 SWAP_DATA32(chal->cnul.cval_len));
2330 }
2331
2332 if (ndlp->nlp_DID == Fabric_DID) {
2333 bcopy((void *) &random_number[0],
2334 (void *) node_dhc->hrsp_priv_key,
2335 SWAP_DATA32(chal->cnul.cval_len));
2336 bcopy((void *) &random_number[0],

--- 688 unchanged lines hidden (view full) ---

3025 * arg2 is the new challenge C2 from initiator if bi-dir auth
3026 * is supported
3027 */
3028 bzero(&random_number, sizeof (random_number));
3029
3030 if (hba->rdn_flag == 1) {
3031 emlxs_get_random_bytes(ndlp, random_number, 20);
3032 } else {
2332 SWAP_DATA32(chal->cnul.cval_len));
2333 }
2334
2335 if (ndlp->nlp_DID == Fabric_DID) {
2336 bcopy((void *) &random_number[0],
2337 (void *) node_dhc->hrsp_priv_key,
2338 SWAP_DATA32(chal->cnul.cval_len));
2339 bcopy((void *) &random_number[0],

--- 688 unchanged lines hidden (view full) ---

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 {
3033 (void) random_get_pseudo_bytes(random_number, arg2len);
3036 random_get_pseudo_bytes(random_number, arg2len);
3034 }
3035
3036 /* cache it for later verification usage */
3037 if (ndlp->nlp_DID == Fabric_DID) {
3038 bcopy((void *)&random_number[0],
3039 (void *)&node_dhc->bi_cval[0], arg2len);
3040 node_dhc->bi_cval_len = arg2len;
3041

--- 190 unchanged lines hidden (view full) ---

3232 uint8_t *tmp;
3233 uint8_t rsp_size;
3234 AUTH_RJT *auth_rjt;
3235 uint32_t tran_id;
3236 uint32_t *hash_val;
3237 union challenge_val un_cval;
3238 uint8_t ReasonCode;
3239 uint8_t ReasonCodeExplanation;
3037 }
3038
3039 /* cache it for later verification usage */
3040 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

--- 190 unchanged lines hidden (view full) ---

3235 uint8_t *tmp;
3236 uint8_t rsp_size;
3237 AUTH_RJT *auth_rjt;
3238 uint32_t tran_id;
3239 uint32_t *hash_val;
3240 union challenge_val un_cval;
3241 uint8_t ReasonCode;
3242 uint8_t ReasonCodeExplanation;
3243 char info[64];
3240
3241 bp = mp->virt;
3242 lp = (uint32_t *)bp;
3243
3244 /*
3245 * 1. we process the DHCHAP_Success or AUTH_Reject 2. ACC it first 3.
3246 * based on the result of 1 we goto the next stage SCR etc.
3247 */

--- 176 unchanged lines hidden (view full) ---

3424AUTH_Reject:
3425
3426 emlxs_dhc_state(port, ndlp, NODE_STATE_AUTH_FAILED,
3427 ReasonCode, ReasonCodeExplanation);
3428 (void) emlxs_issue_auth_reject(port, ndlp, 0, 0, ReasonCode,
3429 ReasonCodeExplanation);
3430 emlxs_dhc_auth_complete(port, ndlp, 1);
3431
3244
3245 bp = mp->virt;
3246 lp = (uint32_t *)bp;
3247
3248 /*
3249 * 1. we process the DHCHAP_Success or AUTH_Reject 2. ACC it first 3.
3250 * based on the result of 1 we goto the next stage SCR etc.
3251 */

--- 176 unchanged lines hidden (view full) ---

3428AUTH_Reject:
3429
3430 emlxs_dhc_state(port, ndlp, NODE_STATE_AUTH_FAILED,
3431 ReasonCode, ReasonCodeExplanation);
3432 (void) emlxs_issue_auth_reject(port, ndlp, 0, 0, ReasonCode,
3433 ReasonCodeExplanation);
3434 emlxs_dhc_auth_complete(port, ndlp, 1);
3435
3436 return (node_dhc->state);
3432out:
3437out:
3438 (void) sprintf(info,
3439 "Auth Failed: ReasonCode=0x%x, ReasonCodeExplanation=0x%x",
3440 ReasonCode, ReasonCodeExplanation);
3433
3441
3442 emlxs_log_auth_event(port, ndlp, ESC_EMLXS_20, info);
3443 emlxs_dhc_auth_complete(port, ndlp, 1);
3444
3434 return (node_dhc->state);
3435
3436} /* emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next */
3437
3438
3439
3440/*
3441 * This routine should be set to emlxs_disc_neverdev as it shouldnot happen.

--- 2378 unchanged lines hidden (view full) ---

5820
5821 bzero(&random_number, hash_size);
5822
5823 /* to get random private key: y */
5824 /* remember y is short lived private key */
5825 if (hba->rdn_flag == 1) {
5826 emlxs_get_random_bytes(ndlp, random_number, 20);
5827 } else {
3445 return (node_dhc->state);
3446
3447} /* emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next */
3448
3449
3450
3451/*
3452 * This routine should be set to emlxs_disc_neverdev as it shouldnot happen.

--- 2378 unchanged lines hidden (view full) ---

5831
5832 bzero(&random_number, hash_size);
5833
5834 /* to get random private key: y */
5835 /* remember y is short lived private key */
5836 if (hba->rdn_flag == 1) {
5837 emlxs_get_random_bytes(ndlp, random_number, 20);
5838 } else {
5828 (void) random_get_pseudo_bytes(random_number, hash_size);
5839 random_get_pseudo_bytes(random_number, hash_size);
5829 }
5830
5831 /* e: y */
5832 bytestring2bignum(&e, (unsigned char *)random_number, hash_size);
5833
5834#endif /* RAND */
5835
5836#ifdef MYRAND

--- 1709 unchanged lines hidden (view full) ---

7546
7547 (void) sprintf(buf, "%s_dhc_lock mutex", DRIVER_NAME);
7548 mutex_init(&hba->dhc_lock, buf, MUTEX_DRIVER, NULL);
7549
7550 emlxs_auth_cfg_init(hba);
7551
7552 emlxs_auth_key_init(hba);
7553
5840 }
5841
5842 /* e: y */
5843 bytestring2bignum(&e, (unsigned char *)random_number, hash_size);
5844
5845#endif /* RAND */
5846
5847#ifdef MYRAND

--- 1709 unchanged lines hidden (view full) ---

7557
7558 (void) sprintf(buf, "%s_dhc_lock mutex", DRIVER_NAME);
7559 mutex_init(&hba->dhc_lock, buf, MUTEX_DRIVER, NULL);
7560
7561 emlxs_auth_cfg_init(hba);
7562
7563 emlxs_auth_key_init(hba);
7564
7554#ifdef S8S9
7555 random_add_entropy(random_number, sizeof (random_number), 0);
7556#endif /* S8S9 */
7557
7558 hba->rdn_flag = 1;
7559
7560 return;
7561
7562} /* emlxs_dhc_attach() */
7563
7564
7565extern void

--- 26 unchanged lines hidden (view full) ---

7592
7593 /* Return is authentication is not enabled */
7594 if (cfg[CFG_AUTH_ENABLE].current == 0) {
7595 sp->cmn.fcsp_support = 0;
7596 bcopy("fcsp:Disabled (0)", (void *) &msg[0],
7597 sizeof ("fcsp:Disabled (0)"));
7598 return;
7599 }
7565 hba->rdn_flag = 1;
7566
7567 return;
7568
7569} /* emlxs_dhc_attach() */
7570
7571
7572extern void

--- 26 unchanged lines hidden (view full) ---

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 }
7607
7600 if (port->vpi != 0 && cfg[CFG_AUTH_NPIV].current == 0) {
7601 sp->cmn.fcsp_support = 0;
7602 bcopy("fcsp:Disabled (npiv)", (void *) &msg[0],
7608 if (port->vpi != 0 && cfg[CFG_AUTH_NPIV].current == 0) {
7609 sp->cmn.fcsp_support = 0;
7610 bcopy("fcsp:Disabled (npiv)", (void *) &msg[0],
7603 sizeof ("fcsp:Disabled (0)"));
7611 sizeof ("fcsp:Disabled (npiv)"));
7604 return;
7605 }
7606 if (!fabric_switch && fabric) {
7607 sp->cmn.fcsp_support = 0;
7608 bcopy("fcsp:Disabled (fs)", (void *) &msg[0],
7609 sizeof ("fcsp:Disabled (fs)"));
7610 return;
7611 }

--- 13 unchanged lines hidden (view full) ---

7625 (uint8_t *)emlxs_fabric_wwn);
7626 if ((!auth_cfg) || (!auth_key)) {
7627 sp->cmn.fcsp_support = 0;
7628 bcopy("fcsp:Disabled (1)", (void *) &msg[0],
7629 sizeof ("fcsp:Disabled (1)"));
7630 mutex_exit(&hba->auth_lock);
7631 return;
7632 }
7612 return;
7613 }
7614 if (!fabric_switch && fabric) {
7615 sp->cmn.fcsp_support = 0;
7616 bcopy("fcsp:Disabled (fs)", (void *) &msg[0],
7617 sizeof ("fcsp:Disabled (fs)"));
7618 return;
7619 }

--- 13 unchanged lines hidden (view full) ---

7633 (uint8_t *)emlxs_fabric_wwn);
7634 if ((!auth_cfg) || (!auth_key)) {
7635 sp->cmn.fcsp_support = 0;
7636 bcopy("fcsp:Disabled (1)", (void *) &msg[0],
7637 sizeof ("fcsp:Disabled (1)"));
7638 mutex_exit(&hba->auth_lock);
7639 return;
7640 }
7633
7634 }
7641 }
7635
7636 mutex_exit(&hba->auth_lock);
7637
7638 sp->cmn.fcsp_support = 1;
7639
7640 return;
7641
7642} /* emlxs_dhc_init_sp() */
7643

--- 1827 unchanged lines hidden (view full) ---

9471 bcmp(dfc_pwd->password, auth_key->local_password,
9472 dfc_pwd->length)) {
9473 EMLXS_MSGF(EMLXS_CONTEXT,
9474 &emlxs_dfc_error_msg,
9475 "emlxs_dhc_add_auth_cfg: Invalid local password.");
9476
9477 mutex_exit(&hba->auth_lock);
9478
7642 mutex_exit(&hba->auth_lock);
7643
7644 sp->cmn.fcsp_support = 1;
7645
7646 return;
7647
7648} /* emlxs_dhc_init_sp() */
7649

--- 1827 unchanged lines hidden (view full) ---

9477 bcmp(dfc_pwd->password, auth_key->local_password,
9478 dfc_pwd->length)) {
9479 EMLXS_MSGF(EMLXS_CONTEXT,
9480 &emlxs_dfc_error_msg,
9481 "emlxs_dhc_add_auth_cfg: Invalid local password.");
9482
9483 mutex_exit(&hba->auth_lock);
9484
9479 return (DFC_AUTH_PASSWORD_INVALID);
9485 return (DFC_AUTH_COMPARE_FAILED);
9480 }
9481 }
9482 /* Create entry */
9483 auth_cfg = emlxs_auth_cfg_create(hba,
9484 (uint8_t *)&fcsp_cfg->lwwpn,
9485 (uint8_t *)&fcsp_cfg->rwwpn);
9486
9487 if (!auth_cfg) {

--- 107 unchanged lines hidden (view full) ---

9595 dfc_pwd->length)) {
9596
9597 EMLXS_MSGF(EMLXS_CONTEXT,
9598 &emlxs_dfc_error_msg,
9599 "emlxs_dhc_delete_auth_cfg: Ivld local pwd.");
9600
9601 mutex_exit(&hba->auth_lock);
9602
9486 }
9487 }
9488 /* Create entry */
9489 auth_cfg = emlxs_auth_cfg_create(hba,
9490 (uint8_t *)&fcsp_cfg->lwwpn,
9491 (uint8_t *)&fcsp_cfg->rwwpn);
9492
9493 if (!auth_cfg) {

--- 107 unchanged lines hidden (view full) ---

9601 dfc_pwd->length)) {
9602
9603 EMLXS_MSGF(EMLXS_CONTEXT,
9604 &emlxs_dfc_error_msg,
9605 "emlxs_dhc_delete_auth_cfg: Ivld local pwd.");
9606
9607 mutex_exit(&hba->auth_lock);
9608
9603 return (DFC_AUTH_PASSWORD_INVALID);
9609 return (DFC_AUTH_COMPARE_FAILED);
9604 }
9605 }
9606 auth_cfg = emlxs_auth_cfg_get(hba,
9607 (uint8_t *)&fcsp_cfg->lwwpn, (uint8_t *)&fcsp_cfg->rwwpn);
9608
9609 if (!auth_cfg) {
9610 EMLXS_MSGF(EMLXS_CONTEXT,
9611 &emlxs_dfc_error_msg,

--- 100 unchanged lines hidden (view full) ---

9712 /* Return is authentication is not enabled */
9713 if (cfg[CFG_AUTH_ENABLE].current == 0) {
9714 EMLXS_MSGF(EMLXS_CONTEXT,
9715 &emlxs_fcsp_debug_msg,
9716 "emlxs_dhc_set_auth_key. Auth disabled.");
9717
9718 return (DFC_AUTH_AUTHENTICATION_DISABLED);
9719 }
9610 }
9611 }
9612 auth_cfg = emlxs_auth_cfg_get(hba,
9613 (uint8_t *)&fcsp_cfg->lwwpn, (uint8_t *)&fcsp_cfg->rwwpn);
9614
9615 if (!auth_cfg) {
9616 EMLXS_MSGF(EMLXS_CONTEXT,
9617 &emlxs_dfc_error_msg,

--- 100 unchanged lines hidden (view full) ---

9718 /* Return is authentication is not enabled */
9719 if (cfg[CFG_AUTH_ENABLE].current == 0) {
9720 EMLXS_MSGF(EMLXS_CONTEXT,
9721 &emlxs_fcsp_debug_msg,
9722 "emlxs_dhc_set_auth_key. Auth disabled.");
9723
9724 return (DFC_AUTH_AUTHENTICATION_DISABLED);
9725 }
9726
9727 /* Check to make sure localpwd does not equal to remotepwd */
9728 /* if they are given in the same time, if not, see below */
9729 if ((dfc_pwd->lpw_new.type == PASSWORD_TYPE_ASCII ||
9730 dfc_pwd->lpw_new.type == PASSWORD_TYPE_BINARY) &&
9731 (dfc_pwd->rpw_new.type == PASSWORD_TYPE_ASCII ||
9732 dfc_pwd->rpw_new.type == PASSWORD_TYPE_BINARY)) {
9733 if (bcmp(dfc_pwd->lpw_new.password,
9734 dfc_pwd->rpw_new.password,
9735 dfc_pwd->lpw_new.length) == 0) {
9736 EMLXS_MSGF(EMLXS_CONTEXT,
9737 &emlxs_fcsp_debug_msg,
9738 "emlxs_dhc_set_auth_key. nlpwd==nrpwd");
9739
9740 return (DFC_AUTH_LOCAL_REMOTE_PWD_EQUAL);
9741 }
9742 }
9743
9720 mutex_enter(&hba->auth_lock);
9721
9722 auth_key = emlxs_auth_key_get(hba,
9723 (uint8_t *)&dfc_pwd->lwwpn,
9724 (uint8_t *)&dfc_pwd->rwwpn);
9725
9726 /* If entry does not exist, then create entry */
9727 if (!auth_key) {

--- 6 unchanged lines hidden (view full) ---

9734 &emlxs_dfc_error_msg,
9735 "emlxs_dhc_set_auth_key: Out of memory.");
9736
9737 mutex_exit(&hba->auth_lock);
9738
9739 return (DFC_SYSRES_ERROR);
9740 }
9741 }
9744 mutex_enter(&hba->auth_lock);
9745
9746 auth_key = emlxs_auth_key_get(hba,
9747 (uint8_t *)&dfc_pwd->lwwpn,
9748 (uint8_t *)&dfc_pwd->rwwpn);
9749
9750 /* If entry does not exist, then create entry */
9751 if (!auth_key) {

--- 6 unchanged lines hidden (view full) ---

9758 &emlxs_dfc_error_msg,
9759 "emlxs_dhc_set_auth_key: Out of memory.");
9760
9761 mutex_exit(&hba->auth_lock);
9762
9763 return (DFC_SYSRES_ERROR);
9764 }
9765 }
9766
9742 /* Check if a new local password is provided */
9743 if (dfc_pwd->lpw_new.type == PASSWORD_TYPE_ASCII ||
9744 dfc_pwd->lpw_new.type == PASSWORD_TYPE_BINARY) {
9745 /* Check if current password should be checked */
9746 if (auth_key->local_password_type == PASSWORD_TYPE_ASCII ||
9747 auth_key->local_password_type == PASSWORD_TYPE_BINARY) {
9748 /* Verify current local password */
9749 if ((auth_key->local_password_length !=

--- 7 unchanged lines hidden (view full) ---

9757 &emlxs_dfc_error_msg,
9758 "emlxs_dhc_set_auth_key: Invalid local password.");
9759
9760 mutex_exit(&hba->auth_lock);
9761
9762 return (DFC_AUTH_COMPARE_FAILED);
9763 }
9764 }
9767 /* Check if a new local password is provided */
9768 if (dfc_pwd->lpw_new.type == PASSWORD_TYPE_ASCII ||
9769 dfc_pwd->lpw_new.type == PASSWORD_TYPE_BINARY) {
9770 /* Check if current password should be checked */
9771 if (auth_key->local_password_type == PASSWORD_TYPE_ASCII ||
9772 auth_key->local_password_type == PASSWORD_TYPE_BINARY) {
9773 /* Verify current local password */
9774 if ((auth_key->local_password_length !=

--- 7 unchanged lines hidden (view full) ---

9782 &emlxs_dfc_error_msg,
9783 "emlxs_dhc_set_auth_key: Invalid local password.");
9784
9785 mutex_exit(&hba->auth_lock);
9786
9787 return (DFC_AUTH_COMPARE_FAILED);
9788 }
9789 }
9790
9791 /*
9792 * Make sure the new local pwd is not equal to the current
9793 * remote pwd if any
9794 */
9795 if (auth_key->remote_password_type == PASSWORD_TYPE_ASCII ||
9796 auth_key->remote_password_type == PASSWORD_TYPE_BINARY) {
9797 if ((auth_key->remote_password_length ==
9798 dfc_pwd->lpw_new.length) &&
9799 (bcmp(dfc_pwd->lpw_new.password,
9800 auth_key->remote_password,
9801 dfc_pwd->lpw_new.length) == 0)) {
9802 EMLXS_MSGF(EMLXS_CONTEXT,
9803 &emlxs_dfc_error_msg,
9804 "emlxs_dhc_set_auth_key: nlpwd==crpwd");
9805
9806 mutex_exit(&hba->auth_lock);
9807
9808 return (DFC_AUTH_LOCAL_REMOTE_PWD_EQUAL);
9809 }
9810 }
9765 /* Update local entry */
9766 auth_key->local_password_length = dfc_pwd->lpw_new.length;
9767 auth_key->local_password_type = dfc_pwd->lpw_new.type;
9768 bzero(auth_key->local_password,
9769 sizeof (auth_key->local_password));
9770 length = min(dfc_pwd->lpw_new.length,
9771 sizeof (auth_key->local_password));
9772 bcopy(dfc_pwd->lpw_new.password,

--- 17 unchanged lines hidden (view full) ---

9790 &emlxs_dfc_error_msg,
9791 "emlxs_dhc_set_auth_key: Invalid remote password.");
9792
9793 mutex_exit(&hba->auth_lock);
9794
9795 return (DFC_AUTH_COMPARE_FAILED);
9796 }
9797 }
9811 /* Update local entry */
9812 auth_key->local_password_length = dfc_pwd->lpw_new.length;
9813 auth_key->local_password_type = dfc_pwd->lpw_new.type;
9814 bzero(auth_key->local_password,
9815 sizeof (auth_key->local_password));
9816 length = min(dfc_pwd->lpw_new.length,
9817 sizeof (auth_key->local_password));
9818 bcopy(dfc_pwd->lpw_new.password,

--- 17 unchanged lines hidden (view full) ---

9836 &emlxs_dfc_error_msg,
9837 "emlxs_dhc_set_auth_key: Invalid remote password.");
9838
9839 mutex_exit(&hba->auth_lock);
9840
9841 return (DFC_AUTH_COMPARE_FAILED);
9842 }
9843 }
9844
9845 /*
9846 * Make sure the new remote pwd is not equal to the current
9847 * local pwd if any
9848 */
9849 if (auth_key->local_password_type == PASSWORD_TYPE_ASCII ||
9850 auth_key->local_password_type == PASSWORD_TYPE_BINARY) {
9851 if ((auth_key->local_password_length ==
9852 dfc_pwd->rpw_new.length) &&
9853 (bcmp(dfc_pwd->rpw_new.password,
9854 auth_key->local_password,
9855 dfc_pwd->rpw_new.length) == 0)) {
9856 EMLXS_MSGF(EMLXS_CONTEXT,
9857 &emlxs_dfc_error_msg,
9858 "emlxs_dhc_set_auth_key: nrpwd==clpwd");
9859
9860 mutex_exit(&hba->auth_lock);
9861
9862 return (DFC_AUTH_LOCAL_REMOTE_PWD_EQUAL);
9863 }
9864 }
9798 /* Update remote entry */
9799 auth_key->remote_password_length = dfc_pwd->rpw_new.length;
9800 auth_key->remote_password_type = dfc_pwd->rpw_new.type;
9801 bzero(auth_key->remote_password,
9802 sizeof (auth_key->remote_password));
9803 length = min(dfc_pwd->rpw_new.length, 128);
9804 bcopy(dfc_pwd->rpw_new.password,
9805 auth_key->remote_password, length);

--- 228 unchanged lines hidden ---
9865 /* Update remote entry */
9866 auth_key->remote_password_length = dfc_pwd->rpw_new.length;
9867 auth_key->remote_password_type = dfc_pwd->rpw_new.type;
9868 bzero(auth_key->remote_password,
9869 sizeof (auth_key->remote_password));
9870 length = min(dfc_pwd->rpw_new.length, 128);
9871 bcopy(dfc_pwd->rpw_new.password,
9872 auth_key->remote_password, length);

--- 228 unchanged lines hidden ---