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