hostapd: Update vendor branch to 0.6.10
[dragonfly.git] / contrib / hostapd / src / eap_server / eap_tls_common.h
blobce8dd252bc6dc4bc52fd30e2f6372b16ee1df727
1 /*
2 * hostapd / EAP-TLS/PEAP/TTLS/FAST common functions
3 * Copyright (c) 2004-2008, 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 size_t tls_out_limit;
23 int phase2;
25 struct eap_sm *eap;
27 enum { MSG, FRAG_ACK, WAIT_FRAG_ACK } state;
28 struct wpabuf *in_buf;
29 struct wpabuf *out_buf;
30 size_t out_used;
31 struct wpabuf tmpbuf;
35 /* EAP TLS Flags */
36 #define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80
37 #define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
38 #define EAP_TLS_FLAGS_START 0x20
39 #define EAP_TLS_VERSION_MASK 0x07
41 /* could be up to 128 bytes, but only the first 64 bytes are used */
42 #define EAP_TLS_KEY_LEN 64
45 int eap_server_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
46 int verify_peer);
47 void eap_server_tls_ssl_deinit(struct eap_sm *sm, struct eap_ssl_data *data);
48 u8 * eap_server_tls_derive_key(struct eap_sm *sm, struct eap_ssl_data *data,
49 char *label, size_t len);
50 struct wpabuf * eap_server_tls_build_msg(struct eap_ssl_data *data,
51 int eap_type, int version, u8 id);
52 struct wpabuf * eap_server_tls_build_ack(u8 id, int eap_type, int version);
53 int eap_server_tls_phase1(struct eap_sm *sm, struct eap_ssl_data *data);
54 struct wpabuf * eap_server_tls_encrypt(struct eap_sm *sm,
55 struct eap_ssl_data *data,
56 const u8 *plain, size_t plain_len);
57 int eap_server_tls_process(struct eap_sm *sm, struct eap_ssl_data *data,
58 struct wpabuf *respData, void *priv, int eap_type,
59 int (*proc_version)(struct eap_sm *sm, void *priv,
60 int peer_version),
61 void (*proc_msg)(struct eap_sm *sm, void *priv,
62 const struct wpabuf *respData));
64 #endif /* EAP_TLS_COMMON_H */