00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef EAP_TLS_COMMON_H
00016 #define EAP_TLS_COMMON_H
00017
00021 struct eap_ssl_data {
00025 struct tls_connection *conn;
00026
00030 struct wpabuf *tls_out;
00031
00035 size_t tls_out_pos;
00036
00040 size_t tls_out_limit;
00041
00045 struct wpabuf *tls_in;
00046
00050 int phase2;
00051
00055 struct eap_sm *eap;
00056
00057 enum { MSG, FRAG_ACK, WAIT_FRAG_ACK } state;
00058 struct wpabuf tmpbuf;
00059 };
00060
00061
00062
00063 #define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80
00064 #define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
00065 #define EAP_TLS_FLAGS_START 0x20
00066 #define EAP_TLS_VERSION_MASK 0x07
00067
00068
00069 #define EAP_TLS_KEY_LEN 64
00070
00071
00072 int eap_server_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
00073 int verify_peer);
00074 void eap_server_tls_ssl_deinit(struct eap_sm *sm, struct eap_ssl_data *data);
00075 u8 * eap_server_tls_derive_key(struct eap_sm *sm, struct eap_ssl_data *data,
00076 char *label, size_t len);
00077 struct wpabuf * eap_server_tls_build_msg(struct eap_ssl_data *data,
00078 int eap_type, int version, u8 id);
00079 struct wpabuf * eap_server_tls_build_ack(u8 id, int eap_type, int version);
00080 int eap_server_tls_phase1(struct eap_sm *sm, struct eap_ssl_data *data);
00081 struct wpabuf * eap_server_tls_encrypt(struct eap_sm *sm,
00082 struct eap_ssl_data *data,
00083 const struct wpabuf *plain);
00084 int eap_server_tls_process(struct eap_sm *sm, struct eap_ssl_data *data,
00085 struct wpabuf *respData, void *priv, int eap_type,
00086 int (*proc_version)(struct eap_sm *sm, void *priv,
00087 int peer_version),
00088 void (*proc_msg)(struct eap_sm *sm, void *priv,
00089 const struct wpabuf *respData));
00090
00091 #endif