HS 2.0R2: Add WFA server-only EAP-TLS server method

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-07-23 21:22:38 +03:00 committed by Jouni Malinen
parent 8d2a9921af
commit b61e70c4f3
5 changed files with 74 additions and 0 deletions

View file

@ -44,6 +44,13 @@ int eap_server_register_methods(void)
ret = eap_server_unauth_tls_register(); ret = eap_server_unauth_tls_register();
#endif /* EAP_SERVER_TLS */ #endif /* EAP_SERVER_TLS */
#ifdef EAP_SERVER_TLS
#ifdef CONFIG_HS20
if (ret == 0)
ret = eap_server_wfa_unauth_tls_register();
#endif /* CONFIG_HS20 */
#endif /* EAP_SERVER_TLS */
#ifdef EAP_SERVER_MSCHAPV2 #ifdef EAP_SERVER_MSCHAPV2
if (ret == 0) if (ret == 0)
ret = eap_server_mschapv2_register(); ret = eap_server_mschapv2_register();

View file

@ -27,6 +27,7 @@ int eap_server_identity_register(void);
int eap_server_md5_register(void); int eap_server_md5_register(void);
int eap_server_tls_register(void); int eap_server_tls_register(void);
int eap_server_unauth_tls_register(void); int eap_server_unauth_tls_register(void);
int eap_server_wfa_unauth_tls_register(void);
int eap_server_mschapv2_register(void); int eap_server_mschapv2_register(void);
int eap_server_peap_register(void); int eap_server_peap_register(void);
int eap_server_tlv_register(void); int eap_server_tlv_register(void);

View file

@ -94,6 +94,28 @@ static void * eap_unauth_tls_init(struct eap_sm *sm)
#endif /* EAP_SERVER_UNAUTH_TLS */ #endif /* EAP_SERVER_UNAUTH_TLS */
#ifdef CONFIG_HS20
static void * eap_wfa_unauth_tls_init(struct eap_sm *sm)
{
struct eap_tls_data *data;
data = os_zalloc(sizeof(*data));
if (data == NULL)
return NULL;
data->state = START;
if (eap_server_tls_ssl_init(sm, &data->ssl, 0)) {
wpa_printf(MSG_INFO, "EAP-TLS: Failed to initialize SSL.");
eap_tls_reset(sm, data);
return NULL;
}
data->eap_type = EAP_WFA_UNAUTH_TLS_TYPE;
return data;
}
#endif /* CONFIG_HS20 */
static void eap_tls_reset(struct eap_sm *sm, void *priv) static void eap_tls_reset(struct eap_sm *sm, void *priv)
{ {
struct eap_tls_data *data = priv; struct eap_tls_data *data = priv;
@ -178,6 +200,10 @@ static Boolean eap_tls_check(struct eap_sm *sm, void *priv,
pos = eap_hdr_validate(EAP_VENDOR_UNAUTH_TLS, pos = eap_hdr_validate(EAP_VENDOR_UNAUTH_TLS,
EAP_VENDOR_TYPE_UNAUTH_TLS, respData, EAP_VENDOR_TYPE_UNAUTH_TLS, respData,
&len); &len);
else if (data->eap_type == EAP_WFA_UNAUTH_TLS_TYPE)
pos = eap_hdr_validate(EAP_VENDOR_WFA_NEW,
EAP_VENDOR_WFA_UNAUTH_TLS, respData,
&len);
else else
pos = eap_hdr_validate(EAP_VENDOR_IETF, data->eap_type, pos = eap_hdr_validate(EAP_VENDOR_IETF, data->eap_type,
respData, &len); respData, &len);
@ -340,3 +366,34 @@ int eap_server_unauth_tls_register(void)
return ret; return ret;
} }
#endif /* EAP_SERVER_UNAUTH_TLS */ #endif /* EAP_SERVER_UNAUTH_TLS */
#ifdef CONFIG_HS20
int eap_server_wfa_unauth_tls_register(void)
{
struct eap_method *eap;
int ret;
eap = eap_server_method_alloc(EAP_SERVER_METHOD_INTERFACE_VERSION,
EAP_VENDOR_WFA_NEW,
EAP_VENDOR_WFA_UNAUTH_TLS,
"WFA-UNAUTH-TLS");
if (eap == NULL)
return -1;
eap->init = eap_wfa_unauth_tls_init;
eap->reset = eap_tls_reset;
eap->buildReq = eap_tls_buildReq;
eap->check = eap_tls_check;
eap->process = eap_tls_process;
eap->isDone = eap_tls_isDone;
eap->getKey = eap_tls_getKey;
eap->isSuccess = eap_tls_isSuccess;
eap->get_emsk = eap_tls_get_emsk;
ret = eap_server_method_register(eap);
if (ret)
eap_server_method_free(eap);
return ret;
}
#endif /* CONFIG_HS20 */

View file

@ -25,6 +25,10 @@ struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len,
return eap_msg_alloc(EAP_VENDOR_UNAUTH_TLS, return eap_msg_alloc(EAP_VENDOR_UNAUTH_TLS,
EAP_VENDOR_TYPE_UNAUTH_TLS, payload_len, EAP_VENDOR_TYPE_UNAUTH_TLS, payload_len,
code, identifier); code, identifier);
else if (type == EAP_WFA_UNAUTH_TLS_TYPE)
return eap_msg_alloc(EAP_VENDOR_WFA_NEW,
EAP_VENDOR_WFA_UNAUTH_TLS, payload_len,
code, identifier);
return eap_msg_alloc(EAP_VENDOR_IETF, type, payload_len, code, return eap_msg_alloc(EAP_VENDOR_IETF, type, payload_len, code,
identifier); identifier);
} }
@ -393,6 +397,10 @@ int eap_server_tls_process(struct eap_sm *sm, struct eap_ssl_data *data,
pos = eap_hdr_validate(EAP_VENDOR_UNAUTH_TLS, pos = eap_hdr_validate(EAP_VENDOR_UNAUTH_TLS,
EAP_VENDOR_TYPE_UNAUTH_TLS, respData, EAP_VENDOR_TYPE_UNAUTH_TLS, respData,
&left); &left);
else if (eap_type == EAP_WFA_UNAUTH_TLS_TYPE)
pos = eap_hdr_validate(EAP_VENDOR_WFA_NEW,
EAP_VENDOR_WFA_UNAUTH_TLS, respData,
&left);
else else
pos = eap_hdr_validate(EAP_VENDOR_IETF, eap_type, respData, pos = eap_hdr_validate(EAP_VENDOR_IETF, eap_type, respData,
&left); &left);

View file

@ -64,6 +64,7 @@ struct eap_ssl_data {
/* dummy type used as a flag for UNAUTH-TLS */ /* dummy type used as a flag for UNAUTH-TLS */
#define EAP_UNAUTH_TLS_TYPE 255 #define EAP_UNAUTH_TLS_TYPE 255
#define EAP_WFA_UNAUTH_TLS_TYPE 254
struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len, struct wpabuf * eap_tls_msg_alloc(EapType type, size_t payload_len,