2 * eap.h - Extensible Authentication Protocol for PPP (RFC 2284)
4 * Copyright (c) 2001 by Sun Microsystems, Inc.
7 * Non-exclusive rights to redistribute, modify, translate, and use
8 * this software in source and binary forms, in whole or in part, is
9 * hereby granted, provided that the above copyright notice is
10 * duplicated in any source form, and that neither the name of the
11 * copyright holder nor the author is used to endorse or promote
12 * products derived from this software.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 * Original version by James Carlson
20 * $Id: eap.h,v 1.1 2002/11/02 19:48:12 carlsonj Exp $
31 * Packet header = Code, id, length.
33 #define EAP_HEADERLEN 4
36 /* EAP message codes. */
38 #define EAP_RESPONSE 2
43 #define EAPT_IDENTITY 1
44 #define EAPT_NOTIFICATION 2
45 #define EAPT_NAK 3 /* (response only) */
46 #define EAPT_MD5CHAP 4
47 #define EAPT_OTP 5 /* One-Time Password; RFC 1938 */
48 #define EAPT_TOKEN 6 /* Generic Token Card */
49 /* 7 and 8 are unassigned. */
50 #define EAPT_RSA 9 /* RSA Public Key Authentication */
51 #define EAPT_DSS 10 /* DSS Unilateral */
52 #define EAPT_KEA 11 /* KEA */
53 #define EAPT_KEA_VALIDATE 12 /* KEA-VALIDATE */
54 #define EAPT_TLS 13 /* EAP-TLS */
55 #define EAPT_DEFENDER 14 /* Defender Token (AXENT) */
56 #define EAPT_W2K 15 /* Windows 2000 EAP */
57 #define EAPT_ARCOT 16 /* Arcot Systems */
58 #define EAPT_CISCOWIRELESS 17 /* Cisco Wireless */
59 #define EAPT_NOKIACARD 18 /* Nokia IP smart card */
60 #define EAPT_SRP 19 /* Secure Remote Password */
61 /* 20 is deprecated */
63 /* EAP SRP-SHA1 Subtypes */
64 #define EAPSRP_CHALLENGE 1 /* Request 1 - Challenge */
65 #define EAPSRP_CKEY 1 /* Response 1 - Client Key */
66 #define EAPSRP_SKEY 2 /* Request 2 - Server Key */
67 #define EAPSRP_CVALIDATOR 2 /* Response 2 - Client Validator */
68 #define EAPSRP_SVALIDATOR 3 /* Request 3 - Server Validator */
69 #define EAPSRP_ACK 3 /* Response 3 - final ack */
70 #define EAPSRP_LWRECHALLENGE 4 /* Req/resp 4 - Lightweight rechal */
72 #define SRPVAL_EBIT 0x00000001 /* Use shared key for ECP */
74 #define SRP_PSEUDO_ID "pseudo_"
75 #define SRP_PSEUDO_LEN 7
78 eapInitial = 0, /* No EAP authentication yet requested */
79 eapPending, /* Waiting for LCP (no timer) */
80 eapClosed, /* Authentication not in use */
81 eapListen, /* Client ready (and timer running) */
82 eapIdentify, /* EAP Identify sent */
83 eapSRP1, /* Sent EAP SRP-SHA1 Subtype 1 */
84 eapSRP2, /* Sent EAP SRP-SHA1 Subtype 2 */
85 eapSRP3, /* Sent EAP SRP-SHA1 Subtype 3 */
86 eapMD5Chall, /* Sent MD5-Challenge */
87 eapOpen, /* Completed authentication */
88 eapSRP4, /* Sent EAP SRP-SHA1 Subtype 4 */
89 eapBadAuth /* Failed authentication */
93 "Initial", "Pending", "Closed", "Listen", "Identify", \
94 "SRP1", "SRP2", "SRP3", "MD5Chall", "Open", "SRP4", "BadAuth"
96 #define eap_client_active(esp) ((esp)->es_client.ea_state == eapListen)
97 #define eap_server_active(esp) \
98 ((esp)->es_server.ea_state >= eapIdentify && \
99 (esp)->es_server.ea_state <= eapMD5Chall)
102 char *ea_name; /* Our name */
103 char *ea_peer; /* Peer's name */
104 void *ea_session; /* Authentication library linkage */
105 u_char *ea_skey; /* Shared encryption key */
106 int ea_timeout; /* Time to wait (for retransmit/fail) */
107 int ea_maxrequests; /* Max Requests allowed */
108 u_short ea_namelen; /* Length of our name */
109 u_short ea_peerlen; /* Length of peer's name */
110 enum eap_state_code ea_state;
111 u_char ea_id; /* Current id */
112 u_char ea_requests; /* Number of Requests sent/received */
113 u_char ea_responses; /* Number of Responses */
114 u_char ea_type; /* One of EAPT_* */
115 u_int32_t ea_keyflags; /* SRP shared key usage flags */
119 * Complete EAP state for one PPP session.
121 typedef struct eap_state {
122 int es_unit; /* Interface unit number */
123 struct eap_auth es_client; /* Client (authenticatee) data */
124 struct eap_auth es_server; /* Server (authenticator) data */
125 int es_savedtime; /* Saved timeout */
126 int es_rechallenge; /* EAP rechallenge interval */
127 int es_lwrechallenge; /* SRP lightweight rechallenge inter */
128 bool es_usepseudo; /* Use SRP Pseudonym if offered one */
129 int es_usedpseudo; /* Set if we already sent PN */
130 int es_challen; /* Length of challenge string */
131 u_char es_challenge[MAX_CHALLENGE_LENGTH];
137 #define EAP_DEFTIMEOUT 3 /* Timeout (seconds) for rexmit */
138 #define EAP_DEFTRANSMITS 10 /* max # times to transmit */
139 #define EAP_DEFREQTIME 20 /* Time to wait for peer request */
140 #define EAP_DEFALLOWREQ 20 /* max # times to accept requests */
142 extern eap_state eap_states[];
144 void eap_authwithpeer __P((int unit, char *localname));
145 void eap_authpeer __P((int unit, char *localname));
147 extern struct protent eap_protent;
153 #endif /* PPP_EAP_H */