$search
00001 /* 00002 * EAP-TLS/PEAP/TTLS/FAST server common functions 00003 * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 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 /* EAP TLS Flags */ 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 /* could be up to 128 bytes, but only the first 64 bytes are used */ 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 /* EAP_TLS_COMMON_H */