MFC: Fix comments.
[dragonfly.git] / contrib / wpa_supplicant-0.5.8 / eap_tls_common.h
blob59de922c0ecba2302bb68efe71f5531af9995984
1 /*
2 * EAP peer: EAP-TLS/PEAP/TTLS/FAST common functions
3 * Copyright (c) 2004-2005, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
12 * See README and COPYING for more details.
15 #ifndef EAP_TLS_COMMON_H
16 #define EAP_TLS_COMMON_H
18 struct eap_ssl_data {
19 struct tls_connection *conn;
21 u8 *tls_out;
22 size_t tls_out_len;
23 size_t tls_out_pos;
24 size_t tls_out_limit;
25 u8 *tls_in;
26 size_t tls_in_len;
27 size_t tls_in_left;
28 size_t tls_in_total;
30 int phase2;
31 int include_tls_length; /* include TLS length field even if the TLS
32 * data is not fragmented */
33 int tls_ia; /* Enable TLS/IA */
35 struct eap_sm *eap;
39 /* EAP TLS Flags */
40 #define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80
41 #define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
42 #define EAP_TLS_FLAGS_START 0x20
43 #define EAP_PEAP_VERSION_MASK 0x07
45 /* could be up to 128 bytes, but only the first 64 bytes are used */
46 #define EAP_TLS_KEY_LEN 64
49 int eap_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
50 struct wpa_ssid *config);
51 void eap_tls_ssl_deinit(struct eap_sm *sm, struct eap_ssl_data *data);
52 u8 * eap_tls_derive_key(struct eap_sm *sm, struct eap_ssl_data *data,
53 const char *label, size_t len);
54 const u8 * eap_tls_data_reassemble(
55 struct eap_sm *sm, struct eap_ssl_data *data, const u8 *in_data,
56 size_t in_len, size_t *out_len, int *need_more_input);
57 int eap_tls_process_helper(struct eap_sm *sm, struct eap_ssl_data *data,
58 EapType eap_type, int peap_version,
59 u8 id, const u8 *in_data, size_t in_len,
60 u8 **out_data, size_t *out_len);
61 u8 * eap_tls_build_ack(struct eap_ssl_data *data, size_t *respDataLen, u8 id,
62 EapType eap_type, int peap_version);
63 int eap_tls_reauth_init(struct eap_sm *sm, struct eap_ssl_data *data);
64 int eap_tls_status(struct eap_sm *sm, struct eap_ssl_data *data, char *buf,
65 size_t buflen, int verbose);
66 const u8 * eap_tls_process_init(struct eap_sm *sm, struct eap_ssl_data *data,
67 EapType eap_type, struct eap_method_ret *ret,
68 const u8 *reqData, size_t reqDataLen,
69 size_t *len, u8 *flags);
71 #endif /* EAP_TLS_COMMON_H */