Print this page
4786 emlxs shouldn't abuse ddi_get_time(9f)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_dhchap.h
+++ new/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_dhchap.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2010 Emulex. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 +/*
27 + * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
28 + */
26 29
27 30 #ifndef _EMLXS_DHCHAP_H
28 31 #define _EMLXS_DHCHAP_H
29 32
30 33 #ifdef __cplusplus
31 34 extern "C" {
32 35 #endif
33 36
34 37 #ifdef DHCHAP_SUPPORT
35 38 #include <sys/random.h>
36 39
37 40
38 41 /* emlxs_auth_cfg_t */
39 42 #define PASSWORD_TYPE_ASCII 1
40 43 #define PASSWORD_TYPE_BINARY 2
41 44 #define PASSWORD_TYPE_IGNORE 3
42 45
43 46 #define AUTH_MODE_DISABLED 1
44 47 #define AUTH_MODE_ACTIVE 2
45 48 #define AUTH_MODE_PASSIVE 3
46 49
47 50 #define ELX_DHCHAP 0x01 /* Only one currently supported */
48 51 #define ELX_FCAP 0x02
49 52 #define ELX_FCPAP 0x03
50 53 #define ELX_KERBEROS 0x04
51 54
52 55 #define ELX_MD5 0x01
53 56 #define ELX_SHA1 0x02
54 57
55 58 #define ELX_GROUP_NULL 0x01
56 59 #define ELX_GROUP_1024 0x02
57 60 #define ELX_GROUP_1280 0x03
58 61 #define ELX_GROUP_1536 0x04
59 62 #define ELX_GROUP_2048 0x05
60 63
61 64
62 65 /* AUTH_ELS Code */
63 66 #define ELS_CMD_AUTH_CODE 0x90
64 67
65 68 /* AUTH_ELS Flags */
66 69
67 70 /* state ? */
68 71 #define AUTH_FINISH 0xFF
69 72 #define AUTH_ABORT 0xFE
70 73
71 74 /* auth_msg code for DHCHAP */
72 75 #define AUTH_REJECT 0x0A
73 76 #define AUTH_NEGOTIATE 0x0B
74 77 #define AUTH_DONE 0x0C
75 78 #define DHCHAP_CHALLENGE 0x10
76 79 #define DHCHAP_REPLY 0x11
77 80 #define DHCHAP_SUCCESS 0x12
78 81
79 82 /* BIG ENDIAN and LITTLE ENDIAN */
80 83
81 84 /* authentication protocol identifiers */
82 85 #ifdef EMLXS_BIG_ENDIAN
83 86
84 87 #define AUTH_DHCHAP 0x00000001
85 88 #define AUTH_FCAP 0x00000002
86 89 #define AUTH_FCPAP 0x00000003
87 90 #define AUTH_KERBEROS 0x00000004
88 91
89 92 #define HASH_LIST_TAG 0x0001
90 93 #define DHGID_LIST_TAG 0x0002
91 94
92 95 /* hash function identifiers */
93 96 #define AUTH_SHA1 0x00000006
94 97 #define AUTH_MD5 0x00000005
95 98
96 99 /* DHCHAP group ids */
97 100 #define GROUP_NULL 0x00000000
98 101 #define GROUP_1024 0x00000001
99 102 #define GROUP_1280 0x00000002
100 103 #define GROUP_1536 0x00000003
101 104 #define GROUP_2048 0x00000004
102 105
103 106 /* Tran_id Mask */
104 107 #define AUTH_TRAN_ID_MASK 0x000000FF
105 108
106 109 #endif /* EMLXS_BIG_ENDIAN */
107 110
108 111 #ifdef EMLXS_LITTLE_ENDIAN
109 112
110 113 #define AUTH_DHCHAP 0x01000000
111 114 #define AUTH_FCAP 0x02000000
112 115 #define AUTH_FCPAP 0x03000000
113 116 #define AUTH_KERBEROS 0x04000000
114 117
115 118 #define HASH_LIST_TAG 0x0100
116 119 #define DHGID_LIST_TAG 0x0200
117 120
118 121 /* hash function identifiers */
119 122 #define AUTH_SHA1 0x06000000
120 123 #define AUTH_MD5 0x05000000
121 124
122 125 /* DHCHAP group ids */
123 126 #define GROUP_NULL 0x00000000
124 127 #define GROUP_1024 0x01000000
125 128 #define GROUP_1280 0x02000000
126 129 #define GROUP_1536 0x03000000
127 130 #define GROUP_2048 0x04000000
128 131
129 132 /* Tran_id Mask */
130 133 #define AUTH_TRAN_ID_MASK 0xFF000000
131 134
132 135 #endif /* EMLXS_LITTLE_ENDIAN */
133 136
134 137 /* hash funcs hash length in byte */
135 138 #define SHA1_LEN 0x00000014 /* 20 bytes */
136 139 #define MD5_LEN 0x00000010 /* 16 bytes */
137 140
138 141 #define HBA_SECURITY 0x20
139 142
140 143 /* AUTH_Reject Reason Codes */
141 144 #define AUTHRJT_FAILURE 0x01
142 145 #define AUTHRJT_LOGIC_ERR 0x02
143 146
144 147 /* LS_RJT Reason Codes for AUTH_ELS */
145 148 #define LSRJT_AUTH_REQUIRED 0x03
146 149 #define LSRJT_AUTH_LOGICAL_BSY 0x05
147 150 #define LSRJT_AUTH_ELS_NOT_SUPPORTED 0x0B
148 151 #define LSRJT_AUTH_NOT_LOGGED_IN 0x09
149 152
150 153 /* AUTH_Reject Reason Code Explanations */
151 154 #define AUTHEXP_MECH_UNUSABLE 0x01 /* AUTHRJT_LOGIC_ERR */
152 155 #define AUTHEXP_DHGROUP_UNUSABLE 0x02 /* AUTHRJT_LOGIC_ERR */
153 156 #define AUTHEXP_HASHFUNC_UNUSABLE 0x03 /* AUTHRJT_LOGIC_ERR */
154 157 #define AUTHEXP_AUTHTRAN_STARTED 0x04 /* AUTHRJT_LOGIC_ERR */
155 158 #define AUTHEXP_AUTH_FAILED 0x05 /* AUTHRJT_FAILURE */
156 159 #define AUTHEXP_BAD_PAYLOAD 0x06 /* AUTHRJT_FAILURE */
157 160 #define AUTHEXP_BAD_PROTOCOL 0x07 /* AUTHRJT_FAILURE */
158 161 #define AUTHEXP_RESTART_AUTH 0x08 /* AUTHRJT_LOGIC_ERR */
159 162 #define AUTHEXP_CONCAT_UNSUPP 0x09 /* AUTHRJT_LOGIC_ERR */
160 163 #define AUTHEXP_BAD_PROTOVERS 0x0A /* AUTHRJT_LOGIC_ERR */
161 164
162 165 /* LS_RJT Reason Code Explanations for AUTH_ELS */
163 166 #define LSEXP_AUTH_REQUIRED 0x48
164 167 #define LSEXP_AUTH_ELS_NOT_SUPPORTED 0x2C
165 168 #define LSEXP_AUTH_ELS_NOT_LOGGED_IN 0x1E
166 169 #define LSEXP_AUTH_LOGICAL_BUSY 0x00
167 170
168 171
169 172 #define MAX_AUTH_MSA_SIZE 1024
170 173
171 174 #define MAX_AUTH_PID 0x4 /* Max auth proto identifier list */
172 175
173 176 /* parameter tag */
174 177 #define HASH_LIST 0x0001
175 178 #define DHG_ID_LIST 0x0002
176 179
177 180 /* name tag from Table 13 v1.8 pp 30 */
178 181 #ifdef EMLXS_BIG_ENDIAN
179 182 #define AUTH_NAME_ID 0x0001
180 183 #define AUTH_NAME_LEN 0x0008
181 184 #define AUTH_PROTO_NUM 0x00000001
182 185 #define AUTH_NULL_PARA_LEN 0x00000028
183 186 #endif /* EMLXS_BIG_ENDIAN */
184 187
185 188 #ifdef EMLXS_LITTLE_ENDIAN
186 189 #define AUTH_NAME_ID 0x0100
187 190 #define AUTH_NAME_LEN 0x0800
188 191 #define AUTH_PROTO_NUM 0x01000000
189 192 #define AUTH_NULL_PARA_LEN 0x28000000
190 193 #endif /* EMLXS_LITTLE_ENDIAN */
191 194
192 195 /* name tag from Table 103 v 1.8 pp 123 */
193 196 #define AUTH_NODE_NAME 0x0002
194 197 #define AUTH_PORT_NAME 0x0003
195 198
196 199 /*
197 200 * Sysevent support
198 201 */
199 202 /* ddi_log_sysevent() vendors */
200 203 #define DDI_VENDOR_EMLX "EMLXS"
201 204
202 205 /* Class */
203 206 #define EC_EMLXS "EC_emlxs"
204 207
205 208 /* Subclass */
206 209 #define ESC_EMLXS_01 "ESC_emlxs_issue_auth_negotiate"
207 210 #define ESC_EMLXS_02 "ESC_emlxs_cmpl_auth_negotiate_issue"
208 211
209 212 #define ESC_EMLXS_03 "ESC_emlxs_rcv_auth_msg_auth_negotiate_issue"
210 213 #define ESC_EMLXS_04 "ESC_emlxs_cmpl_auth_msg_auth_negotiate_issue"
211 214
212 215 #define ESC_EMLXS_05 "ESC_emlxs_rcv_auth_msg_unmapped_node"
213 216 #define ESC_EMLXS_06 "ESC_emlxs_issue_dhchap_challenge"
214 217 #define ESC_EMLXS_07 "ESC_emlxs_cmpl_dhchap_challenge_issue"
215 218
216 219 #define ESC_EMLXS_08 "ESC_emlxs_rcv_auth_msg_dhchap_challenge_cmpl_wait4next"
217 220
218 221 #define ESC_EMLXS_09 "ESC_emlxs_rcv_auth_msg_auth_negotiate_rcv"
219 222 #define ESC_EMLXS_10 "ESC_emlxs_cmpl_auth_msg_auth_negotiate_rcv"
220 223
221 224 #define ESC_EMLXS_11 "ESC_emlxs_cmpl_cmpl_dhchap_reply_issue"
222 225 #define ESC_EMLXS_12 "ESC_emlxs_cmpl_dhchap_reply_issue"
223 226 #define ESC_EMLXS_13 "ESC_emlxs_cmpl_auth_msg_dhchap_reply_issue"
224 227
225 228 #define ESC_EMLXS_14 "ESC_emlxs_cmpl_auth_msg_auth_negotiate_cmpl_wait4next"
226 229
227 230 #define ESC_EMLXS_15 "ESC_emlxs_issue_dhchap_success"
228 231
229 232 #define ESC_EMLXS_16 "ESC_emlxs_rcv_auth_msg_dhchap_challenge_issue"
230 233 #define ESC_EMLXS_17 "ESC_emlxs_cmpl_auth_msg_dhchap_challenge_issue"
231 234
232 235 #define ESC_EMLXS_18 "ESC_emlxs_rcv_auth_msg_dhchap_reply_issue"
233 236
234 237 #define ESC_EMLXS_19 \
235 238 "ESC_emlxs_cmpl_auth_msg_dhchap_challenge_cmpl_wait4next"
236 239
237 240 #define ESC_EMLXS_20 "ESC_emlxs_rcv_auth_msg_dhchap_reply_cmpl_wait4next"
238 241 #define ESC_EMLXS_21 "ESC_emlxs_cmpl_dhchap_success_issue"
239 242 #define ESC_EMLXS_22 "ESC_emlxs_cmpl_auth_msg_dhchap_success_issue"
240 243
241 244 #define ESC_EMLXS_23 "ESC_emlxs_cmpl_auth_msg_dhchap_reply_cmpl_wait4next"
242 245
243 246 #define ESC_EMLXS_24 "ESC_emlxs_rcv_auth_msg_dhchap_success_issue_wait4next"
244 247 #define ESC_EMLXS_25 "ESC_emlxs_cmpl_auth_msg_dhchap_success_issue_wait4next"
245 248
246 249 #define ESC_EMLXS_26 "ESC_emlxs_rcv_auth_msg_dhchap_success_cmpl_wait4next"
247 250 #define ESC_EMLXS_27 "ESC_emlxs_cmpl_auth_msg_dhchap_success_cmpl_wait4next"
248 251
249 252 #define ESC_EMLXS_28 "ESC_emlxs_issue_auth_reject"
250 253 #define ESC_EMLXS_29 "ESC_emlxs_cmpl_auth_reject_issue"
251 254
252 255 #define ESC_EMLXS_30 "ESC_emlxs_rcv_auth_msg_npr_node"
253 256
254 257 #define ESC_EMLXS_31 "ESC_emlxs_dhc_reauth_timeout"
255 258
256 259 #define ESC_EMLXS_32 "ESC_emlxs_dhc_authrsp_timeout"
257 260
258 261 #define ESC_EMLXS_33 "ESC_emlxs_ioctl_auth_setcfg"
259 262 #define ESC_EMLXS_34 "ESC_emlxs_ioctl_auth_setpwd"
260 263 #define ESC_EMLXS_35 "ESC_emlxs_ioctl_auth_delcfg"
261 264 #define ESC_EMLXS_36 "ESC_emlxs_ioctl_auth_delpwd"
262 265
263 266
264 267 /* From HBAnyware dfc lib FC-SP */
265 268 typedef struct emlxs_auth_cfg
266 269 {
267 270 NAME_TYPE local_entity; /* host wwpn (NPIV support) */
268 271 NAME_TYPE remote_entity; /* switch or target wwpn */
↓ open down ↓ |
233 lines elided |
↑ open up ↑ |
269 272 uint32_t authentication_timeout;
270 273 uint32_t authentication_mode;
271 274 uint32_t bidirectional:1;
272 275 uint32_t reserved:31;
273 276 uint32_t authentication_type_priority[4];
274 277 uint32_t hash_priority[4];
275 278 uint32_t dh_group_priority[8];
276 279 uint32_t reauthenticate_time_interval;
277 280
278 281 dfc_auth_status_t auth_status;
279 - time_t auth_time;
282 + uint32_t auth_time;
280 283 struct emlxs_node *node;
281 284
282 285 struct emlxs_auth_cfg *prev;
283 286 struct emlxs_auth_cfg *next;
284 287 } emlxs_auth_cfg_t;
285 288
286 289
287 290 typedef struct emlxs_auth_key
288 291 {
289 292 NAME_TYPE local_entity; /* host wwpn */
290 293 /* (NPIV support) */
291 294 NAME_TYPE remote_entity; /* switch or target */
292 295 /* wwpn */
293 296 uint16_t local_password_length;
294 297 uint16_t local_password_type;
295 298 uint8_t local_password[128]; /* hba authenticates */
296 299 /* to switch */
297 300 uint16_t remote_password_length;
298 301 uint16_t remote_password_type;
299 302 uint8_t remote_password[128]; /* hba authenticates */
300 303 /* to switch */
301 304
302 305 struct emlxs_node *node;
303 306
304 307 struct emlxs_auth_key *prev;
305 308 struct emlxs_auth_key *next;
306 309 } emlxs_auth_key_t;
307 310
308 311
309 312 typedef struct emlxs_auth_misc
310 313 {
311 314 uint8_t bi_cval[20]; /* our challenge for bi-dir */
312 315 /* auth in reply as initiator */
313 316 uint32_t bi_cval_len; /* 16 for MD5, 20 for SHA1 */
314 317 uint8_t pub_key[512]; /* max is 512 bytes value of */
315 318 /* (g^y mod p) */
316 319 uint32_t pubkey_len; /* real length of the pub key */
317 320 uint8_t ses_key[512]; /* session key: value of */
318 321 /* (g^xy mod p) */
319 322 uint32_t seskey_len; /* real length of the session */
320 323 /* key */
321 324
322 325 /* The following are parameters when host is the responder */
323 326 uint8_t hrsp_cval[20]; /* challenge value from host */
324 327 /* as responder */
325 328 uint32_t hrsp_cval_len; /* host as the responder its */
326 329 /* challenge value len */
327 330 uint8_t hrsp_priv_key[20]; /* the private key generated */
328 331 /* in host as responder */
329 332 uint8_t hrsp_pub_key[512]; /* public key calculated when */
330 333 /* host as responder */
331 334 uint32_t hrsp_pubkey_len; /* public key length when */
332 335 /* host is responder */
333 336 uint8_t hrsp_ses_key[512]; /* session key computed when */
334 337 /* host is responder */
335 338 uint32_t hrsp_seskey_len; /* session key length when */
336 339 /* host is responder */
337 340 } emlxs_auth_misc_t;
338 341
339 342
340 343 /*
341 344 * emlxs_port_dhc struct to be used by emlxs_port_t in emlxs_fc.h
342 345 *
343 346 * This structure contains all the data used by DHCHAP.
344 347 * They are from EMLXSHBA_t in emlxs driver.
345 348 *
346 349 */
347 350 typedef struct emlxs_port_dhc
348 351 {
↓ open down ↓ |
59 lines elided |
↑ open up ↑ |
349 352
350 353 int32_t state;
351 354 #define ELX_FABRIC_STATE_UNKNOWN 0x00
352 355 #define ELX_FABRIC_AUTH_DISABLED 0x01
353 356 #define ELX_FABRIC_AUTH_FAILED 0x02
354 357 #define ELX_FABRIC_AUTH_SUCCESS 0x03
355 358 #define ELX_FABRIC_IN_AUTH 0x04
356 359 #define ELX_FABRIC_IN_REAUTH 0x05
357 360
358 361 dfc_auth_status_t auth_status; /* Fabric auth status */
359 - time_t auth_time;
362 + uint32_t auth_time;
360 363
361 364 } emlxs_port_dhc_t;
362 365
363 366
364 367 /* Node Events */
365 368 #define NODE_EVENT_DEVICE_RM 0x0 /* Auth response timeout and */
366 369 /* fail */
367 370 #define NODE_EVENT_DEVICE_RECOVERY 0x1 /* Auth response timeout and */
368 371 /* recovery */
369 372 #define NODE_EVENT_RCV_AUTH_MSG 0x2 /* Unsolicited Auth received */
370 373 #define NODE_EVENT_CMPL_AUTH_MSG 0x3
371 374 #define NODE_EVENT_MAX_EVENT 0x4
372 375
373 376 /*
374 377 * emlxs_node_dhc struct to be used in emlxs_node_t.
375 378 * They are from emlxs_nodelist_t in emlxs driver.
376 379 */
377 380 typedef struct emlxs_node_dhc
378 381 {
379 382 uint16_t state; /* used for state machine */
380 383 #define NODE_STATE_UNKNOWN 0x00
381 384 #define NODE_STATE_AUTH_DISABLED 0x01
382 385 #define NODE_STATE_AUTH_FAILED 0x02
383 386 #define NODE_STATE_AUTH_SUCCESS 0x03
384 387 #define NODE_STATE_AUTH_NEGOTIATE_ISSUE 0x04
385 388 #define NODE_STATE_AUTH_NEGOTIATE_RCV 0x05
386 389 #define NODE_STATE_AUTH_NEGOTIATE_CMPL_WAIT4NEXT 0x06
387 390 #define NODE_STATE_DHCHAP_CHALLENGE_ISSUE 0x07
388 391 #define NODE_STATE_DHCHAP_REPLY_ISSUE 0x08
389 392 #define NODE_STATE_DHCHAP_CHALLENGE_CMPL_WAIT4NEXT 0x09
390 393 #define NODE_STATE_DHCHAP_REPLY_CMPL_WAIT4NEXT 0x0A
391 394 #define NODE_STATE_DHCHAP_SUCCESS_ISSUE 0x0B
392 395 #define NODE_STATE_DHCHAP_SUCCESS_ISSUE_WAIT4NEXT 0x0C
393 396 #define NODE_STATE_DHCHAP_SUCCESS_CMPL_WAIT4NEXT 0x0D
394 397 #define NODE_STATE_NOCHANGE 0xFFFFFFFF
395 398
396 399 uint16_t prev_state; /* for info only */
397 400
398 401 uint32_t disc_refcnt;
399 402
400 403 emlxs_auth_cfg_t auth_cfg;
401 404 emlxs_auth_key_t auth_key;
402 405
403 406 uint32_t nlp_authrsp_tmo; /* Response timeout */
404 407 uint32_t nlp_authrsp_tmocnt;
405 408
406 409 uint32_t nlp_auth_tranid_ini; /* tran_id when this */
407 410 /* node is initiator */
408 411 uint32_t nlp_auth_tranid_rsp; /* tran_id when this */
409 412 /* node is responder */
410 413
411 414 uint32_t nlp_auth_flag; /* 1:initiator */
412 415 /* 2:responder */
413 416 uint32_t nlp_auth_limit; /* 1: NULL DHCHAP */
414 417 /* 2: full support */
415 418
416 419 /* information in DHCHAP_Challenge as the auth responder */
417 420 uint32_t nlp_auth_hashid;
418 421 uint32_t nlp_auth_dhgpid;
419 422 uint32_t nlp_auth_bidir;
420 423 NAME_TYPE nlp_auth_wwn;
421 424
422 425 emlxs_auth_misc_t nlp_auth_misc;
423 426
424 427 uint32_t nlp_reauth_tmo;
425 428 uint16_t nlp_reauth_status;
426 429 #define NLP_HOST_REAUTH_DISABLED 0x0
427 430 #define NLP_HOST_REAUTH_ENABLED 0x1
428 431 #define NLP_HOST_REAUTH_IN_PROGRESS 0x2
429 432
430 433 uint32_t nlp_fb_vendor;
431 434 #define NLP_FABRIC_CISCO 0x1
432 435 #define NLP_FABRIC_OTHERS 0x2
433 436
434 437 uint32_t fc_dhchap_success_expected;
435 438
436 439 /* hash_id, dhgp_id are set from responder, host is the initiator */
437 440 uint32_t hash_id; /* 0x05 for MD5 */
438 441 /* 0x06 for SHA-1 */
439 442 uint32_t dhgp_id; /* DH grp identifier */
440 443
441 444 uint8_t bi_cval[20]; /* our challenge for */
442 445 /* bi-dir auth in */
443 446 /* reply as initiator */
444 447 uint32_t bi_cval_len; /* 16 for MD5 */
445 448 /* 20 for SHA1 */
446 449 uint8_t pub_key[512]; /* max is 512 bytes */
447 450 /* value (g^y mod p) */
448 451 uint32_t pubkey_len; /* real length of the */
449 452 /* pub key */
450 453 uint8_t ses_key[512]; /* session key: */
451 454 /* value (g^xy mod p) */
452 455 uint32_t seskey_len; /* real length of the */
453 456 /* session key */
454 457
455 458 /* The following are parameters when host is the responder */
456 459
457 460 uint8_t hrsp_cval[20]; /* challenge value */
458 461 uint32_t hrsp_cval_len; /* challenge value */
459 462 /* length */
460 463 uint8_t hrsp_priv_key[20]; /* private key */
461 464 /* generated */
462 465 uint8_t hrsp_pub_key[512]; /* public key */
463 466 /* computed */
464 467 uint32_t hrsp_pubkey_len; /* public key length */
465 468 uint8_t hrsp_ses_key[512]; /* session key */
466 469 /* computed */
467 470 uint32_t hrsp_seskey_len; /* session key length */
468 471
469 472 uint8_t *deferred_sbp; /* Pending IO for */
470 473 /* auth completion */
471 474 uint8_t *deferred_ubp;
472 475
473 476 uint32_t flag;
474 477 #define NLP_REMOTE_AUTH 0x00000001
475 478 #define NLP_SET_REAUTH_TIME 0x00000002
476 479
477 480 emlxs_auth_cfg_t *parent_auth_cfg; /* Original auth_cfg */
478 481 /* table entry */
479 482 emlxs_auth_key_t *parent_auth_key; /* Original auth_key */
480 483 /* table entry */
481 484 } emlxs_node_dhc_t;
482 485
483 486
484 487 /* For NULL DHCHAP with MD5 and SHA-1 */
485 488 typedef struct _AUTH_NEGOT_PARAMS_1
486 489 {
487 490 uint16_t name_tag; /* set to 0x0001 */
488 491 uint16_t name_len; /* set to 0x0008 */
489 492 NAME_TYPE nodeName; /* WWPN */
490 493 uint32_t proto_num; /* set to 0x5 */
491 494 uint32_t para_len; /* set to 0x28 i.e., 40 bytes */
492 495 uint32_t proto_id; /* set to HDCHAP */
493 496 uint16_t HashList_tag; /* set to 0x0001 */
494 497 uint16_t HashList_wcnt; /* set to 0x0002 i.e. MD5 and SHA-1 */
495 498 uint32_t HashList_value1; /* set to MD5 or SHA1 ID 0x00000005,6 */
496 499 uint16_t DHgIDList_tag; /* set to 0x0002 */
497 500 uint16_t DHgIDList_wnt; /* set to 0x0005 i.e., Full DH groups */
498 501 uint32_t DHgIDList_g0; /* set to 0x0000 0000 */
499 502 uint32_t DHgIDList_g1; /* set to 0x0000 0001 */
500 503 uint32_t DHgIDList_g2; /* set to 0x0000 0002 */
501 504 uint32_t DHgIDList_g3; /* set to 0x0000 0003 */
502 505 uint32_t DHgIDList_g4; /* set to 0x0000 0004 */
503 506 } AUTH_NEGOT_PARAMS_1;
504 507
505 508
506 509 typedef struct _AUTH_NEGOT_PARAMS_2
507 510 {
508 511 uint16_t name_tag; /* set to 0x0001 */
509 512 uint16_t name_len; /* set to 0x0008 */
510 513 NAME_TYPE nodeName; /* WWPN */
511 514 uint32_t proto_num; /* set to 0x5 */
512 515 uint32_t para_len; /* set to 0x28 i.e., 40 bytes */
513 516 uint32_t proto_id; /* set to HDCHAP */
514 517 uint16_t HashList_tag; /* set to 0x0001 */
515 518 uint16_t HashList_wcnt; /* set to 0x0002 i.e. MD5 and SHA-1 */
516 519 uint32_t HashList_value1; /* set to MD5's ID 0x00000005 */
517 520 uint32_t HashList_value2; /* set to SHA-1's ID 0x00000006 */
518 521 uint16_t DHgIDList_tag; /* set to 0x0002 */
519 522 uint16_t DHgIDList_wnt; /* set to 0x0005 i.e., Full DH groups */
520 523 uint32_t DHgIDList_g0; /* set to 0x0000 0000 */
521 524 uint32_t DHgIDList_g1; /* set to 0x0000 0001 */
522 525 uint32_t DHgIDList_g2; /* set to 0x0000 0002 */
523 526 uint32_t DHgIDList_g3; /* set to 0x0000 0003 */
524 527 uint32_t DHgIDList_g4; /* set to 0x0000 0004 */
525 528 } AUTH_NEGOT_PARAMS_2;
526 529
527 530
528 531 /* For NULL DHCHAP with MD5 and SHA-1 */
529 532 typedef struct _AUTH_NEGOT_PARAMS
530 533 {
531 534 uint16_t name_tag; /* set to 0x0001 */
532 535 uint16_t name_len; /* set to 0x0008 */
533 536 NAME_TYPE nodeName; /* WWPN */
534 537 uint32_t proto_num; /* set to 0x5 */
535 538 uint32_t para_len; /* set to 0x28 i.e., 40 bytes */
536 539 uint32_t proto_id; /* set to HDCHAP */
537 540 uint16_t HashList_tag; /* set to 0x0001 */
538 541 uint16_t HashList_wcnt; /* set to 0x0002 i.e. MD5 and SHA-1 */
539 542 uint32_t HashList_value1; /* set to MD5's ID 0x00000005 */
540 543 uint32_t HashList_value2; /* set to SHA-1's ID 0x00000006 */
541 544 uint16_t DHgIDList_tag; /* set to 0x0002 */
542 545 uint16_t DHgIDList_wnt; /* set to 0x0005 i.e., Full DH groups */
543 546 uint32_t DHgIDList_g0; /* set to 0x0000 0000 */
544 547 uint32_t DHgIDList_g1; /* set to 0x0000 0001 */
545 548 uint32_t DHgIDList_g2; /* set to 0x0000 0002 */
546 549 uint32_t DHgIDList_g3; /* set to 0x0000 0003 */
547 550 uint32_t DHgIDList_g4; /* set to 0x0000 0004 */
548 551 } AUTH_NEGOT_PARAMS;
549 552
550 553 typedef struct _AUTH_NEGOT_PARAMS_NULL_1
551 554 {
552 555 uint16_t name_tag; /* set to 0x0001 */
553 556 uint16_t name_len; /* set to 0x0008 */
554 557 NAME_TYPE nodeName; /* WWPN */
555 558 uint32_t proto_num; /* set to 0x5 */
556 559 uint32_t para_len; /* set to 0x28 i.e., 40 bytes */
557 560 uint32_t proto_id; /* set to HDCHAP */
558 561 uint16_t HashList_tag; /* set to 0x0001 */
559 562 uint16_t HashList_wcnt; /* set to 0x0002 i.e. MD5 and SHA-1 */
560 563 uint32_t HashList_value1; /* set to MD5's ID 0x00000005 */
561 564 uint16_t DHgIDList_tag; /* set to 0x0002 */
562 565 uint16_t DHgIDList_wnt; /* set to 0x0005 i.e., Full DH groups */
563 566 uint32_t DHgIDList_g0; /* set to 0x0000 0000 */
564 567 } AUTH_NEGOT_PARAMS_NULL_1;
565 568
566 569 typedef struct _AUTH_NEGOT_PARAMS_NULL_2
567 570 {
568 571 uint16_t name_tag; /* set to 0x0001 */
569 572 uint16_t name_len; /* set to 0x0008 */
570 573 NAME_TYPE nodeName; /* WWPN */
571 574 uint32_t proto_num; /* set to 0x5 */
572 575 uint32_t para_len; /* set to 0x28 i.e., 40 bytes */
573 576 uint32_t proto_id; /* set to HDCHAP */
574 577 uint16_t HashList_tag; /* set to 0x0001 */
575 578 uint16_t HashList_wcnt; /* set to 0x0002 i.e. MD5 and SHA-1 */
576 579 uint32_t HashList_value1; /* set to MD5's ID 0x00000005 */
577 580 uint32_t HashList_value2;
578 581 uint16_t DHgIDList_tag; /* set to 0x0002 */
579 582 uint16_t DHgIDList_wnt; /* set to 0x0005 i.e., Full DH groups */
580 583 uint32_t DHgIDList_g0; /* set to 0x0000 0000 */
581 584 } AUTH_NEGOT_PARAMS_NULL_2;
582 585
583 586
584 587 /* Generic AUTH ELS Header */
585 588 typedef struct _AUTH_MSG_HDR
586 589 {
587 590 /* 20 bytes in total */
588 591 uint8_t auth_els_code; /* always 0x90h */
589 592 uint8_t auth_els_flags;
590 593 uint8_t auth_msg_code; /* see above */
591 594 uint8_t proto_version;
592 595 uint32_t msg_len; /* size of msg payload in byte */
593 596 uint32_t tran_id;
594 597 uint16_t name_tag; /* set to 0x0001 */
595 598 uint16_t name_len; /* set to 0x0008 */
596 599 NAME_TYPE nodeName; /* WWPN */
597 600 } AUTH_MSG_HDR;
598 601
599 602
600 603 typedef struct _SHA1_CVAL
601 604 {
602 605 uint8_t val[20];
603 606 } SHA1_CVAL;
604 607
605 608
606 609 typedef struct _MD5_CVAL
607 610 {
608 611 uint8_t val[16];
609 612 } MD5_CVAL;
610 613
611 614
612 615 union challenge_val
613 616 {
614 617 SHA1_CVAL sha1;
615 618 MD5_CVAL md5;
616 619 };
617 620
618 621
619 622 /* DHCHAP_Replay */
620 623 typedef struct _DHCHAP_REPLY_HDR
621 624 {
622 625 uint8_t auth_els_code; /* always 0x90h */
623 626 uint8_t auth_els_flags;
624 627 uint8_t auth_msg_code; /* see above */
625 628 uint8_t proto_version;
626 629 uint32_t msg_len; /* size of msg payload in byte */
627 630 uint32_t tran_id; /* transaction id */
628 631 } DHCHAP_REPLY_HDR;
629 632
630 633
631 634 /* DHCHAP_Challenge */
632 635 typedef struct _DHCHAP_CHALL_NULL
633 636 {
634 637 AUTH_MSG_HDR msg_hdr;
635 638 uint32_t hash_id;
636 639 uint32_t dhgp_id;
637 640 uint32_t cval_len;
638 641 } DHCHAP_CHALL_NULL;
639 642
640 643 typedef struct _DHCHAP_CHALL
641 644 {
642 645 DHCHAP_CHALL_NULL cnul;
643 646 uint8_t *dhval;
644 647 } DHCHAP_CHALL;
645 648
646 649 /*
647 650 * size of msg_payload is variable based on the different protocol
648 651 * parameters supported in the driver.
649 652 *
650 653 * For DHCHAP we plan to support NULL, group 1, 2, 3, 4.
651 654 *
652 655 * For NULL DHCHAP protocol only: of these protocol identifiers,
653 656 * we need name_tag = 2 bytes name_len_size = 2 bytes name_len = 8 bytes
654 657 * number of usable auth proto = 4 bytes
655 658 *
656 659 * --------- for example for NULL DHCAHP only --------------------
657 660 * auth proto #1 len = 4 bytes #1 ID = 4 bytes #1 params = 4 + 16 bytes.
658 661 * ------ Total for NULL DHCHAP = (16 + 12 + 16 ) = 44 bytes.
659 662 *
660 663 * If number of usable auth proto is 5, then we should have 5 auth proto params.
661 664 * assume we are using name_tag 0x0001, then auth name in total = 12 bytes.
662 665 *
663 666 * 12 bytes + 4 bytes = 16 bytes. 4 + 4 + 4 = 12 bytes
664 667 * (num of usable auth proto size = 4
665 668 * auth proto params #1 len size = 4
666 669 * auth prot ID for #1 size = 4
667 670 *
668 671 * For DHCHAP param: HashList 2 param tag size (set to 0x0001 as HashList)
669 672 * 2 param word cnt size (set to 0x0002 as two hash funcs)
670 673 * 8 for hash ids: MD5 and SHA-1 DHgIDList
671 674 * 2 param tag size (set to 0x0002 as DHgIDList)
672 675 * 2 param word cnt size (set to 0x0005 as NULL and 1/2/3/4 groups) 20 for
673 676 * 5 groups 0x0000 0000 0x0000 0001 0x0000 0002 0x0000 0003 0x0000 0004
674 677 * Total for FULL group support (16 + 12 + 12 + 24 ) = 64 bytes.
675 678 *
676 679 */
677 680
678 681 typedef struct _AUTH_MSG_NEGOT_1 { /* in Big Endian format */
679 682 uint8_t auth_els_code; /* always 0x90h */
680 683 uint8_t auth_els_flags;
681 684 uint8_t auth_msg_code; /* see above */
682 685 uint8_t proto_version;
683 686 uint32_t msg_len; /* size of msg payload */
684 687 /* in byte */
685 688 uint32_t tran_id; /* transaction identifier */
686 689
687 690 /* anything else is variable in size (bytes) */
688 691 /* uint8_t msg_payload[MAX_AUTH_MSG_SIZE]; */
689 692 AUTH_NEGOT_PARAMS_1 params;
690 693 } AUTH_MSG_NEGOT_1, *PAUTH_MSG_NEGOT_1;
691 694
692 695
693 696 typedef struct _AUTH_MSG_NEGOT_2 { /* in Big Endian format */
694 697 uint8_t auth_els_code; /* always 0x90h */
695 698 uint8_t auth_els_flags;
696 699 uint8_t auth_msg_code; /* see above */
697 700 uint8_t proto_version;
698 701 uint32_t msg_len; /* size of msg payload */
699 702 /* in byte */
700 703 uint32_t tran_id; /* transaction identifier */
701 704
702 705 /* anything else is variable in size (bytes) */
703 706 /* uint8_t msg_payload[MAX_AUTH_MSG_SIZE]; */
704 707 AUTH_NEGOT_PARAMS_2 params;
705 708 } AUTH_MSG_NEGOT_2, *PAUTH_MSG_NEGOT_2;
706 709
707 710
708 711 typedef struct _AUTH_MSG_NEGOT
709 712 {
710 713 /* in Big Endian format */
711 714 uint8_t auth_els_code; /* always 0x90h */
712 715 uint8_t auth_els_flags;
713 716 uint8_t auth_msg_code; /* see above */
714 717 uint8_t proto_version;
715 718 uint32_t msg_len; /* size of msg payload */
716 719 /* in byte */
717 720 uint32_t tran_id; /* transaction identifier */
718 721
719 722 /* anything else is variable in size (bytes) */
720 723 /* uint8_t msg_payload[MAX_AUTH_MSG_SIZE]; */
721 724 AUTH_NEGOT_PARAMS params;
722 725 } AUTH_MSG_NEGOT, *PAUTH_MSG_NEGOT;
723 726
724 727
725 728 /* AUTH_Negotiate msg for NULL DH support only */
726 729 typedef struct _AUTH_MSG_NEGOT_NULL
727 730 {
728 731 uint8_t auth_els_code;
729 732 uint8_t auth_els_flags;
730 733 uint8_t auth_msg_code;
731 734 uint8_t proto_version;
732 735 uint32_t msg_len;
733 736 uint32_t tran_id;
734 737 } AUTH_MSG_NEGOT_NULL, *PAUTH_MSG_NEGOT_NULL;
735 738
736 739 typedef struct _AUTH_MSG_NEGOT_NULL_1
737 740 {
738 741 uint8_t auth_els_code;
739 742 uint8_t auth_els_flags;
740 743 uint8_t auth_msg_code;
741 744 uint8_t proto_version;
742 745 uint32_t msg_len;
743 746 uint32_t tran_id;
744 747
745 748 AUTH_NEGOT_PARAMS_NULL_1 params;
746 749
747 750 } AUTH_MSG_NEGOT_NULL_1, *PAUTH_MSG_NEGOT_NULL_1;
748 751
749 752 typedef struct _AUTH_MSG_NEGOT_NULL_2
750 753 {
751 754 uint8_t auth_els_code;
752 755 uint8_t auth_els_flags;
753 756 uint8_t auth_msg_code;
754 757 uint8_t proto_version;
755 758 uint32_t msg_len;
756 759 uint32_t tran_id;
757 760
758 761 AUTH_NEGOT_PARAMS_NULL_2 params;
759 762
760 763 } AUTH_MSG_NEGOT_NULL_2, *PAUTH_MSG_NEGOT_NULL_2;
761 764
762 765
763 766 /* auth_els_flags */
764 767 #define AUTH_ELS_FLAGS_MASK 0x0f;
765 768
766 769
767 770 typedef struct _AUTH_RJT
768 771 {
769 772 uint8_t auth_els_code; /* always 0x90h */
770 773 uint8_t auth_els_flags;
771 774 uint8_t auth_msg_code; /* see above */
772 775 uint8_t proto_version;
773 776 uint32_t msg_len; /* size of msg payload in byte */
774 777 uint32_t tran_id; /* transaction identifier */
775 778
776 779 uint8_t ReasonCode;
777 780 uint8_t ReasonCodeExplanation;
778 781 uint16_t Reserved;
779 782 } AUTH_RJT, *PAUTH_RJT;
780 783
781 784 typedef struct _DHCHAP_SUCCESS_HDR
782 785 {
783 786 uint8_t auth_els_code; /* always 0x90h */
784 787 uint8_t auth_els_flags;
785 788 uint8_t auth_msg_code; /* see above */
786 789 uint8_t proto_version;
787 790 uint32_t msg_len; /* size of msg payload in byte */
788 791 uint32_t tran_id; /* transaction identifier */
789 792
790 793 uint32_t RspVal_len;
791 794 } DHCHAP_SUCCESS_HDR, *PDHCHAP_SUCCESS_HDR;
792 795
793 796
794 797 typedef struct dh_group_st
795 798 {
796 799 unsigned long groupid;
797 800 unsigned long length;
798 801 unsigned char value[256];
799 802 } DH_GROUP, *PDH_GROUP;
800 803
801 804 #pragma weak random_get_pseudo_bytes
802 805
803 806
804 807 #endif /* DHCHAP_SUPPORT */
805 808
806 809 #ifdef __cplusplus
807 810 }
808 811 #endif
809 812
810 813 #endif /* _EMLXS_DHCHAP_H */
↓ open down ↓ |
441 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX