xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_dhchap.h (revision 8f23e9fa8abcb5857661066b954e63400d589b65)
1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8*8f23e9faSHans Rosenfeld  * You can obtain a copy of the license at
9*8f23e9faSHans Rosenfeld  * http://www.opensource.org/licenses/cddl1.txt.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte 
22fcf3ce44SJohn Forte /*
23*8f23e9faSHans Rosenfeld  * Copyright (c) 2004-2011 Emulex. All rights reserved.
2482527734SSukumar Swaminathan  * Use is subject to license terms.
25fcf3ce44SJohn Forte  */
26fcf3ce44SJohn Forte 
27fcf3ce44SJohn Forte #ifndef _EMLXS_DHCHAP_H
28fcf3ce44SJohn Forte #define	_EMLXS_DHCHAP_H
29fcf3ce44SJohn Forte 
30fcf3ce44SJohn Forte #ifdef	__cplusplus
31fcf3ce44SJohn Forte extern "C" {
32fcf3ce44SJohn Forte #endif
33fcf3ce44SJohn Forte 
34fcf3ce44SJohn Forte #ifdef DHCHAP_SUPPORT
35fcf3ce44SJohn Forte #include <sys/random.h>
36fcf3ce44SJohn Forte 
37fcf3ce44SJohn Forte 
38fcf3ce44SJohn Forte /* emlxs_auth_cfg_t */
39291a2b48SSukumar Swaminathan #define	PASSWORD_TYPE_ASCII	1
40291a2b48SSukumar Swaminathan #define	PASSWORD_TYPE_BINARY	2
41291a2b48SSukumar Swaminathan #define	PASSWORD_TYPE_IGNORE	3
42fcf3ce44SJohn Forte 
43291a2b48SSukumar Swaminathan #define	AUTH_MODE_DISABLED	1
44291a2b48SSukumar Swaminathan #define	AUTH_MODE_ACTIVE	2
45291a2b48SSukumar Swaminathan #define	AUTH_MODE_PASSIVE	3
46fcf3ce44SJohn Forte 
47291a2b48SSukumar Swaminathan #define	ELX_DHCHAP		0x01	/* Only one currently supported */
48291a2b48SSukumar Swaminathan #define	ELX_FCAP		0x02
49291a2b48SSukumar Swaminathan #define	ELX_FCPAP		0x03
50291a2b48SSukumar Swaminathan #define	ELX_KERBEROS		0x04
51fcf3ce44SJohn Forte 
52291a2b48SSukumar Swaminathan #define	ELX_MD5			0x01
53291a2b48SSukumar Swaminathan #define	ELX_SHA1		0x02
54fcf3ce44SJohn Forte 
55291a2b48SSukumar Swaminathan #define	ELX_GROUP_NULL		0x01
56291a2b48SSukumar Swaminathan #define	ELX_GROUP_1024		0x02
57291a2b48SSukumar Swaminathan #define	ELX_GROUP_1280		0x03
58291a2b48SSukumar Swaminathan #define	ELX_GROUP_1536		0x04
59291a2b48SSukumar Swaminathan #define	ELX_GROUP_2048		0x05
60fcf3ce44SJohn Forte 
61fcf3ce44SJohn Forte 
62fcf3ce44SJohn Forte /* AUTH_ELS Code */
63fcf3ce44SJohn Forte #define	ELS_CMD_AUTH_CODE	0x90
64fcf3ce44SJohn Forte 
65fcf3ce44SJohn Forte /* AUTH_ELS Flags */
66fcf3ce44SJohn Forte 
67fcf3ce44SJohn Forte /* state ? */
68fcf3ce44SJohn Forte #define	AUTH_FINISH		0xFF
69fcf3ce44SJohn Forte #define	AUTH_ABORT		0xFE
70fcf3ce44SJohn Forte 
71fcf3ce44SJohn Forte /* auth_msg code for DHCHAP */
72fcf3ce44SJohn Forte #define	AUTH_REJECT		0x0A
73fcf3ce44SJohn Forte #define	AUTH_NEGOTIATE		0x0B
74fcf3ce44SJohn Forte #define	AUTH_DONE		0x0C
75fcf3ce44SJohn Forte #define	DHCHAP_CHALLENGE	0x10
76fcf3ce44SJohn Forte #define	DHCHAP_REPLY		0x11
77fcf3ce44SJohn Forte #define	DHCHAP_SUCCESS		0x12
78fcf3ce44SJohn Forte 
79fcf3ce44SJohn Forte /* BIG ENDIAN and LITTLE ENDIAN */
80fcf3ce44SJohn Forte 
81fcf3ce44SJohn Forte /* authentication protocol identifiers */
82fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
83fcf3ce44SJohn Forte 
84fcf3ce44SJohn Forte #define	AUTH_DHCHAP		0x00000001
85fcf3ce44SJohn Forte #define	AUTH_FCAP		0x00000002
86fcf3ce44SJohn Forte #define	AUTH_FCPAP		0x00000003
87fcf3ce44SJohn Forte #define	AUTH_KERBEROS		0x00000004
88fcf3ce44SJohn Forte 
89fcf3ce44SJohn Forte #define	HASH_LIST_TAG		0x0001
90fcf3ce44SJohn Forte #define	DHGID_LIST_TAG		0x0002
91fcf3ce44SJohn Forte 
92fcf3ce44SJohn Forte /* hash function identifiers */
93fcf3ce44SJohn Forte #define	AUTH_SHA1		0x00000006
94fcf3ce44SJohn Forte #define	AUTH_MD5		0x00000005
95fcf3ce44SJohn Forte 
96fcf3ce44SJohn Forte /* DHCHAP group ids */
97fcf3ce44SJohn Forte #define	GROUP_NULL		0x00000000
98fcf3ce44SJohn Forte #define	GROUP_1024		0x00000001
99fcf3ce44SJohn Forte #define	GROUP_1280		0x00000002
100fcf3ce44SJohn Forte #define	GROUP_1536		0x00000003
101fcf3ce44SJohn Forte #define	GROUP_2048		0x00000004
102fcf3ce44SJohn Forte 
103fcf3ce44SJohn Forte /* Tran_id Mask */
104fcf3ce44SJohn Forte #define	AUTH_TRAN_ID_MASK	0x000000FF
105fcf3ce44SJohn Forte 
106fcf3ce44SJohn Forte #endif	/* EMLXS_BIG_ENDIAN */
107fcf3ce44SJohn Forte 
108fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
109fcf3ce44SJohn Forte 
110fcf3ce44SJohn Forte #define	AUTH_DHCHAP		0x01000000
111fcf3ce44SJohn Forte #define	AUTH_FCAP		0x02000000
112fcf3ce44SJohn Forte #define	AUTH_FCPAP		0x03000000
113fcf3ce44SJohn Forte #define	AUTH_KERBEROS		0x04000000
114fcf3ce44SJohn Forte 
115fcf3ce44SJohn Forte #define	HASH_LIST_TAG		0x0100
116fcf3ce44SJohn Forte #define	DHGID_LIST_TAG		0x0200
117fcf3ce44SJohn Forte 
118fcf3ce44SJohn Forte /* hash function identifiers */
119fcf3ce44SJohn Forte #define	AUTH_SHA1		0x06000000
120fcf3ce44SJohn Forte #define	AUTH_MD5		0x05000000
121fcf3ce44SJohn Forte 
122fcf3ce44SJohn Forte /* DHCHAP group ids */
123fcf3ce44SJohn Forte #define	GROUP_NULL		0x00000000
124fcf3ce44SJohn Forte #define	GROUP_1024		0x01000000
125fcf3ce44SJohn Forte #define	GROUP_1280		0x02000000
126fcf3ce44SJohn Forte #define	GROUP_1536		0x03000000
127fcf3ce44SJohn Forte #define	GROUP_2048		0x04000000
128fcf3ce44SJohn Forte 
129fcf3ce44SJohn Forte /* Tran_id Mask */
130fcf3ce44SJohn Forte #define	AUTH_TRAN_ID_MASK	0xFF000000
131fcf3ce44SJohn Forte 
132fcf3ce44SJohn Forte #endif	/* EMLXS_LITTLE_ENDIAN */
133fcf3ce44SJohn Forte 
134fcf3ce44SJohn Forte /* hash funcs hash length in byte */
135fcf3ce44SJohn Forte #define	SHA1_LEN		0x00000014	/* 20 bytes */
136fcf3ce44SJohn Forte #define	MD5_LEN			0x00000010	/* 16 bytes */
137fcf3ce44SJohn Forte 
138fcf3ce44SJohn Forte #define	HBA_SECURITY			0x20
139fcf3ce44SJohn Forte 
140fcf3ce44SJohn Forte /* AUTH_Reject Reason Codes */
141fcf3ce44SJohn Forte #define	AUTHRJT_FAILURE			0x01
142fcf3ce44SJohn Forte #define	AUTHRJT_LOGIC_ERR		0x02
143fcf3ce44SJohn Forte 
144fcf3ce44SJohn Forte /* LS_RJT Reason Codes for AUTH_ELS */
145fcf3ce44SJohn Forte #define	LSRJT_AUTH_REQUIRED		0x03
146fcf3ce44SJohn Forte #define	LSRJT_AUTH_LOGICAL_BSY		0x05
147fcf3ce44SJohn Forte #define	LSRJT_AUTH_ELS_NOT_SUPPORTED	0x0B
148fcf3ce44SJohn Forte #define	LSRJT_AUTH_NOT_LOGGED_IN	0x09
149fcf3ce44SJohn Forte 
150fcf3ce44SJohn Forte /* AUTH_Reject Reason Code Explanations */
151291a2b48SSukumar Swaminathan #define	AUTHEXP_MECH_UNUSABLE		0x01 /* AUTHRJT_LOGIC_ERR */
152291a2b48SSukumar Swaminathan #define	AUTHEXP_DHGROUP_UNUSABLE	0x02 /* AUTHRJT_LOGIC_ERR */
153291a2b48SSukumar Swaminathan #define	AUTHEXP_HASHFUNC_UNUSABLE	0x03 /* AUTHRJT_LOGIC_ERR */
154291a2b48SSukumar Swaminathan #define	AUTHEXP_AUTHTRAN_STARTED	0x04 /* AUTHRJT_LOGIC_ERR */
155291a2b48SSukumar Swaminathan #define	AUTHEXP_AUTH_FAILED		0x05 /* AUTHRJT_FAILURE */
156291a2b48SSukumar Swaminathan #define	AUTHEXP_BAD_PAYLOAD		0x06 /* AUTHRJT_FAILURE */
157291a2b48SSukumar Swaminathan #define	AUTHEXP_BAD_PROTOCOL		0x07 /* AUTHRJT_FAILURE */
158291a2b48SSukumar Swaminathan #define	AUTHEXP_RESTART_AUTH		0x08 /* AUTHRJT_LOGIC_ERR */
159291a2b48SSukumar Swaminathan #define	AUTHEXP_CONCAT_UNSUPP		0x09 /* AUTHRJT_LOGIC_ERR */
160291a2b48SSukumar Swaminathan #define	AUTHEXP_BAD_PROTOVERS		0x0A /* AUTHRJT_LOGIC_ERR */
161fcf3ce44SJohn Forte 
162fcf3ce44SJohn Forte /* LS_RJT Reason Code Explanations for AUTH_ELS */
163fcf3ce44SJohn Forte #define	LSEXP_AUTH_REQUIRED		0x48
164fcf3ce44SJohn Forte #define	LSEXP_AUTH_ELS_NOT_SUPPORTED	0x2C
165fcf3ce44SJohn Forte #define	LSEXP_AUTH_ELS_NOT_LOGGED_IN	0x1E
166fcf3ce44SJohn Forte #define	LSEXP_AUTH_LOGICAL_BUSY		0x00
167fcf3ce44SJohn Forte 
168fcf3ce44SJohn Forte 
169fcf3ce44SJohn Forte #define	MAX_AUTH_MSA_SIZE 1024
170fcf3ce44SJohn Forte 
171fcf3ce44SJohn Forte #define	MAX_AUTH_PID 	0x4	/* Max auth proto identifier list */
172fcf3ce44SJohn Forte 
173fcf3ce44SJohn Forte /* parameter tag */
174fcf3ce44SJohn Forte #define	HASH_LIST	0x0001
175fcf3ce44SJohn Forte #define	DHG_ID_LIST	0x0002
176fcf3ce44SJohn Forte 
177fcf3ce44SJohn Forte /* name tag from Table 13 v1.8 pp 30 */
178fcf3ce44SJohn Forte #ifdef EMLXS_BIG_ENDIAN
179fcf3ce44SJohn Forte #define	AUTH_NAME_ID		0x0001
180fcf3ce44SJohn Forte #define	AUTH_NAME_LEN		0x0008
181fcf3ce44SJohn Forte #define	AUTH_PROTO_NUM		0x00000001
182fcf3ce44SJohn Forte #define	AUTH_NULL_PARA_LEN	0x00000028
183fcf3ce44SJohn Forte #endif	/* EMLXS_BIG_ENDIAN */
184fcf3ce44SJohn Forte 
185fcf3ce44SJohn Forte #ifdef EMLXS_LITTLE_ENDIAN
186fcf3ce44SJohn Forte #define	AUTH_NAME_ID		0x0100
187fcf3ce44SJohn Forte #define	AUTH_NAME_LEN		0x0800
188fcf3ce44SJohn Forte #define	AUTH_PROTO_NUM		0x01000000
189fcf3ce44SJohn Forte #define	AUTH_NULL_PARA_LEN	0x28000000
190fcf3ce44SJohn Forte #endif	/* EMLXS_LITTLE_ENDIAN */
191fcf3ce44SJohn Forte 
192fcf3ce44SJohn Forte /* name tag from Table 103 v 1.8 pp 123 */
193fcf3ce44SJohn Forte #define	AUTH_NODE_NAME		0x0002
194fcf3ce44SJohn Forte #define	AUTH_PORT_NAME		0x0003
195fcf3ce44SJohn Forte 
196fcf3ce44SJohn Forte 
197fcf3ce44SJohn Forte /* From HBAnyware dfc lib FC-SP */
198291a2b48SSukumar Swaminathan typedef struct emlxs_auth_cfg
199291a2b48SSukumar Swaminathan {
200291a2b48SSukumar Swaminathan 	NAME_TYPE		local_entity;	/* host wwpn (NPIV support) */
201291a2b48SSukumar Swaminathan 	NAME_TYPE		remote_entity;	/* switch or target wwpn */
202291a2b48SSukumar Swaminathan 	uint32_t		authentication_timeout;
203291a2b48SSukumar Swaminathan 	uint32_t		authentication_mode;
204291a2b48SSukumar Swaminathan 	uint32_t		bidirectional:1;
205291a2b48SSukumar Swaminathan 	uint32_t		reserved:31;
206291a2b48SSukumar Swaminathan 	uint32_t		authentication_type_priority[4];
207291a2b48SSukumar Swaminathan 	uint32_t		hash_priority[4];
208291a2b48SSukumar Swaminathan 	uint32_t		dh_group_priority[8];
209291a2b48SSukumar Swaminathan 	uint32_t		reauthenticate_time_interval;
210291a2b48SSukumar Swaminathan 
211291a2b48SSukumar Swaminathan 	dfc_auth_status_t	auth_status;
212291a2b48SSukumar Swaminathan 	time_t			auth_time;
213291a2b48SSukumar Swaminathan 	struct emlxs_node	*node;
214291a2b48SSukumar Swaminathan 
215291a2b48SSukumar Swaminathan 	struct emlxs_auth_cfg	*prev;
216291a2b48SSukumar Swaminathan 	struct emlxs_auth_cfg	*next;
217fcf3ce44SJohn Forte } emlxs_auth_cfg_t;
218fcf3ce44SJohn Forte 
219fcf3ce44SJohn Forte 
220291a2b48SSukumar Swaminathan typedef struct emlxs_auth_key
221291a2b48SSukumar Swaminathan {
222291a2b48SSukumar Swaminathan 	NAME_TYPE		local_entity;		/* host wwpn */
223291a2b48SSukumar Swaminathan 							/* (NPIV support) */
224291a2b48SSukumar Swaminathan 	NAME_TYPE		remote_entity;		/* switch or target */
225291a2b48SSukumar Swaminathan 							/* wwpn */
226291a2b48SSukumar Swaminathan 	uint16_t		local_password_length;
227291a2b48SSukumar Swaminathan 	uint16_t		local_password_type;
228291a2b48SSukumar Swaminathan 	uint8_t			local_password[128];	/* hba authenticates */
229291a2b48SSukumar Swaminathan 							/* to switch  */
230291a2b48SSukumar Swaminathan 	uint16_t		remote_password_length;
231291a2b48SSukumar Swaminathan 	uint16_t		remote_password_type;
232291a2b48SSukumar Swaminathan 	uint8_t			remote_password[128];	/* hba authenticates */
233291a2b48SSukumar Swaminathan 							/* to switch  */
234291a2b48SSukumar Swaminathan 
235291a2b48SSukumar Swaminathan 	struct emlxs_node	*node;
236291a2b48SSukumar Swaminathan 
237291a2b48SSukumar Swaminathan 	struct emlxs_auth_key	*prev;
238291a2b48SSukumar Swaminathan 	struct emlxs_auth_key	*next;
239fcf3ce44SJohn Forte } emlxs_auth_key_t;
240fcf3ce44SJohn Forte 
241fcf3ce44SJohn Forte 
242291a2b48SSukumar Swaminathan typedef struct emlxs_auth_misc
243291a2b48SSukumar Swaminathan {
244291a2b48SSukumar Swaminathan 	uint8_t		bi_cval[20];		/* our challenge for bi-dir */
245291a2b48SSukumar Swaminathan 						/* auth in reply as initiator */
246291a2b48SSukumar Swaminathan 	uint32_t	bi_cval_len;		/* 16 for MD5, 20 for SHA1 */
247291a2b48SSukumar Swaminathan 	uint8_t		pub_key[512];		/* max is 512 bytes value of */
248291a2b48SSukumar Swaminathan 						/* (g^y mod p) */
249291a2b48SSukumar Swaminathan 	uint32_t	pubkey_len;		/* real length of the pub key */
250291a2b48SSukumar Swaminathan 	uint8_t		ses_key[512];		/* session key: value of */
251291a2b48SSukumar Swaminathan 						/* (g^xy mod p) */
252291a2b48SSukumar Swaminathan 	uint32_t	seskey_len;		/* real length of the session */
253291a2b48SSukumar Swaminathan 						/* key */
254fcf3ce44SJohn Forte 
255fcf3ce44SJohn Forte 	/* The following are parameters when host is the responder */
256291a2b48SSukumar Swaminathan 	uint8_t		hrsp_cval[20];		/* challenge value from host */
257291a2b48SSukumar Swaminathan 						/* as responder */
258291a2b48SSukumar Swaminathan 	uint32_t	hrsp_cval_len;		/* host as the responder its */
259291a2b48SSukumar Swaminathan 						/* challenge value len */
260291a2b48SSukumar Swaminathan 	uint8_t		hrsp_priv_key[20];	/* the private key generated */
261291a2b48SSukumar Swaminathan 						/* in host as responder */
262291a2b48SSukumar Swaminathan 	uint8_t		hrsp_pub_key[512];	/* public key calculated when */
263291a2b48SSukumar Swaminathan 						/* host as responder */
264291a2b48SSukumar Swaminathan 	uint32_t	hrsp_pubkey_len;	/* public key length when */
265291a2b48SSukumar Swaminathan 						/* host is responder */
266291a2b48SSukumar Swaminathan 	uint8_t		hrsp_ses_key[512];	/* session key computed when */
267291a2b48SSukumar Swaminathan 						/* host is responder */
268291a2b48SSukumar Swaminathan 	uint32_t	hrsp_seskey_len;	/* session key length when */
269291a2b48SSukumar Swaminathan 						/* host is responder */
270fcf3ce44SJohn Forte } emlxs_auth_misc_t;
271fcf3ce44SJohn Forte 
272fcf3ce44SJohn Forte 
273fcf3ce44SJohn Forte /*
274fcf3ce44SJohn Forte  * emlxs_port_dhc struct to be used by emlxs_port_t in emlxs_fc.h
275fcf3ce44SJohn Forte  *
276fcf3ce44SJohn Forte  * This structure contains all the data used by DHCHAP.
277fcf3ce44SJohn Forte  * They are from EMLXSHBA_t in emlxs driver.
278fcf3ce44SJohn Forte  *
279fcf3ce44SJohn Forte  */
280291a2b48SSukumar Swaminathan typedef struct emlxs_port_dhc
281291a2b48SSukumar Swaminathan {
282fcf3ce44SJohn Forte 
283291a2b48SSukumar Swaminathan 	int32_t			state;
284fcf3ce44SJohn Forte #define	ELX_FABRIC_STATE_UNKNOWN	0x00
285fcf3ce44SJohn Forte #define	ELX_FABRIC_AUTH_DISABLED	0x01
286fcf3ce44SJohn Forte #define	ELX_FABRIC_AUTH_FAILED		0x02
287fcf3ce44SJohn Forte #define	ELX_FABRIC_AUTH_SUCCESS		0x03
288fcf3ce44SJohn Forte #define	ELX_FABRIC_IN_AUTH		0x04
289fcf3ce44SJohn Forte #define	ELX_FABRIC_IN_REAUTH		0x05
290fcf3ce44SJohn Forte 
291291a2b48SSukumar Swaminathan 	dfc_auth_status_t	auth_status;  /* Fabric auth status */
292291a2b48SSukumar Swaminathan 	time_t			auth_time;
293fcf3ce44SJohn Forte 
294fcf3ce44SJohn Forte } emlxs_port_dhc_t;
295fcf3ce44SJohn Forte 
296fcf3ce44SJohn Forte 
297fcf3ce44SJohn Forte /* Node Events */
298291a2b48SSukumar Swaminathan #define	NODE_EVENT_DEVICE_RM		0x0	/* Auth response timeout and */
299291a2b48SSukumar Swaminathan 						/* fail */
300291a2b48SSukumar Swaminathan #define	NODE_EVENT_DEVICE_RECOVERY	0x1	/* Auth response timeout and */
301291a2b48SSukumar Swaminathan 						/* recovery */
302fcf3ce44SJohn Forte #define	NODE_EVENT_RCV_AUTH_MSG		0x2	/* Unsolicited Auth received */
303fcf3ce44SJohn Forte #define	NODE_EVENT_CMPL_AUTH_MSG	0x3
304fcf3ce44SJohn Forte #define	NODE_EVENT_MAX_EVENT		0x4
305fcf3ce44SJohn Forte 
306fcf3ce44SJohn Forte /*
307fcf3ce44SJohn Forte  * emlxs_node_dhc struct to be used in emlxs_node_t.
308fcf3ce44SJohn Forte  * They are from emlxs_nodelist_t in emlxs driver.
309fcf3ce44SJohn Forte  */
310291a2b48SSukumar Swaminathan typedef struct emlxs_node_dhc
311291a2b48SSukumar Swaminathan {
312291a2b48SSukumar Swaminathan 	uint16_t		state;		/* used for state machine */
313fcf3ce44SJohn Forte #define	NODE_STATE_UNKNOWN				0x00
314291a2b48SSukumar Swaminathan #define	NODE_STATE_AUTH_DISABLED 			0x01
315fcf3ce44SJohn Forte #define	NODE_STATE_AUTH_FAILED				0x02
316fcf3ce44SJohn Forte #define	NODE_STATE_AUTH_SUCCESS				0x03
317fcf3ce44SJohn Forte #define	NODE_STATE_AUTH_NEGOTIATE_ISSUE			0x04
318fcf3ce44SJohn Forte #define	NODE_STATE_AUTH_NEGOTIATE_RCV			0x05
319fcf3ce44SJohn Forte #define	NODE_STATE_AUTH_NEGOTIATE_CMPL_WAIT4NEXT	0x06
320fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_CHALLENGE_ISSUE		0x07
321fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_REPLY_ISSUE			0x08
322fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_CHALLENGE_CMPL_WAIT4NEXT	0x09
323fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_REPLY_CMPL_WAIT4NEXT		0x0A
324fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_SUCCESS_ISSUE			0x0B
325fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_SUCCESS_ISSUE_WAIT4NEXT	0x0C
326fcf3ce44SJohn Forte #define	NODE_STATE_DHCHAP_SUCCESS_CMPL_WAIT4NEXT	0x0D
327fcf3ce44SJohn Forte #define	NODE_STATE_NOCHANGE				0xFFFFFFFF
328fcf3ce44SJohn Forte 
329291a2b48SSukumar Swaminathan 	uint16_t		prev_state;  /* for info only */
330fcf3ce44SJohn Forte 
331291a2b48SSukumar Swaminathan 	uint32_t		disc_refcnt;
332fcf3ce44SJohn Forte 
333291a2b48SSukumar Swaminathan 	emlxs_auth_cfg_t	auth_cfg;
334291a2b48SSukumar Swaminathan 	emlxs_auth_key_t	auth_key;
335fcf3ce44SJohn Forte 
336291a2b48SSukumar Swaminathan 	uint32_t		nlp_authrsp_tmo;	/* Response timeout */
337291a2b48SSukumar Swaminathan 	uint32_t		nlp_authrsp_tmocnt;
338fcf3ce44SJohn Forte 
339291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_tranid_ini;	/* tran_id when this */
340291a2b48SSukumar Swaminathan 							/* node is initiator */
341291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_tranid_rsp;	/* tran_id when this */
342291a2b48SSukumar Swaminathan 							/* node is responder */
343fcf3ce44SJohn Forte 
344291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_flag;		/* 1:initiator */
345291a2b48SSukumar Swaminathan 							/* 2:responder */
346291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_limit;		/* 1: NULL DHCHAP */
347291a2b48SSukumar Swaminathan 							/* 2: full support */
348fcf3ce44SJohn Forte 
349fcf3ce44SJohn Forte 	/* information in DHCHAP_Challenge as the auth responder */
350291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_hashid;
351291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_dhgpid;
352291a2b48SSukumar Swaminathan 	uint32_t		nlp_auth_bidir;
353291a2b48SSukumar Swaminathan 	NAME_TYPE		nlp_auth_wwn;
354fcf3ce44SJohn Forte 
355291a2b48SSukumar Swaminathan 	emlxs_auth_misc_t	nlp_auth_misc;
356fcf3ce44SJohn Forte 
357291a2b48SSukumar Swaminathan 	uint32_t		nlp_reauth_tmo;
358291a2b48SSukumar Swaminathan 	uint16_t		nlp_reauth_status;
359fcf3ce44SJohn Forte #define	NLP_HOST_REAUTH_DISABLED	0x0
360fcf3ce44SJohn Forte #define	NLP_HOST_REAUTH_ENABLED		0x1
361fcf3ce44SJohn Forte #define	NLP_HOST_REAUTH_IN_PROGRESS	0x2
362fcf3ce44SJohn Forte 
363291a2b48SSukumar Swaminathan 	uint32_t		nlp_fb_vendor;
364291a2b48SSukumar Swaminathan #define	NLP_FABRIC_CISCO	0x1
365291a2b48SSukumar Swaminathan #define	NLP_FABRIC_OTHERS	0x2
366fcf3ce44SJohn Forte 
367291a2b48SSukumar Swaminathan 	uint32_t		fc_dhchap_success_expected;
368fcf3ce44SJohn Forte 
369fcf3ce44SJohn Forte 	/* hash_id, dhgp_id are set from responder, host is the initiator */
370291a2b48SSukumar Swaminathan 	uint32_t		hash_id;		/* 0x05 for MD5 */
371291a2b48SSukumar Swaminathan 							/* 0x06 for SHA-1 */
372291a2b48SSukumar Swaminathan 	uint32_t		dhgp_id;		/* DH grp identifier */
373291a2b48SSukumar Swaminathan 
374291a2b48SSukumar Swaminathan 	uint8_t			bi_cval[20];		/* our challenge for */
375291a2b48SSukumar Swaminathan 							/* bi-dir auth in */
376291a2b48SSukumar Swaminathan 							/* reply as initiator */
377291a2b48SSukumar Swaminathan 	uint32_t		bi_cval_len;		/* 16 for MD5 */
378291a2b48SSukumar Swaminathan 							/* 20 for SHA1 */
379291a2b48SSukumar Swaminathan 	uint8_t			pub_key[512];		/* max is 512 bytes */
380291a2b48SSukumar Swaminathan 							/* value (g^y mod p) */
381291a2b48SSukumar Swaminathan 	uint32_t		pubkey_len;		/* real length of the */
382291a2b48SSukumar Swaminathan 							/* pub key */
383291a2b48SSukumar Swaminathan 	uint8_t			ses_key[512];		/* session key: */
384291a2b48SSukumar Swaminathan 							/* value (g^xy mod p) */
385291a2b48SSukumar Swaminathan 	uint32_t		seskey_len;		/* real length of the */
386291a2b48SSukumar Swaminathan 							/* session key */
387fcf3ce44SJohn Forte 
388fcf3ce44SJohn Forte 	/* The following are parameters when host is the responder */
389fcf3ce44SJohn Forte 
390291a2b48SSukumar Swaminathan 	uint8_t			hrsp_cval[20];		/* challenge value */
391291a2b48SSukumar Swaminathan 	uint32_t		hrsp_cval_len;		/* challenge value */
392291a2b48SSukumar Swaminathan 							/* length */
393291a2b48SSukumar Swaminathan 	uint8_t			hrsp_priv_key[20];	/* private key */
394291a2b48SSukumar Swaminathan 							/* generated */
395291a2b48SSukumar Swaminathan 	uint8_t			hrsp_pub_key[512];	/* public key */
396291a2b48SSukumar Swaminathan 							/* computed */
397291a2b48SSukumar Swaminathan 	uint32_t		hrsp_pubkey_len;	/* public key length */
398291a2b48SSukumar Swaminathan 	uint8_t			hrsp_ses_key[512];	/* session key */
399291a2b48SSukumar Swaminathan 							/* computed */
400291a2b48SSukumar Swaminathan 	uint32_t		hrsp_seskey_len;	/* session key length */
401291a2b48SSukumar Swaminathan 
402291a2b48SSukumar Swaminathan 	uint8_t			*deferred_sbp;		/* Pending IO for */
403291a2b48SSukumar Swaminathan 							/* auth completion */
404291a2b48SSukumar Swaminathan 	uint8_t			*deferred_ubp;
405291a2b48SSukumar Swaminathan 
406291a2b48SSukumar Swaminathan 	uint32_t		flag;
407fcf3ce44SJohn Forte #define	NLP_REMOTE_AUTH			0x00000001
408fcf3ce44SJohn Forte #define	NLP_SET_REAUTH_TIME		0x00000002
409fcf3ce44SJohn Forte 
410291a2b48SSukumar Swaminathan 	emlxs_auth_cfg_t	*parent_auth_cfg;	/* Original auth_cfg */
411291a2b48SSukumar Swaminathan 							/* table entry */
412291a2b48SSukumar Swaminathan 	emlxs_auth_key_t	*parent_auth_key;	/* Original auth_key */
413291a2b48SSukumar Swaminathan 							/* table entry */
414fcf3ce44SJohn Forte } emlxs_node_dhc_t;
415fcf3ce44SJohn Forte 
416fcf3ce44SJohn Forte 
417fcf3ce44SJohn Forte /* For NULL DHCHAP with MD5 and SHA-1 */
418291a2b48SSukumar Swaminathan typedef struct _AUTH_NEGOT_PARAMS_1
419291a2b48SSukumar Swaminathan {
420291a2b48SSukumar Swaminathan 	uint16_t  name_tag;		/* set to 0x0001 */
421291a2b48SSukumar Swaminathan 	uint16_t  name_len;		/* set to 0x0008 */
422291a2b48SSukumar Swaminathan 	NAME_TYPE nodeName;		/* WWPN */
423291a2b48SSukumar Swaminathan 	uint32_t  proto_num;		/* set to 0x5 */
424291a2b48SSukumar Swaminathan 	uint32_t  para_len;		/* set to 0x28 i.e., 40 bytes */
425291a2b48SSukumar Swaminathan 	uint32_t  proto_id;		/* set to HDCHAP */
426291a2b48SSukumar Swaminathan 	uint16_t  HashList_tag;		/* set to 0x0001 */
427291a2b48SSukumar Swaminathan 	uint16_t  HashList_wcnt;	/* set to 0x0002 i.e. MD5 and SHA-1 */
428291a2b48SSukumar Swaminathan 	uint32_t  HashList_value1;	/* set to MD5 or SHA1 ID 0x00000005,6 */
429291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_tag;	/* set to 0x0002 */
430291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_wnt;	/* set to 0x0005 i.e., Full DH groups */
431291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g0;		/* set to 0x0000 0000 */
432291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g1;		/* set to 0x0000 0001 */
433291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g2;		/* set to 0x0000 0002 */
434291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g3;		/* set to 0x0000 0003 */
435291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g4;		/* set to 0x0000 0004 */
436fcf3ce44SJohn Forte } AUTH_NEGOT_PARAMS_1;
437fcf3ce44SJohn Forte 
438fcf3ce44SJohn Forte 
439291a2b48SSukumar Swaminathan typedef struct _AUTH_NEGOT_PARAMS_2
440291a2b48SSukumar Swaminathan {
441291a2b48SSukumar Swaminathan 	uint16_t  name_tag;		/* set to 0x0001 */
442291a2b48SSukumar Swaminathan 	uint16_t  name_len;		/* set to 0x0008 */
443291a2b48SSukumar Swaminathan 	NAME_TYPE nodeName;		/* WWPN */
444291a2b48SSukumar Swaminathan 	uint32_t  proto_num;		/* set to 0x5 */
445291a2b48SSukumar Swaminathan 	uint32_t  para_len;		/* set to 0x28 i.e., 40 bytes */
446291a2b48SSukumar Swaminathan 	uint32_t  proto_id;		/* set to HDCHAP */
447291a2b48SSukumar Swaminathan 	uint16_t  HashList_tag;		/* set to 0x0001 */
448291a2b48SSukumar Swaminathan 	uint16_t  HashList_wcnt;	/* set to 0x0002 i.e. MD5 and SHA-1 */
449291a2b48SSukumar Swaminathan 	uint32_t  HashList_value1;	/* set to MD5's   ID 0x00000005 */
450291a2b48SSukumar Swaminathan 	uint32_t  HashList_value2;	/* set to SHA-1's ID 0x00000006 */
451291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_tag;	/* set to 0x0002 */
452291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_wnt;	/* set to 0x0005 i.e., Full DH groups */
453291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g0;		/* set to 0x0000 0000 */
454291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g1;		/* set to 0x0000 0001 */
455291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g2;		/* set to 0x0000 0002 */
456291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g3;		/* set to 0x0000 0003 */
457291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g4;		/* set to 0x0000 0004 */
458fcf3ce44SJohn Forte } AUTH_NEGOT_PARAMS_2;
459fcf3ce44SJohn Forte 
460fcf3ce44SJohn Forte 
461fcf3ce44SJohn Forte /* For NULL DHCHAP with MD5 and SHA-1 */
462291a2b48SSukumar Swaminathan typedef struct _AUTH_NEGOT_PARAMS
463291a2b48SSukumar Swaminathan {
464291a2b48SSukumar Swaminathan 	uint16_t  name_tag;		/* set to 0x0001 */
465291a2b48SSukumar Swaminathan 	uint16_t  name_len;		/* set to 0x0008 */
466291a2b48SSukumar Swaminathan 	NAME_TYPE nodeName;		/* WWPN */
467291a2b48SSukumar Swaminathan 	uint32_t  proto_num;		/* set to 0x5 */
468291a2b48SSukumar Swaminathan 	uint32_t  para_len;		/* set to 0x28 i.e., 40 bytes */
469291a2b48SSukumar Swaminathan 	uint32_t  proto_id;		/* set to HDCHAP */
470291a2b48SSukumar Swaminathan 	uint16_t  HashList_tag;		/* set to 0x0001 */
471291a2b48SSukumar Swaminathan 	uint16_t  HashList_wcnt;	/* set to 0x0002 i.e. MD5 and SHA-1 */
472291a2b48SSukumar Swaminathan 	uint32_t  HashList_value1;	/* set to MD5's   ID 0x00000005 */
473291a2b48SSukumar Swaminathan 	uint32_t  HashList_value2;	/* set to SHA-1's ID 0x00000006 */
474291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_tag;	/* set to 0x0002 */
475291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_wnt;	/* set to 0x0005 i.e., Full DH groups */
476291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g0;		/* set to 0x0000 0000 */
477291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g1;		/* set to 0x0000 0001 */
478291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g2;		/* set to 0x0000 0002 */
479291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g3;		/* set to 0x0000 0003 */
480291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g4;		/* set to 0x0000 0004 */
481fcf3ce44SJohn Forte } AUTH_NEGOT_PARAMS;
482fcf3ce44SJohn Forte 
483291a2b48SSukumar Swaminathan typedef struct _AUTH_NEGOT_PARAMS_NULL_1
484291a2b48SSukumar Swaminathan {
485291a2b48SSukumar Swaminathan 	uint16_t  name_tag;		/* set to 0x0001 */
486291a2b48SSukumar Swaminathan 	uint16_t  name_len;		/* set to 0x0008 */
487291a2b48SSukumar Swaminathan 	NAME_TYPE nodeName;		/* WWPN */
488291a2b48SSukumar Swaminathan 	uint32_t  proto_num;		/* set to 0x5 */
489291a2b48SSukumar Swaminathan 	uint32_t  para_len;		/* set to 0x28 i.e., 40 bytes */
490291a2b48SSukumar Swaminathan 	uint32_t  proto_id;		/* set to HDCHAP */
491291a2b48SSukumar Swaminathan 	uint16_t  HashList_tag;		/* set to 0x0001 */
492291a2b48SSukumar Swaminathan 	uint16_t  HashList_wcnt;	/* set to 0x0002 i.e. MD5 and SHA-1 */
493291a2b48SSukumar Swaminathan 	uint32_t  HashList_value1;	/* set to MD5's   ID 0x00000005 */
494291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_tag;	/* set to 0x0002 */
495291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_wnt;	/* set to 0x0005 i.e., Full DH groups */
496291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g0;		/* set to 0x0000 0000 */
497fcf3ce44SJohn Forte } AUTH_NEGOT_PARAMS_NULL_1;
498fcf3ce44SJohn Forte 
499291a2b48SSukumar Swaminathan typedef struct _AUTH_NEGOT_PARAMS_NULL_2
500291a2b48SSukumar Swaminathan {
501291a2b48SSukumar Swaminathan 	uint16_t  name_tag;		/* set to 0x0001 */
502291a2b48SSukumar Swaminathan 	uint16_t  name_len;		/* set to 0x0008 */
503291a2b48SSukumar Swaminathan 	NAME_TYPE nodeName;		/* WWPN */
504291a2b48SSukumar Swaminathan 	uint32_t  proto_num;		/* set to 0x5 */
505291a2b48SSukumar Swaminathan 	uint32_t  para_len;		/* set to 0x28 i.e., 40 bytes */
506291a2b48SSukumar Swaminathan 	uint32_t  proto_id;		/* set to HDCHAP */
507291a2b48SSukumar Swaminathan 	uint16_t  HashList_tag;		/* set to 0x0001 */
508291a2b48SSukumar Swaminathan 	uint16_t  HashList_wcnt;	/* set to 0x0002 i.e. MD5 and SHA-1 */
509291a2b48SSukumar Swaminathan 	uint32_t  HashList_value1;	/* set to MD5's   ID 0x00000005 */
510291a2b48SSukumar Swaminathan 	uint32_t  HashList_value2;
511291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_tag;	/* set to 0x0002 */
512291a2b48SSukumar Swaminathan 	uint16_t  DHgIDList_wnt;	/* set to 0x0005 i.e., Full DH groups */
513291a2b48SSukumar Swaminathan 	uint32_t  DHgIDList_g0;		/* set to 0x0000 0000 */
514fcf3ce44SJohn Forte } AUTH_NEGOT_PARAMS_NULL_2;
515fcf3ce44SJohn Forte 
516fcf3ce44SJohn Forte 
517fcf3ce44SJohn Forte /* Generic AUTH ELS Header */
518291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_HDR
519291a2b48SSukumar Swaminathan {
520fcf3ce44SJohn Forte 	/* 20 bytes in total */
521291a2b48SSukumar Swaminathan 	uint8_t		auth_els_code;	/* always 0x90h */
522291a2b48SSukumar Swaminathan 	uint8_t		auth_els_flags;
523291a2b48SSukumar Swaminathan 	uint8_t		auth_msg_code;	/* see above */
524291a2b48SSukumar Swaminathan 	uint8_t		proto_version;
525291a2b48SSukumar Swaminathan 	uint32_t	msg_len;	/* size of msg payload in byte */
526291a2b48SSukumar Swaminathan 	uint32_t	tran_id;
527291a2b48SSukumar Swaminathan 	uint16_t	name_tag;	/* set to 0x0001 */
528291a2b48SSukumar Swaminathan 	uint16_t	name_len;	/* set to 0x0008 */
529291a2b48SSukumar Swaminathan 	NAME_TYPE	nodeName;	/* WWPN */
530fcf3ce44SJohn Forte } AUTH_MSG_HDR;
531fcf3ce44SJohn Forte 
532fcf3ce44SJohn Forte 
533291a2b48SSukumar Swaminathan typedef struct _SHA1_CVAL
534291a2b48SSukumar Swaminathan {
535fcf3ce44SJohn Forte 	uint8_t val[20];
536fcf3ce44SJohn Forte } SHA1_CVAL;
537fcf3ce44SJohn Forte 
538fcf3ce44SJohn Forte 
539291a2b48SSukumar Swaminathan typedef struct _MD5_CVAL
540291a2b48SSukumar Swaminathan {
541291a2b48SSukumar Swaminathan 	uint8_t	val[16];
542fcf3ce44SJohn Forte } MD5_CVAL;
543fcf3ce44SJohn Forte 
544fcf3ce44SJohn Forte 
545291a2b48SSukumar Swaminathan union challenge_val
546291a2b48SSukumar Swaminathan {
547291a2b48SSukumar Swaminathan 	SHA1_CVAL	sha1;
548291a2b48SSukumar Swaminathan 	MD5_CVAL	md5;
549fcf3ce44SJohn Forte };
550fcf3ce44SJohn Forte 
551fcf3ce44SJohn Forte 
552fcf3ce44SJohn Forte /* DHCHAP_Replay */
553291a2b48SSukumar Swaminathan typedef struct _DHCHAP_REPLY_HDR
554291a2b48SSukumar Swaminathan {
555291a2b48SSukumar Swaminathan 	uint8_t  auth_els_code;	/* always 0x90h */
556291a2b48SSukumar Swaminathan 	uint8_t  auth_els_flags;
557291a2b48SSukumar Swaminathan 	uint8_t  auth_msg_code;	/* see above */
558291a2b48SSukumar Swaminathan 	uint8_t  proto_version;
559fcf3ce44SJohn Forte 	uint32_t msg_len;	/* size of msg payload in byte */
560fcf3ce44SJohn Forte 	uint32_t tran_id;	/* transaction id */
561fcf3ce44SJohn Forte } DHCHAP_REPLY_HDR;
562fcf3ce44SJohn Forte 
563fcf3ce44SJohn Forte 
564fcf3ce44SJohn Forte /* DHCHAP_Challenge */
565291a2b48SSukumar Swaminathan typedef struct _DHCHAP_CHALL_NULL
566291a2b48SSukumar Swaminathan {
567291a2b48SSukumar Swaminathan 	AUTH_MSG_HDR	msg_hdr;
568291a2b48SSukumar Swaminathan 	uint32_t	hash_id;
569291a2b48SSukumar Swaminathan 	uint32_t	dhgp_id;
570291a2b48SSukumar Swaminathan 	uint32_t	cval_len;
571fcf3ce44SJohn Forte } DHCHAP_CHALL_NULL;
572fcf3ce44SJohn Forte 
573291a2b48SSukumar Swaminathan typedef struct _DHCHAP_CHALL
574291a2b48SSukumar Swaminathan {
575291a2b48SSukumar Swaminathan 	DHCHAP_CHALL_NULL	cnul;
576291a2b48SSukumar Swaminathan 	uint8_t			*dhval;
577fcf3ce44SJohn Forte } DHCHAP_CHALL;
578fcf3ce44SJohn Forte 
579fcf3ce44SJohn Forte /*
580291a2b48SSukumar Swaminathan  * size of msg_payload is variable based on the different protocol
581291a2b48SSukumar Swaminathan  * parameters supported in the driver.
582291a2b48SSukumar Swaminathan  *
583291a2b48SSukumar Swaminathan  * For DHCHAP we plan to support NULL, group 1, 2, 3, 4.
584fcf3ce44SJohn Forte  *
585fcf3ce44SJohn Forte  * For NULL DHCHAP protocol only: of these protocol identifiers,
586291a2b48SSukumar Swaminathan  * we need name_tag = 2 bytes name_len_size = 2 bytes name_len = 8 bytes
587291a2b48SSukumar Swaminathan  * number of usable auth proto = 4 bytes
588fcf3ce44SJohn Forte  *
589fcf3ce44SJohn Forte  * --------- for example for NULL DHCAHP only --------------------
590291a2b48SSukumar Swaminathan  * auth proto #1 len = 4 bytes #1 ID  = 4 bytes #1 params = 4 + 16 bytes.
591291a2b48SSukumar Swaminathan  * ------ Total for NULL DHCHAP = (16 + 12 + 16 ) = 44 bytes.
592fcf3ce44SJohn Forte  *
593291a2b48SSukumar Swaminathan  * If number of usable auth proto is 5, then we should have 5 auth proto params.
594291a2b48SSukumar Swaminathan  * assume we are using name_tag 0x0001, then auth name in total = 12 bytes.
595fcf3ce44SJohn Forte  *
596fcf3ce44SJohn Forte  * 12 bytes + 4 bytes = 16 bytes. 4 + 4 + 4 = 12 bytes
597291a2b48SSukumar Swaminathan  * (num of usable auth proto size = 4
598291a2b48SSukumar Swaminathan  * auth proto params #1 len size = 4
599291a2b48SSukumar Swaminathan  * auth prot ID for #1 size  = 4
600fcf3ce44SJohn Forte  *
601291a2b48SSukumar Swaminathan  * For DHCHAP param: HashList	2 param tag size (set to 0x0001 as HashList)
602291a2b48SSukumar Swaminathan  * 2 param word cnt size (set to 0x0002 as two hash funcs)
603291a2b48SSukumar Swaminathan  * 8 for hash ids: MD5 and SHA-1 DHgIDList
604291a2b48SSukumar Swaminathan  * 2 param tag size (set to 0x0002 as DHgIDList)
605291a2b48SSukumar Swaminathan  * 2 param word cnt size (set to 0x0005 as NULL and 1/2/3/4 groups) 20 for
606291a2b48SSukumar Swaminathan  * 5 groups 0x0000 0000 0x0000 0001 0x0000 0002 0x0000 0003 0x0000 0004
607291a2b48SSukumar Swaminathan  * Total for FULL group support (16 + 12 + 12 + 24 ) = 64 bytes.
608fcf3ce44SJohn Forte  *
609fcf3ce44SJohn Forte  */
610fcf3ce44SJohn Forte 
611291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT_1 { /* in Big Endian format */
612291a2b48SSukumar Swaminathan 	uint8_t			auth_els_code;  /* always 0x90h */
613291a2b48SSukumar Swaminathan 	uint8_t			auth_els_flags;
614291a2b48SSukumar Swaminathan 	uint8_t			auth_msg_code;  /* see above */
615291a2b48SSukumar Swaminathan 	uint8_t			proto_version;
616291a2b48SSukumar Swaminathan 	uint32_t		msg_len;	/* size of msg payload */
617291a2b48SSukumar Swaminathan 						/* in byte */
618291a2b48SSukumar Swaminathan 	uint32_t		tran_id;	/* transaction identifier */
619fcf3ce44SJohn Forte 
620fcf3ce44SJohn Forte 	/* anything else is variable in size (bytes) */
621fcf3ce44SJohn Forte 	/* uint8_t   msg_payload[MAX_AUTH_MSG_SIZE]; */
622291a2b48SSukumar Swaminathan 	AUTH_NEGOT_PARAMS_1	params;
623fcf3ce44SJohn Forte } AUTH_MSG_NEGOT_1, *PAUTH_MSG_NEGOT_1;
624fcf3ce44SJohn Forte 
625fcf3ce44SJohn Forte 
626291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT_2 { /* in Big Endian format */
627291a2b48SSukumar Swaminathan 	uint8_t			auth_els_code;  /* always 0x90h */
628291a2b48SSukumar Swaminathan 	uint8_t			auth_els_flags;
629291a2b48SSukumar Swaminathan 	uint8_t			auth_msg_code;  /* see above */
630291a2b48SSukumar Swaminathan 	uint8_t			proto_version;
631291a2b48SSukumar Swaminathan 	uint32_t		msg_len;	/* size of msg payload */
632291a2b48SSukumar Swaminathan 						/* in byte */
633291a2b48SSukumar Swaminathan 	uint32_t		tran_id;	/* transaction identifier */
634fcf3ce44SJohn Forte 
635fcf3ce44SJohn Forte 	/* anything else is variable in size (bytes) */
636fcf3ce44SJohn Forte 	/* uint8_t   msg_payload[MAX_AUTH_MSG_SIZE]; */
637291a2b48SSukumar Swaminathan 	AUTH_NEGOT_PARAMS_2	params;
638fcf3ce44SJohn Forte } AUTH_MSG_NEGOT_2, *PAUTH_MSG_NEGOT_2;
639fcf3ce44SJohn Forte 
640fcf3ce44SJohn Forte 
641291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT
642291a2b48SSukumar Swaminathan {
643291a2b48SSukumar Swaminathan 	/* in Big Endian format */
644291a2b48SSukumar Swaminathan 	uint8_t			auth_els_code;	/* always 0x90h */
645291a2b48SSukumar Swaminathan 	uint8_t			auth_els_flags;
646291a2b48SSukumar Swaminathan 	uint8_t			auth_msg_code;	/* see above */
647291a2b48SSukumar Swaminathan 	uint8_t			proto_version;
648291a2b48SSukumar Swaminathan 	uint32_t		msg_len;	/* size of msg payload */
649291a2b48SSukumar Swaminathan 						/* in byte */
650291a2b48SSukumar Swaminathan 	uint32_t		tran_id;	/* transaction identifier */
651fcf3ce44SJohn Forte 
652fcf3ce44SJohn Forte 	/* anything else is variable in size (bytes) */
653fcf3ce44SJohn Forte 	/* uint8_t	msg_payload[MAX_AUTH_MSG_SIZE]; */
654291a2b48SSukumar Swaminathan 	AUTH_NEGOT_PARAMS	params;
655fcf3ce44SJohn Forte } AUTH_MSG_NEGOT, *PAUTH_MSG_NEGOT;
656fcf3ce44SJohn Forte 
657fcf3ce44SJohn Forte 
658fcf3ce44SJohn Forte /* AUTH_Negotiate msg for NULL DH support only */
659291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT_NULL
660291a2b48SSukumar Swaminathan {
661291a2b48SSukumar Swaminathan 	uint8_t  auth_els_code;
662291a2b48SSukumar Swaminathan 	uint8_t  auth_els_flags;
663291a2b48SSukumar Swaminathan 	uint8_t  auth_msg_code;
664291a2b48SSukumar Swaminathan 	uint8_t  proto_version;
665fcf3ce44SJohn Forte 	uint32_t msg_len;
666fcf3ce44SJohn Forte 	uint32_t tran_id;
667fcf3ce44SJohn Forte } AUTH_MSG_NEGOT_NULL, *PAUTH_MSG_NEGOT_NULL;
668fcf3ce44SJohn Forte 
669291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT_NULL_1
670291a2b48SSukumar Swaminathan {
671291a2b48SSukumar Swaminathan 	uint8_t				auth_els_code;
672291a2b48SSukumar Swaminathan 	uint8_t				auth_els_flags;
673291a2b48SSukumar Swaminathan 	uint8_t				auth_msg_code;
674291a2b48SSukumar Swaminathan 	uint8_t				proto_version;
675291a2b48SSukumar Swaminathan 	uint32_t			msg_len;
676291a2b48SSukumar Swaminathan 	uint32_t			tran_id;
677fcf3ce44SJohn Forte 
678291a2b48SSukumar Swaminathan 	AUTH_NEGOT_PARAMS_NULL_1	params;
679fcf3ce44SJohn Forte 
680fcf3ce44SJohn Forte } AUTH_MSG_NEGOT_NULL_1, *PAUTH_MSG_NEGOT_NULL_1;
681fcf3ce44SJohn Forte 
682291a2b48SSukumar Swaminathan typedef struct _AUTH_MSG_NEGOT_NULL_2
683291a2b48SSukumar Swaminathan {
684291a2b48SSukumar Swaminathan 	uint8_t				auth_els_code;
685291a2b48SSukumar Swaminathan 	uint8_t				auth_els_flags;
686291a2b48SSukumar Swaminathan 	uint8_t				auth_msg_code;
687291a2b48SSukumar Swaminathan 	uint8_t				proto_version;
688291a2b48SSukumar Swaminathan 	uint32_t			msg_len;
689291a2b48SSukumar Swaminathan 	uint32_t			tran_id;
690fcf3ce44SJohn Forte 
691291a2b48SSukumar Swaminathan 	AUTH_NEGOT_PARAMS_NULL_2	params;
692fcf3ce44SJohn Forte 
693fcf3ce44SJohn Forte } AUTH_MSG_NEGOT_NULL_2, *PAUTH_MSG_NEGOT_NULL_2;
694fcf3ce44SJohn Forte 
695fcf3ce44SJohn Forte 
696fcf3ce44SJohn Forte /* auth_els_flags */
697fcf3ce44SJohn Forte #define	AUTH_ELS_FLAGS_MASK	0x0f;
698fcf3ce44SJohn Forte 
699fcf3ce44SJohn Forte 
700291a2b48SSukumar Swaminathan typedef struct _AUTH_RJT
701291a2b48SSukumar Swaminathan {
702291a2b48SSukumar Swaminathan 	uint8_t  auth_els_code;	/* always 0x90h */
703291a2b48SSukumar Swaminathan 	uint8_t  auth_els_flags;
704291a2b48SSukumar Swaminathan 	uint8_t  auth_msg_code;	/* see above */
705291a2b48SSukumar Swaminathan 	uint8_t  proto_version;
706fcf3ce44SJohn Forte 	uint32_t msg_len;	/* size of msg payload in byte */
707fcf3ce44SJohn Forte 	uint32_t tran_id;	/* transaction identifier */
708fcf3ce44SJohn Forte 
709291a2b48SSukumar Swaminathan 	uint8_t  ReasonCode;
710291a2b48SSukumar Swaminathan 	uint8_t  ReasonCodeExplanation;
711fcf3ce44SJohn Forte 	uint16_t Reserved;
712fcf3ce44SJohn Forte } AUTH_RJT, *PAUTH_RJT;
713fcf3ce44SJohn Forte 
714291a2b48SSukumar Swaminathan typedef struct _DHCHAP_SUCCESS_HDR
715291a2b48SSukumar Swaminathan {
716291a2b48SSukumar Swaminathan 	uint8_t  auth_els_code;	/* always 0x90h */
717291a2b48SSukumar Swaminathan 	uint8_t  auth_els_flags;
718291a2b48SSukumar Swaminathan 	uint8_t  auth_msg_code;	/* see above */
719291a2b48SSukumar Swaminathan 	uint8_t  proto_version;
720fcf3ce44SJohn Forte 	uint32_t msg_len;	/* size of msg payload in byte */
721fcf3ce44SJohn Forte 	uint32_t tran_id;	/* transaction identifier */
722fcf3ce44SJohn Forte 
723fcf3ce44SJohn Forte 	uint32_t RspVal_len;
724fcf3ce44SJohn Forte } DHCHAP_SUCCESS_HDR, *PDHCHAP_SUCCESS_HDR;
725fcf3ce44SJohn Forte 
726fcf3ce44SJohn Forte 
727291a2b48SSukumar Swaminathan typedef struct dh_group_st
728291a2b48SSukumar Swaminathan {
729291a2b48SSukumar Swaminathan 	unsigned long   groupid;
730291a2b48SSukumar Swaminathan 	unsigned long   length;
731291a2b48SSukumar Swaminathan 	unsigned char   value[256];
732fcf3ce44SJohn Forte } DH_GROUP, *PDH_GROUP;
733fcf3ce44SJohn Forte 
734fcf3ce44SJohn Forte #pragma weak random_get_pseudo_bytes
735fcf3ce44SJohn Forte 
736fcf3ce44SJohn Forte 
737fcf3ce44SJohn Forte #endif	/* DHCHAP_SUPPORT */
738fcf3ce44SJohn Forte 
739fcf3ce44SJohn Forte #ifdef	__cplusplus
740fcf3ce44SJohn Forte }
741fcf3ce44SJohn Forte #endif
742fcf3ce44SJohn Forte 
743fcf3ce44SJohn Forte #endif	/* _EMLXS_DHCHAP_H */
744