Add UNAUTH-TLS vendor specific EAP type
This EAP type uses a vendor specific expanded EAP header to encapsulate EAP-TLS with a configuration where the EAP server does not authenticate the EAP peer. In other words, this method includes only server authentication. The peer is configured with only the ca_cert parameter (similarly to other TLS-based EAP methods). This method can be used for cases where the network provides free access to anyone, but use of RSN with a securely derived unique PMK for each station is desired. The expanded EAP header uses the hostapd/wpa_supplicant vendor code 39068 and vendor type 1 to identify the UNAUTH-TLS method. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
d13f9857f8
commit
065d2895b4
13 changed files with 225 additions and 23 deletions
|
@ -85,6 +85,7 @@ static inline int eap_peer_method_unload(struct eap_method *method)
|
|||
/* EAP peer method registration calls for statically linked in methods */
|
||||
int eap_peer_md5_register(void);
|
||||
int eap_peer_tls_register(void);
|
||||
int eap_peer_unauth_tls_register(void);
|
||||
int eap_peer_mschapv2_register(void);
|
||||
int eap_peer_peap_register(void);
|
||||
int eap_peer_ttls_register(void);
|
||||
|
|
|
@ -22,6 +22,7 @@ struct eap_tls_data {
|
|||
struct eap_ssl_data ssl;
|
||||
u8 *key_data;
|
||||
void *ssl_ctx;
|
||||
u8 eap_type;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,10 +63,39 @@ static void * eap_tls_init(struct eap_sm *sm)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
data->eap_type = EAP_TYPE_TLS;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
#ifdef EAP_UNAUTH_TLS
|
||||
static void * eap_unauth_tls_init(struct eap_sm *sm)
|
||||
{
|
||||
struct eap_tls_data *data;
|
||||
struct eap_peer_config *config = eap_get_config(sm);
|
||||
|
||||
data = os_zalloc(sizeof(*data));
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
|
||||
data->ssl_ctx = sm->init_phase2 && sm->ssl_ctx2 ? sm->ssl_ctx2 :
|
||||
sm->ssl_ctx;
|
||||
|
||||
if (eap_peer_tls_ssl_init(sm, &data->ssl, config,
|
||||
EAP_UNAUTH_TLS_TYPE)) {
|
||||
wpa_printf(MSG_INFO, "EAP-TLS: Failed to initialize SSL.");
|
||||
eap_tls_deinit(sm, data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->eap_type = EAP_UNAUTH_TLS_TYPE;
|
||||
|
||||
return data;
|
||||
}
|
||||
#endif /* EAP_UNAUTH_TLS */
|
||||
|
||||
|
||||
static void eap_tls_deinit(struct eap_sm *sm, void *priv)
|
||||
{
|
||||
struct eap_tls_data *data = priv;
|
||||
|
@ -109,7 +139,7 @@ static struct wpabuf * eap_tls_failure(struct eap_sm *sm,
|
|||
return resp;
|
||||
}
|
||||
|
||||
return eap_peer_tls_build_ack(id, EAP_TYPE_TLS, 0);
|
||||
return eap_peer_tls_build_ack(id, data->eap_type, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,7 +179,7 @@ static struct wpabuf * eap_tls_process(struct eap_sm *sm, void *priv,
|
|||
const u8 *pos;
|
||||
struct eap_tls_data *data = priv;
|
||||
|
||||
pos = eap_peer_tls_process_init(sm, &data->ssl, EAP_TYPE_TLS, ret,
|
||||
pos = eap_peer_tls_process_init(sm, &data->ssl, data->eap_type, ret,
|
||||
reqData, &left, &flags);
|
||||
if (pos == NULL)
|
||||
return NULL;
|
||||
|
@ -162,8 +192,8 @@ static struct wpabuf * eap_tls_process(struct eap_sm *sm, void *priv,
|
|||
}
|
||||
|
||||
resp = NULL;
|
||||
res = eap_peer_tls_process_helper(sm, &data->ssl, EAP_TYPE_TLS, 0, id,
|
||||
pos, left, &resp);
|
||||
res = eap_peer_tls_process_helper(sm, &data->ssl, data->eap_type, 0,
|
||||
id, pos, left, &resp);
|
||||
|
||||
if (res < 0) {
|
||||
return eap_tls_failure(sm, data, ret, res, resp, id);
|
||||
|
@ -174,7 +204,7 @@ static struct wpabuf * eap_tls_process(struct eap_sm *sm, void *priv,
|
|||
|
||||
if (res == 1) {
|
||||
wpabuf_free(resp);
|
||||
return eap_peer_tls_build_ack(id, EAP_TYPE_TLS, 0);
|
||||
return eap_peer_tls_build_ack(id, data->eap_type, 0);
|
||||
}
|
||||
|
||||
return resp;
|
||||
|
@ -285,3 +315,34 @@ int eap_peer_tls_register(void)
|
|||
eap_peer_method_free(eap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef EAP_UNAUTH_TLS
|
||||
int eap_peer_unauth_tls_register(void)
|
||||
{
|
||||
struct eap_method *eap;
|
||||
int ret;
|
||||
|
||||
eap = eap_peer_method_alloc(EAP_PEER_METHOD_INTERFACE_VERSION,
|
||||
EAP_VENDOR_UNAUTH_TLS,
|
||||
EAP_VENDOR_TYPE_UNAUTH_TLS, "UNAUTH-TLS");
|
||||
if (eap == NULL)
|
||||
return -1;
|
||||
|
||||
eap->init = eap_unauth_tls_init;
|
||||
eap->deinit = eap_tls_deinit;
|
||||
eap->process = eap_tls_process;
|
||||
eap->isKeyAvailable = eap_tls_isKeyAvailable;
|
||||
eap->getKey = eap_tls_getKey;
|
||||
eap->get_status = eap_tls_get_status;
|
||||
eap->has_reauth_data = eap_tls_has_reauth_data;
|
||||
eap->deinit_for_reauth = eap_tls_deinit_for_reauth;
|
||||
eap->init_for_reauth = eap_tls_init_for_reauth;
|
||||
eap->get_emsk = eap_tls_get_emsk;
|
||||
|
||||
ret = eap_peer_method_register(eap);
|
||||
if (ret)
|
||||
eap_peer_method_free(eap);
|
||||
return ret;
|
||||
}
|
||||
#endif /* EAP_UNAUTH_TLS */
|
||||
|
|
|
@ -16,6 +16,18 @@
|
|||
#include "eap_config.h"
|
||||
|
||||
|
||||
static struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len,
|
||||
u8 code, u8 identifier)
|
||||
{
|
||||
if (type == EAP_UNAUTH_TLS_TYPE)
|
||||
return eap_msg_alloc(EAP_VENDOR_UNAUTH_TLS,
|
||||
EAP_VENDOR_TYPE_UNAUTH_TLS, payload_len,
|
||||
code, identifier);
|
||||
return eap_msg_alloc(EAP_VENDOR_IETF, type, payload_len, code,
|
||||
identifier);
|
||||
}
|
||||
|
||||
|
||||
static int eap_tls_check_blob(struct eap_sm *sm, const char **name,
|
||||
const u8 **data, size_t *data_len)
|
||||
{
|
||||
|
@ -538,9 +550,8 @@ static int eap_tls_process_output(struct eap_ssl_data *data, EapType eap_type,
|
|||
length_included = 1;
|
||||
}
|
||||
|
||||
*out_data = eap_msg_alloc(EAP_VENDOR_IETF, eap_type,
|
||||
1 + length_included * 4 + len,
|
||||
EAP_CODE_RESPONSE, id);
|
||||
*out_data = eap_tls_msg_alloc(eap_type, 1 + length_included * 4 + len,
|
||||
EAP_CODE_RESPONSE, id);
|
||||
if (*out_data == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -678,8 +689,7 @@ struct wpabuf * eap_peer_tls_build_ack(u8 id, EapType eap_type,
|
|||
{
|
||||
struct wpabuf *resp;
|
||||
|
||||
resp = eap_msg_alloc(EAP_VENDOR_IETF, eap_type, 1, EAP_CODE_RESPONSE,
|
||||
id);
|
||||
resp = eap_tls_msg_alloc(eap_type, 1, EAP_CODE_RESPONSE, id);
|
||||
if (resp == NULL)
|
||||
return NULL;
|
||||
wpa_printf(MSG_DEBUG, "SSL: Building ACK (type=%d id=%d ver=%d)",
|
||||
|
@ -772,7 +782,13 @@ const u8 * eap_peer_tls_process_init(struct eap_sm *sm,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
pos = eap_hdr_validate(EAP_VENDOR_IETF, eap_type, reqData, &left);
|
||||
if (eap_type == EAP_UNAUTH_TLS_TYPE)
|
||||
pos = eap_hdr_validate(EAP_VENDOR_UNAUTH_TLS,
|
||||
EAP_VENDOR_TYPE_UNAUTH_TLS, reqData,
|
||||
&left);
|
||||
else
|
||||
pos = eap_hdr_validate(EAP_VENDOR_IETF, eap_type, reqData,
|
||||
&left);
|
||||
if (pos == NULL) {
|
||||
ret->ignore = TRUE;
|
||||
return NULL;
|
||||
|
|
|
@ -85,6 +85,9 @@ struct eap_ssl_data {
|
|||
/* could be up to 128 bytes, but only the first 64 bytes are used */
|
||||
#define EAP_TLS_KEY_LEN 64
|
||||
|
||||
/* dummy type used as a flag for UNAUTH-TLS */
|
||||
#define EAP_UNAUTH_TLS_TYPE 255
|
||||
|
||||
|
||||
int eap_peer_tls_ssl_init(struct eap_sm *sm, struct eap_ssl_data *data,
|
||||
struct eap_peer_config *config, u8 eap_type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue