]>
git.ipfire.org Git - thirdparty/hostap.git/blob - src/eap_server/eap_tls_common.h
2 * EAP-TLS/PEAP/TTLS/FAST server common functions
3 * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #ifndef EAP_TLS_COMMON_H
10 #define EAP_TLS_COMMON_H
13 * struct eap_ssl_data - TLS data for EAP methods
17 * conn - TLS connection context data from tls_connection_init()
19 struct tls_connection
*conn
;
22 * tls_out - TLS message to be sent out in fragments
24 struct wpabuf
*tls_out
;
27 * tls_out_pos - The current position in the outgoing TLS message
32 * tls_out_limit - Maximum fragment size for outgoing TLS messages
37 * tls_in - Received TLS message buffer for re-assembly
39 struct wpabuf
*tls_in
;
42 * phase2 - Whether this TLS connection is used in EAP phase 2 (tunnel)
47 * eap - EAP state machine allocated with eap_server_sm_init()
51 enum { MSG
, FRAG_ACK
, WAIT_FRAG_ACK
} state
;
55 * tls_v13 - Whether TLS v1.3 or newer is used
62 #define EAP_TLS_FLAGS_LENGTH_INCLUDED 0x80
63 #define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
64 #define EAP_TLS_FLAGS_START 0x20
65 #define EAP_TLS_VERSION_MASK 0x07
67 /* could be up to 128 bytes, but only the first 64 bytes are used */
68 #define EAP_TLS_KEY_LEN 64
70 /* dummy type used as a flag for UNAUTH-TLS */
71 #define EAP_UNAUTH_TLS_TYPE 255
72 #define EAP_WFA_UNAUTH_TLS_TYPE 254
75 struct wpabuf
* eap_tls_msg_alloc(EapType type
, size_t payload_len
,
76 u8 code
, u8 identifier
);
77 int eap_server_tls_ssl_init(struct eap_sm
*sm
, struct eap_ssl_data
*data
,
78 int verify_peer
, int eap_type
);
79 void eap_server_tls_ssl_deinit(struct eap_sm
*sm
, struct eap_ssl_data
*data
);
80 u8
* eap_server_tls_derive_key(struct eap_sm
*sm
, struct eap_ssl_data
*data
,
81 const char *label
, size_t len
);
82 u8
* eap_server_tls_derive_session_id(struct eap_sm
*sm
,
83 struct eap_ssl_data
*data
, u8 eap_type
,
85 struct wpabuf
* eap_server_tls_build_msg(struct eap_ssl_data
*data
,
86 int eap_type
, int version
, u8 id
);
87 struct wpabuf
* eap_server_tls_build_ack(u8 id
, int eap_type
, int version
);
88 int eap_server_tls_phase1(struct eap_sm
*sm
, struct eap_ssl_data
*data
);
89 struct wpabuf
* eap_server_tls_encrypt(struct eap_sm
*sm
,
90 struct eap_ssl_data
*data
,
91 const struct wpabuf
*plain
);
92 int eap_server_tls_process(struct eap_sm
*sm
, struct eap_ssl_data
*data
,
93 struct wpabuf
*respData
, void *priv
, int eap_type
,
94 int (*proc_version
)(struct eap_sm
*sm
, void *priv
,
96 void (*proc_msg
)(struct eap_sm
*sm
, void *priv
,
97 const struct wpabuf
*respData
));
99 #endif /* EAP_TLS_COMMON_H */