automake build system
[mech_eap.orig] / src / eap_peer / eap_config.h
1 /*
2  * EAP peer configuration data
3  * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14
15 #ifndef EAP_CONFIG_H
16 #define EAP_CONFIG_H
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /**
23  * struct eap_peer_config - EAP peer configuration/credentials
24  */
25 struct eap_peer_config {
26         /**
27          * identity - EAP Identity
28          *
29          * This field is used to set the real user identity or NAI (for
30          * EAP-PSK/PAX/SAKE/GPSK).
31          */
32         u8 *identity;
33
34         /**
35          * identity_len - EAP Identity length
36          */
37         size_t identity_len;
38
39         /**
40          * anonymous_identity -  Anonymous EAP Identity
41          *
42          * This field is used for unencrypted use with EAP types that support
43          * different tunnelled identity, e.g., EAP-TTLS, in order to reveal the
44          * real identity (identity field) only to the authentication server.
45          *
46          * If not set, the identity field will be used for both unencrypted and
47          * protected fields.
48          */
49         u8 *anonymous_identity;
50
51         /**
52          * anonymous_identity_len - Length of anonymous_identity
53          */
54         size_t anonymous_identity_len;
55
56         /**
57          * password - Password string for EAP
58          *
59          * This field can include either the plaintext password (default
60          * option) or a NtPasswordHash (16-byte MD4 hash of the unicode
61          * presentation of the password) if flags field has
62          * EAP_CONFIG_FLAGS_PASSWORD_NTHASH bit set to 1. NtPasswordHash can
63          * only be used with authentication mechanism that use this hash as the
64          * starting point for operation: MSCHAP and MSCHAPv2 (EAP-MSCHAPv2,
65          * EAP-TTLS/MSCHAPv2, EAP-TTLS/MSCHAP, LEAP).
66          *
67          * In addition, this field is used to configure a pre-shared key for
68          * EAP-PSK/PAX/SAKE/GPSK. The length of the PSK must be 16 for EAP-PSK
69          * and EAP-PAX and 32 for EAP-SAKE. EAP-GPSK can use a variable length
70          * PSK.
71          */
72         u8 *password;
73
74         /**
75          * password_len - Length of password field
76          */
77         size_t password_len;
78
79         /**
80          * ca_cert - File path to CA certificate file (PEM/DER)
81          *
82          * This file can have one or more trusted CA certificates. If ca_cert
83          * and ca_path are not included, server certificate will not be
84          * verified. This is insecure and a trusted CA certificate should
85          * always be configured when using EAP-TLS/TTLS/PEAP. Full path to the
86          * file should be used since working directory may change when
87          * wpa_supplicant is run in the background.
88          *
89          * Alternatively, a named configuration blob can be used by setting
90          * this to blob://blob_name.
91          *
92          * Alternatively, this can be used to only perform matching of the
93          * server certificate (SHA-256 hash of the DER encoded X.509
94          * certificate). In this case, the possible CA certificates in the
95          * server certificate chain are ignored and only the server certificate
96          * is verified. This is configured with the following format:
97          * hash:://server/sha256/cert_hash_in_hex
98          * For example: "hash://server/sha256/
99          * 5a1bc1296205e6fdbe3979728efe3920798885c1c4590b5f90f43222d239ca6a"
100          *
101          * On Windows, trusted CA certificates can be loaded from the system
102          * certificate store by setting this to cert_store://name, e.g.,
103          * ca_cert="cert_store://CA" or ca_cert="cert_store://ROOT".
104          * Note that when running wpa_supplicant as an application, the user
105          * certificate store (My user account) is used, whereas computer store
106          * (Computer account) is used when running wpasvc as a service.
107          */
108         u8 *ca_cert;
109
110         /**
111          * ca_path - Directory path for CA certificate files (PEM)
112          *
113          * This path may contain multiple CA certificates in OpenSSL format.
114          * Common use for this is to point to system trusted CA list which is
115          * often installed into directory like /etc/ssl/certs. If configured,
116          * these certificates are added to the list of trusted CAs. ca_cert
117          * may also be included in that case, but it is not required.
118          */
119         u8 *ca_path;
120
121         /**
122          * client_cert - File path to client certificate file (PEM/DER)
123          *
124          * This field is used with EAP method that use TLS authentication.
125          * Usually, this is only configured for EAP-TLS, even though this could
126          * in theory be used with EAP-TTLS and EAP-PEAP, too. Full path to the
127          * file should be used since working directory may change when
128          * wpa_supplicant is run in the background.
129          *
130          * Alternatively, a named configuration blob can be used by setting
131          * this to blob://blob_name.
132          */
133         u8 *client_cert;
134
135         /**
136          * private_key - File path to client private key file (PEM/DER/PFX)
137          *
138          * When PKCS#12/PFX file (.p12/.pfx) is used, client_cert should be
139          * commented out. Both the private key and certificate will be read
140          * from the PKCS#12 file in this case. Full path to the file should be
141          * used since working directory may change when wpa_supplicant is run
142          * in the background.
143          *
144          * Windows certificate store can be used by leaving client_cert out and
145          * configuring private_key in one of the following formats:
146          *
147          * cert://substring_to_match
148          *
149          * hash://certificate_thumbprint_in_hex
150          *
151          * For example: private_key="hash://63093aa9c47f56ae88334c7b65a4"
152          *
153          * Note that when running wpa_supplicant as an application, the user
154          * certificate store (My user account) is used, whereas computer store
155          * (Computer account) is used when running wpasvc as a service.
156          *
157          * Alternatively, a named configuration blob can be used by setting
158          * this to blob://blob_name.
159          */
160         u8 *private_key;
161
162         /**
163          * private_key_passwd - Password for private key file
164          *
165          * If left out, this will be asked through control interface.
166          */
167         u8 *private_key_passwd;
168
169         /**
170          * dh_file - File path to DH/DSA parameters file (in PEM format)
171          *
172          * This is an optional configuration file for setting parameters for an
173          * ephemeral DH key exchange. In most cases, the default RSA
174          * authentication does not use this configuration. However, it is
175          * possible setup RSA to use ephemeral DH key exchange. In addition,
176          * ciphers with DSA keys always use ephemeral DH keys. This can be used
177          * to achieve forward secrecy. If the file is in DSA parameters format,
178          * it will be automatically converted into DH params. Full path to the
179          * file should be used since working directory may change when
180          * wpa_supplicant is run in the background.
181          *
182          * Alternatively, a named configuration blob can be used by setting
183          * this to blob://blob_name.
184          */
185         u8 *dh_file;
186
187         /**
188          * subject_match - Constraint for server certificate subject
189          *
190          * This substring is matched against the subject of the authentication
191          * server certificate. If this string is set, the server sertificate is
192          * only accepted if it contains this string in the subject. The subject
193          * string is in following format:
194          *
195          * /C=US/ST=CA/L=San Francisco/CN=Test AS/emailAddress=as@n.example.com
196          */
197         u8 *subject_match;
198
199         /**
200          * altsubject_match - Constraint for server certificate alt. subject
201          *
202          * Semicolon separated string of entries to be matched against the
203          * alternative subject name of the authentication server certificate.
204          * If this string is set, the server sertificate is only accepted if it
205          * contains one of the entries in an alternative subject name
206          * extension.
207          *
208          * altSubjectName string is in following format: TYPE:VALUE
209          *
210          * Example: EMAIL:server@example.com
211          * Example: DNS:server.example.com;DNS:server2.example.com
212          *
213          * Following types are supported: EMAIL, DNS, URI
214          */
215         u8 *altsubject_match;
216
217         /**
218          * ca_cert2 - File path to CA certificate file (PEM/DER) (Phase 2)
219          *
220          * This file can have one or more trusted CA certificates. If ca_cert2
221          * and ca_path2 are not included, server certificate will not be
222          * verified. This is insecure and a trusted CA certificate should
223          * always be configured. Full path to the file should be used since
224          * working directory may change when wpa_supplicant is run in the
225          * background.
226          *
227          * This field is like ca_cert, but used for phase 2 (inside
228          * EAP-TTLS/PEAP/FAST tunnel) authentication.
229          *
230          * Alternatively, a named configuration blob can be used by setting
231          * this to blob://blob_name.
232          */
233         u8 *ca_cert2;
234
235         /**
236          * ca_path2 - Directory path for CA certificate files (PEM) (Phase 2)
237          *
238          * This path may contain multiple CA certificates in OpenSSL format.
239          * Common use for this is to point to system trusted CA list which is
240          * often installed into directory like /etc/ssl/certs. If configured,
241          * these certificates are added to the list of trusted CAs. ca_cert
242          * may also be included in that case, but it is not required.
243          *
244          * This field is like ca_path, but used for phase 2 (inside
245          * EAP-TTLS/PEAP/FAST tunnel) authentication.
246          */
247         u8 *ca_path2;
248
249         /**
250          * client_cert2 - File path to client certificate file
251          *
252          * This field is like client_cert, but used for phase 2 (inside
253          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
254          * file should be used since working directory may change when
255          * wpa_supplicant is run in the background.
256          *
257          * Alternatively, a named configuration blob can be used by setting
258          * this to blob://blob_name.
259          */
260         u8 *client_cert2;
261
262         /**
263          * private_key2 - File path to client private key file
264          *
265          * This field is like private_key, but used for phase 2 (inside
266          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
267          * file should be used since working directory may change when
268          * wpa_supplicant is run in the background.
269          *
270          * Alternatively, a named configuration blob can be used by setting
271          * this to blob://blob_name.
272          */
273         u8 *private_key2;
274
275         /**
276          * private_key2_passwd -  Password for private key file
277          *
278          * This field is like private_key_passwd, but used for phase 2 (inside
279          * EAP-TTLS/PEAP/FAST tunnel) authentication.
280          */
281         u8 *private_key2_passwd;
282
283         /**
284          * dh_file2 - File path to DH/DSA parameters file (in PEM format)
285          *
286          * This field is like dh_file, but used for phase 2 (inside
287          * EAP-TTLS/PEAP/FAST tunnel) authentication. Full path to the
288          * file should be used since working directory may change when
289          * wpa_supplicant is run in the background.
290          *
291          * Alternatively, a named configuration blob can be used by setting
292          * this to blob://blob_name.
293          */
294         u8 *dh_file2;
295
296         /**
297          * subject_match2 - Constraint for server certificate subject
298          *
299          * This field is like subject_match, but used for phase 2 (inside
300          * EAP-TTLS/PEAP/FAST tunnel) authentication.
301          */
302         u8 *subject_match2;
303
304         /**
305          * altsubject_match2 - Constraint for server certificate alt. subject
306          *
307          * This field is like altsubject_match, but used for phase 2 (inside
308          * EAP-TTLS/PEAP/FAST tunnel) authentication.
309          */
310         u8 *altsubject_match2;
311
312         /**
313          * eap_methods - Allowed EAP methods
314          *
315          * (vendor=EAP_VENDOR_IETF,method=EAP_TYPE_NONE) terminated list of
316          * allowed EAP methods or %NULL if all methods are accepted.
317          */
318         struct eap_method_type *eap_methods;
319
320         /**
321          * phase1 - Phase 1 (outer authentication) parameters
322          *
323          * String with field-value pairs, e.g., "peapver=0" or
324          * "peapver=1 peaplabel=1".
325          *
326          * 'peapver' can be used to force which PEAP version (0 or 1) is used.
327          *
328          * 'peaplabel=1' can be used to force new label, "client PEAP
329          * encryption", to be used during key derivation when PEAPv1 or newer.
330          *
331          * Most existing PEAPv1 implementation seem to be using the old label,
332          * "client EAP encryption", and wpa_supplicant is now using that as the
333          * default value.
334          *
335          * Some servers, e.g., Radiator, may require peaplabel=1 configuration
336          * to interoperate with PEAPv1; see eap_testing.txt for more details.
337          *
338          * 'peap_outer_success=0' can be used to terminate PEAP authentication
339          * on tunneled EAP-Success. This is required with some RADIUS servers
340          * that implement draft-josefsson-pppext-eap-tls-eap-05.txt (e.g.,
341          * Lucent NavisRadius v4.4.0 with PEAP in "IETF Draft 5" mode).
342          *
343          * include_tls_length=1 can be used to force wpa_supplicant to include
344          * TLS Message Length field in all TLS messages even if they are not
345          * fragmented.
346          *
347          * sim_min_num_chal=3 can be used to configure EAP-SIM to require three
348          * challenges (by default, it accepts 2 or 3).
349          *
350          * result_ind=1 can be used to enable EAP-SIM and EAP-AKA to use
351          * protected result indication.
352          *
353          * fast_provisioning option can be used to enable in-line provisioning
354          * of EAP-FAST credentials (PAC):
355          * 0 = disabled,
356          * 1 = allow unauthenticated provisioning,
357          * 2 = allow authenticated provisioning,
358          * 3 = allow both unauthenticated and authenticated provisioning
359          *
360          * fast_max_pac_list_len=num option can be used to set the maximum
361          * number of PAC entries to store in a PAC list (default: 10).
362          *
363          * fast_pac_format=binary option can be used to select binary format
364          * for storing PAC entries in order to save some space (the default
365          * text format uses about 2.5 times the size of minimal binary format).
366          *
367          * crypto_binding option can be used to control PEAPv0 cryptobinding
368          * behavior:
369          * 0 = do not use cryptobinding (default)
370          * 1 = use cryptobinding if server supports it
371          * 2 = require cryptobinding
372          *
373          * EAP-WSC (WPS) uses following options: pin=Device_Password and
374          * uuid=Device_UUID
375          */
376         char *phase1;
377
378         /**
379          * phase2 - Phase2 (inner authentication with TLS tunnel) parameters
380          *
381          * String with field-value pairs, e.g., "auth=MSCHAPV2" for EAP-PEAP or
382          * "autheap=MSCHAPV2 autheap=MD5" for EAP-TTLS.
383          */
384         char *phase2;
385
386         /**
387          * pcsc - Parameters for PC/SC smartcard interface for USIM and GSM SIM
388          *
389          * This field is used to configure PC/SC smartcard interface.
390          * Currently, the only configuration is whether this field is %NULL (do
391          * not use PC/SC) or non-NULL (e.g., "") to enable PC/SC.
392          *
393          * This field is used for EAP-SIM and EAP-AKA.
394          */
395         char *pcsc;
396
397         /**
398          * pin - PIN for USIM, GSM SIM, and smartcards
399          *
400          * This field is used to configure PIN for SIM and smartcards for
401          * EAP-SIM and EAP-AKA. In addition, this is used with EAP-TLS if a
402          * smartcard is used for private key operations.
403          *
404          * If left out, this will be asked through control interface.
405          */
406         char *pin;
407
408         /**
409          * engine - Enable OpenSSL engine (e.g., for smartcard access)
410          *
411          * This is used if private key operations for EAP-TLS are performed
412          * using a smartcard.
413          */
414         int engine;
415
416         /**
417          * engine_id - Engine ID for OpenSSL engine
418          *
419          * "opensc" to select OpenSC engine or "pkcs11" to select PKCS#11
420          * engine.
421          *
422          * This is used if private key operations for EAP-TLS are performed
423          * using a smartcard.
424          */
425         char *engine_id;
426
427         /**
428          * engine2 - Enable OpenSSL engine (e.g., for smartcard) (Phase 2)
429          *
430          * This is used if private key operations for EAP-TLS are performed
431          * using a smartcard.
432          *
433          * This field is like engine, but used for phase 2 (inside
434          * EAP-TTLS/PEAP/FAST tunnel) authentication.
435          */
436         int engine2;
437
438
439         /**
440          * pin2 - PIN for USIM, GSM SIM, and smartcards (Phase 2)
441          *
442          * This field is used to configure PIN for SIM and smartcards for
443          * EAP-SIM and EAP-AKA. In addition, this is used with EAP-TLS if a
444          * smartcard is used for private key operations.
445          *
446          * This field is like pin2, but used for phase 2 (inside
447          * EAP-TTLS/PEAP/FAST tunnel) authentication.
448          *
449          * If left out, this will be asked through control interface.
450          */
451         char *pin2;
452
453         /**
454          * engine2_id - Engine ID for OpenSSL engine (Phase 2)
455          *
456          * "opensc" to select OpenSC engine or "pkcs11" to select PKCS#11
457          * engine.
458          *
459          * This is used if private key operations for EAP-TLS are performed
460          * using a smartcard.
461          *
462          * This field is like engine_id, but used for phase 2 (inside
463          * EAP-TTLS/PEAP/FAST tunnel) authentication.
464          */
465         char *engine2_id;
466
467
468         /**
469          * key_id - Key ID for OpenSSL engine
470          *
471          * This is used if private key operations for EAP-TLS are performed
472          * using a smartcard.
473          */
474         char *key_id;
475
476         /**
477          * cert_id - Cert ID for OpenSSL engine
478          *
479          * This is used if the certificate operations for EAP-TLS are performed
480          * using a smartcard.
481          */
482         char *cert_id;
483
484         /**
485          * ca_cert_id - CA Cert ID for OpenSSL engine
486          *
487          * This is used if the CA certificate for EAP-TLS is on a smartcard.
488          */
489         char *ca_cert_id;
490
491         /**
492          * key2_id - Key ID for OpenSSL engine (phase2)
493          *
494          * This is used if private key operations for EAP-TLS are performed
495          * using a smartcard.
496          */
497         char *key2_id;
498
499         /**
500          * cert2_id - Cert ID for OpenSSL engine (phase2)
501          *
502          * This is used if the certificate operations for EAP-TLS are performed
503          * using a smartcard.
504          */
505         char *cert2_id;
506
507         /**
508          * ca_cert2_id - CA Cert ID for OpenSSL engine (phase2)
509          *
510          * This is used if the CA certificate for EAP-TLS is on a smartcard.
511          */
512         char *ca_cert2_id;
513
514         /**
515          * otp - One-time-password
516          *
517          * This field should not be set in configuration step. It is only used
518          * internally when OTP is entered through the control interface.
519          */
520         u8 *otp;
521
522         /**
523          * otp_len - Length of the otp field
524          */
525         size_t otp_len;
526
527         /**
528          * pending_req_identity - Whether there is a pending identity request
529          *
530          * This field should not be set in configuration step. It is only used
531          * internally when control interface is used to request needed
532          * information.
533          */
534         int pending_req_identity;
535
536         /**
537          * pending_req_password - Whether there is a pending password request
538          *
539          * This field should not be set in configuration step. It is only used
540          * internally when control interface is used to request needed
541          * information.
542          */
543         int pending_req_password;
544
545         /**
546          * pending_req_pin - Whether there is a pending PIN request
547          *
548          * This field should not be set in configuration step. It is only used
549          * internally when control interface is used to request needed
550          * information.
551          */
552         int pending_req_pin;
553
554         /**
555          * pending_req_new_password - Pending password update request
556          *
557          * This field should not be set in configuration step. It is only used
558          * internally when control interface is used to request needed
559          * information.
560          */
561         int pending_req_new_password;
562
563         /**
564          * pending_req_passphrase - Pending passphrase request
565          *
566          * This field should not be set in configuration step. It is only used
567          * internally when control interface is used to request needed
568          * information.
569          */
570         int pending_req_passphrase;
571
572         /**
573          * pending_req_otp - Whether there is a pending OTP request
574          *
575          * This field should not be set in configuration step. It is only used
576          * internally when control interface is used to request needed
577          * information.
578          */
579         char *pending_req_otp;
580
581         /**
582          * pending_req_otp_len - Length of the pending OTP request
583          */
584         size_t pending_req_otp_len;
585
586         /**
587          * pac_file - File path or blob name for the PAC entries (EAP-FAST)
588          *
589          * wpa_supplicant will need to be able to create this file and write
590          * updates to it when PAC is being provisioned or refreshed. Full path
591          * to the file should be used since working directory may change when
592          * wpa_supplicant is run in the background.
593          * Alternatively, a named configuration blob can be used by setting
594          * this to blob://blob_name.
595          */
596         char *pac_file;
597
598         /**
599          * mschapv2_retry - MSCHAPv2 retry in progress
600          *
601          * This field is used internally by EAP-MSCHAPv2 and should not be set
602          * as part of configuration.
603          */
604         int mschapv2_retry;
605
606         /**
607          * new_password - New password for password update
608          *
609          * This field is used during MSCHAPv2 password update. This is normally
610          * requested from the user through the control interface and not set
611          * from configuration.
612          */
613         u8 *new_password;
614
615         /**
616          * new_password_len - Length of new_password field
617          */
618         size_t new_password_len;
619
620         /**
621          * fragment_size - Maximum EAP fragment size in bytes (default 1398)
622          *
623          * This value limits the fragment size for EAP methods that support
624          * fragmentation (e.g., EAP-TLS and EAP-PEAP). This value should be set
625          * small enough to make the EAP messages fit in MTU of the network
626          * interface used for EAPOL. The default value is suitable for most
627          * cases.
628          */
629         int fragment_size;
630
631 #define EAP_CONFIG_FLAGS_PASSWORD_NTHASH BIT(0)
632         /**
633          * flags - Network configuration flags (bitfield)
634          *
635          * This variable is used for internal flags to describe further details
636          * for the network parameters.
637          * bit 0 = password is represented as a 16-byte NtPasswordHash value
638          *         instead of plaintext password
639          */
640         u32 flags;
641 };
642
643
644 /**
645  * struct wpa_config_blob - Named configuration blob
646  *
647  * This data structure is used to provide storage for binary objects to store
648  * abstract information like certificates and private keys inlined with the
649  * configuration data.
650  */
651 struct wpa_config_blob {
652         /**
653          * name - Blob name
654          */
655         char *name;
656
657         /**
658          * data - Pointer to binary data
659          */
660         u8 *data;
661
662         /**
663          * len - Length of binary data
664          */
665         size_t len;
666
667         /**
668          * next - Pointer to next blob in the configuration
669          */
670         struct wpa_config_blob *next;
671 };
672
673 #ifdef __cplusplus
674 }
675 #endif
676
677 #endif /* EAP_CONFIG_H */