2 * EAP-FAST server (RFC 4851)
3 * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
21 #include "eap_tls_common.h"
23 #include "eap_common/eap_tlv_common.h"
24 #include "eap_common/eap_fast_common.h"
27 static void eap_fast_reset(struct eap_sm *sm, void *priv);
30 /* Private PAC-Opaque TLV types */
31 #define PAC_OPAQUE_TYPE_PAD 0
32 #define PAC_OPAQUE_TYPE_KEY 1
33 #define PAC_OPAQUE_TYPE_LIFETIME 2
34 #define PAC_OPAQUE_TYPE_IDENTITY 3
36 /* PAC-Key lifetime in seconds (hard limit) */
37 #define PAC_KEY_LIFETIME (7 * 24 * 60 * 60)
40 * PAC-Key refresh time in seconds (soft limit on remaining hard limit). The
41 * server will generate a new PAC-Key when this number of seconds (or fewer)
44 #define PAC_KEY_REFRESH_TIME (1 * 24 * 60 * 60)
47 struct eap_fast_data {
48 struct eap_ssl_data ssl;
50 START, PHASE1, PHASE2_START, PHASE2_ID, PHASE2_METHOD,
51 CRYPTO_BINDING, REQUEST_PAC, SUCCESS, FAILURE
55 const struct eap_method *phase2_method;
60 u8 crypto_binding_nonce[32];
63 struct eap_fast_key_block_provisioning *key_block_p;
65 u8 simck[EAP_FAST_SIMCK_LEN];
66 u8 cmk[EAP_FAST_CMK_LEN];
69 u8 pac_opaque_encr[16];
72 int anon_provisioning;
73 int send_new_pac; /* server triggered re-keying of Tunnel PAC */
74 struct wpabuf *pending_phase2_resp;
75 u8 *identity; /* from PAC-Opaque */
82 static const char * eap_fast_state_txt(int state)
90 return "PHASE2_START";
94 return "PHASE2_METHOD";
96 return "CRYPTO_BINDING";
109 static void eap_fast_state(struct eap_fast_data *data, int state)
111 wpa_printf(MSG_DEBUG, "EAP-FAST: %s -> %s",
112 eap_fast_state_txt(data->state),
113 eap_fast_state_txt(state));
118 static EapType eap_fast_req_failure(struct eap_sm *sm,
119 struct eap_fast_data *data)
121 /* TODO: send Result TLV(FAILURE) */
122 eap_fast_state(data, FAILURE);
123 return EAP_TYPE_NONE;
127 static int eap_fast_session_ticket_cb(void *ctx, const u8 *ticket, size_t len,
128 const u8 *client_random,
129 const u8 *server_random,
132 struct eap_fast_data *data = ctx;
133 const u8 *pac_opaque;
134 size_t pac_opaque_len;
135 u8 *buf, *pos, *end, *pac_key = NULL;
136 os_time_t lifetime = 0;
139 size_t identity_len = 0;
141 wpa_printf(MSG_DEBUG, "EAP-FAST: SessionTicket callback");
142 wpa_hexdump(MSG_DEBUG, "EAP-FAST: SessionTicket (PAC-Opaque)",
145 if (len < 4 || WPA_GET_BE16(ticket) != PAC_TYPE_PAC_OPAQUE) {
146 wpa_printf(MSG_DEBUG, "EAP-FAST: Ignore invalid "
151 pac_opaque_len = WPA_GET_BE16(ticket + 2);
152 pac_opaque = ticket + 4;
153 if (pac_opaque_len < 8 || pac_opaque_len % 8 ||
154 pac_opaque_len > len - 4) {
155 wpa_printf(MSG_DEBUG, "EAP-FAST: Ignore invalid PAC-Opaque "
156 "(len=%lu left=%lu)",
157 (unsigned long) pac_opaque_len,
158 (unsigned long) len);
161 wpa_hexdump(MSG_DEBUG, "EAP-FAST: Received PAC-Opaque",
162 pac_opaque, pac_opaque_len);
164 buf = os_malloc(pac_opaque_len - 8);
166 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to allocate memory "
167 "for decrypting PAC-Opaque");
171 if (aes_unwrap(data->pac_opaque_encr, (pac_opaque_len - 8) / 8,
172 pac_opaque, buf) < 0) {
173 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to decrypt "
177 * This may have been caused by server changing the PAC-Opaque
178 * encryption key, so just ignore this PAC-Opaque instead of
179 * failing the authentication completely. Provisioning can now
180 * be used to provision a new PAC.
185 end = buf + pac_opaque_len - 8;
186 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: Decrypted PAC-Opaque",
190 while (pos + 1 < end) {
191 if (pos + 2 + pos[1] > end)
195 case PAC_OPAQUE_TYPE_PAD:
198 case PAC_OPAQUE_TYPE_KEY:
199 if (pos[1] != EAP_FAST_PAC_KEY_LEN) {
200 wpa_printf(MSG_DEBUG, "EAP-FAST: Invalid "
201 "PAC-Key length %d", pos[1]);
206 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: PAC-Key from "
207 "decrypted PAC-Opaque",
208 pac_key, EAP_FAST_PAC_KEY_LEN);
210 case PAC_OPAQUE_TYPE_LIFETIME:
212 wpa_printf(MSG_DEBUG, "EAP-FAST: Invalid "
213 "PAC-Key lifetime length %d",
218 lifetime = WPA_GET_BE32(pos + 2);
220 case PAC_OPAQUE_TYPE_IDENTITY:
222 identity_len = pos[1];
229 if (pac_key == NULL) {
230 wpa_printf(MSG_DEBUG, "EAP-FAST: No PAC-Key included in "
237 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: Identity from "
238 "PAC-Opaque", identity, identity_len);
239 os_free(data->identity);
240 data->identity = os_malloc(identity_len);
241 if (data->identity) {
242 os_memcpy(data->identity, identity, identity_len);
243 data->identity_len = identity_len;
247 if (os_get_time(&now) < 0 || lifetime <= 0 || now.sec > lifetime) {
248 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Key not valid anymore "
249 "(lifetime=%ld now=%ld)", lifetime, now.sec);
254 if (lifetime - now.sec < PAC_KEY_REFRESH_TIME)
255 data->send_new_pac = 1;
257 eap_fast_derive_master_secret(pac_key, server_random, client_random,
266 static void eap_fast_derive_key_auth(struct eap_sm *sm,
267 struct eap_fast_data *data)
271 /* RFC 4851, Section 5.1:
272 * Extra key material after TLS key_block: session_key_seed[40]
275 sks = eap_fast_derive_key(sm->ssl_ctx, data->ssl.conn, "key expansion",
278 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to derive "
284 * RFC 4851, Section 5.2:
285 * S-IMCK[0] = session_key_seed
287 wpa_hexdump_key(MSG_DEBUG,
288 "EAP-FAST: session_key_seed (SKS = S-IMCK[0])",
289 sks, EAP_FAST_SKS_LEN);
291 os_memcpy(data->simck, sks, EAP_FAST_SIMCK_LEN);
296 static void eap_fast_derive_key_provisioning(struct eap_sm *sm,
297 struct eap_fast_data *data)
299 os_free(data->key_block_p);
300 data->key_block_p = (struct eap_fast_key_block_provisioning *)
301 eap_fast_derive_key(sm->ssl_ctx, data->ssl.conn,
303 sizeof(*data->key_block_p));
304 if (data->key_block_p == NULL) {
305 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to derive key block");
309 * RFC 4851, Section 5.2:
310 * S-IMCK[0] = session_key_seed
312 wpa_hexdump_key(MSG_DEBUG,
313 "EAP-FAST: session_key_seed (SKS = S-IMCK[0])",
314 data->key_block_p->session_key_seed,
315 sizeof(data->key_block_p->session_key_seed));
317 os_memcpy(data->simck, data->key_block_p->session_key_seed,
319 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: server_challenge",
320 data->key_block_p->server_challenge,
321 sizeof(data->key_block_p->server_challenge));
322 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: client_challenge",
323 data->key_block_p->client_challenge,
324 sizeof(data->key_block_p->client_challenge));
328 static int eap_fast_get_phase2_key(struct eap_sm *sm,
329 struct eap_fast_data *data,
330 u8 *isk, size_t isk_len)
335 os_memset(isk, 0, isk_len);
337 if (data->phase2_method == NULL || data->phase2_priv == NULL) {
338 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase 2 method not "
343 if (data->phase2_method->getKey == NULL)
346 if ((key = data->phase2_method->getKey(sm, data->phase2_priv,
347 &key_len)) == NULL) {
348 wpa_printf(MSG_DEBUG, "EAP-FAST: Could not get key material "
353 if (key_len > isk_len)
355 os_memcpy(isk, key, key_len);
362 static int eap_fast_update_icmk(struct eap_sm *sm, struct eap_fast_data *data)
364 u8 isk[32], imck[60];
366 wpa_printf(MSG_DEBUG, "EAP-FAST: Deriving ICMK[%d] (S-IMCK and CMK)",
367 data->simck_idx + 1);
370 * RFC 4851, Section 5.2:
371 * IMCK[j] = T-PRF(S-IMCK[j-1], "Inner Methods Compound Keys",
373 * S-IMCK[j] = first 40 octets of IMCK[j]
374 * CMK[j] = last 20 octets of IMCK[j]
377 if (eap_fast_get_phase2_key(sm, data, isk, sizeof(isk)) < 0)
379 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: ISK[j]", isk, sizeof(isk));
380 sha1_t_prf(data->simck, EAP_FAST_SIMCK_LEN,
381 "Inner Methods Compound Keys",
382 isk, sizeof(isk), imck, sizeof(imck));
384 os_memcpy(data->simck, imck, EAP_FAST_SIMCK_LEN);
385 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: S-IMCK[j]",
386 data->simck, EAP_FAST_SIMCK_LEN);
387 os_memcpy(data->cmk, imck + EAP_FAST_SIMCK_LEN, EAP_FAST_CMK_LEN);
388 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: CMK[j]",
389 data->cmk, EAP_FAST_CMK_LEN);
395 static void * eap_fast_init(struct eap_sm *sm)
397 struct eap_fast_data *data;
399 TLS_CIPHER_ANON_DH_AES128_SHA,
400 TLS_CIPHER_AES128_SHA,
401 TLS_CIPHER_RSA_DHE_AES128_SHA,
406 data = os_zalloc(sizeof(*data));
409 data->fast_version = EAP_FAST_VERSION;
410 data->force_version = -1;
411 if (sm->user && sm->user->force_version >= 0) {
412 data->force_version = sm->user->force_version;
413 wpa_printf(MSG_DEBUG, "EAP-FAST: forcing version %d",
414 data->force_version);
415 data->fast_version = data->force_version;
419 if (eap_server_tls_ssl_init(sm, &data->ssl, 0)) {
420 wpa_printf(MSG_INFO, "EAP-FAST: Failed to initialize SSL.");
421 eap_fast_reset(sm, data);
425 if (tls_connection_set_cipher_list(sm->ssl_ctx, data->ssl.conn,
427 wpa_printf(MSG_INFO, "EAP-FAST: Failed to set TLS cipher "
429 eap_fast_reset(sm, data);
433 if (tls_connection_set_session_ticket_cb(sm->ssl_ctx, data->ssl.conn,
434 eap_fast_session_ticket_cb,
436 wpa_printf(MSG_INFO, "EAP-FAST: Failed to set SessionTicket "
438 eap_fast_reset(sm, data);
442 if (sm->pac_opaque_encr_key == NULL) {
443 wpa_printf(MSG_INFO, "EAP-FAST: No PAC-Opaque encryption key "
445 eap_fast_reset(sm, data);
448 os_memcpy(data->pac_opaque_encr, sm->pac_opaque_encr_key,
449 sizeof(data->pac_opaque_encr));
451 if (sm->eap_fast_a_id == NULL) {
452 wpa_printf(MSG_INFO, "EAP-FAST: No A-ID configured");
453 eap_fast_reset(sm, data);
456 data->srv_id = os_strdup(sm->eap_fast_a_id);
457 if (data->srv_id == NULL) {
458 eap_fast_reset(sm, data);
466 static void eap_fast_reset(struct eap_sm *sm, void *priv)
468 struct eap_fast_data *data = priv;
471 if (data->phase2_priv && data->phase2_method)
472 data->phase2_method->reset(sm, data->phase2_priv);
473 eap_server_tls_ssl_deinit(sm, &data->ssl);
474 os_free(data->srv_id);
475 os_free(data->key_block_p);
476 wpabuf_free(data->pending_phase2_resp);
477 os_free(data->identity);
482 static struct wpabuf * eap_fast_build_start(struct eap_sm *sm,
483 struct eap_fast_data *data, u8 id)
486 size_t srv_id_len = os_strlen(data->srv_id);
488 req = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_FAST,
489 1 + sizeof(struct pac_tlv_hdr) + srv_id_len,
490 EAP_CODE_REQUEST, id);
492 wpa_printf(MSG_ERROR, "EAP-FAST: Failed to allocate memory for"
494 eap_fast_state(data, FAILURE);
498 wpabuf_put_u8(req, EAP_TLS_FLAGS_START | data->fast_version);
500 /* RFC 4851, 4.1.1. Authority ID Data */
501 eap_fast_put_tlv(req, PAC_TYPE_A_ID, data->srv_id, srv_id_len);
503 eap_fast_state(data, PHASE1);
509 static int eap_fast_phase1_done(struct eap_sm *sm, struct eap_fast_data *data)
513 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase1 done, starting Phase2");
515 if (tls_get_cipher(sm->ssl_ctx, data->ssl.conn, cipher, sizeof(cipher))
517 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to get cipher "
519 eap_fast_state(data, FAILURE);
522 data->anon_provisioning = os_strstr(cipher, "ADH") != NULL;
524 if (data->anon_provisioning) {
525 wpa_printf(MSG_DEBUG, "EAP-FAST: Anonymous provisioning");
526 eap_fast_derive_key_provisioning(sm, data);
528 eap_fast_derive_key_auth(sm, data);
530 eap_fast_state(data, PHASE2_START);
536 static struct wpabuf * eap_fast_build_req(struct eap_sm *sm,
537 struct eap_fast_data *data, u8 id)
542 res = eap_server_tls_buildReq_helper(sm, &data->ssl, EAP_TYPE_FAST,
543 data->fast_version, id, &req);
545 if (tls_connection_established(sm->ssl_ctx, data->ssl.conn)) {
546 if (eap_fast_phase1_done(sm, data) < 0) {
553 return eap_server_tls_build_ack(id, EAP_TYPE_FAST,
559 static struct wpabuf * eap_fast_encrypt(struct eap_sm *sm,
560 struct eap_fast_data *data,
561 u8 id, u8 *plain, size_t plain_len)
566 /* TODO: add support for fragmentation, if needed. This will need to
567 * add TLS Message Length field, if the frame is fragmented. */
568 buf = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_FAST,
569 1 + data->ssl.tls_out_limit,
570 EAP_CODE_REQUEST, id);
574 wpabuf_put_u8(buf, data->fast_version);
576 res = tls_connection_encrypt(sm->ssl_ctx, data->ssl.conn,
577 plain, plain_len, wpabuf_put(buf, 0),
578 data->ssl.tls_out_limit);
580 wpa_printf(MSG_INFO, "EAP-FAST: Failed to encrypt Phase 2 "
586 wpabuf_put(buf, res);
593 static struct wpabuf * eap_fast_build_phase2_req(struct eap_sm *sm,
594 struct eap_fast_data *data,
599 if (data->phase2_priv == NULL) {
600 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase 2 method not "
604 req = data->phase2_method->buildReq(sm, data->phase2_priv, id);
608 wpa_hexdump_buf_key(MSG_MSGDUMP, "EAP-FAST: Phase 2 EAP-Request", req);
609 return eap_fast_tlv_eap_payload(req);
613 static struct wpabuf * eap_fast_build_crypto_binding(
614 struct eap_sm *sm, struct eap_fast_data *data)
617 struct eap_tlv_result_tlv *result;
618 struct eap_tlv_crypto_binding_tlv *binding;
620 buf = wpabuf_alloc(2 * sizeof(*result) + sizeof(*binding));
624 if (data->send_new_pac || data->anon_provisioning ||
626 data->final_result = 0;
628 data->final_result = 1;
630 if (!data->final_result || data->eap_seq > 1) {
631 /* Intermediate-Result */
632 wpa_printf(MSG_DEBUG, "EAP-FAST: Add Intermediate-Result TLV "
634 result = wpabuf_put(buf, sizeof(*result));
635 result->tlv_type = host_to_be16(
636 EAP_TLV_TYPE_MANDATORY |
637 EAP_TLV_INTERMEDIATE_RESULT_TLV);
638 result->length = host_to_be16(2);
639 result->status = host_to_be16(EAP_TLV_RESULT_SUCCESS);
642 if (data->final_result) {
644 wpa_printf(MSG_DEBUG, "EAP-FAST: Add Result TLV "
646 result = wpabuf_put(buf, sizeof(*result));
647 result->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY |
649 result->length = host_to_be16(2);
650 result->status = host_to_be16(EAP_TLV_RESULT_SUCCESS);
653 /* Crypto-Binding TLV */
654 binding = wpabuf_put(buf, sizeof(*binding));
655 binding->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY |
656 EAP_TLV_CRYPTO_BINDING_TLV);
657 binding->length = host_to_be16(sizeof(*binding) -
658 sizeof(struct eap_tlv_hdr));
659 binding->version = EAP_FAST_VERSION;
660 binding->received_version = data->peer_version;
661 binding->subtype = EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST;
662 if (os_get_random(binding->nonce, sizeof(binding->nonce)) < 0) {
668 * RFC 4851, Section 4.2.8:
669 * The nonce in a request MUST have its least significant bit set to 0.
671 binding->nonce[sizeof(binding->nonce) - 1] &= ~0x01;
673 os_memcpy(data->crypto_binding_nonce, binding->nonce,
674 sizeof(binding->nonce));
677 * RFC 4851, Section 5.3:
679 * Compound-MAC = HMAC-SHA1( CMK, Crypto-Binding TLV )
682 hmac_sha1(data->cmk, EAP_FAST_CMK_LEN,
683 (u8 *) binding, sizeof(*binding),
684 binding->compound_mac);
686 wpa_printf(MSG_DEBUG, "EAP-FAST: Add Crypto-Binding TLV: Version %d "
687 "Received Version %d SubType %d",
688 binding->version, binding->received_version,
690 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: NONCE",
691 binding->nonce, sizeof(binding->nonce));
692 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Compound MAC",
693 binding->compound_mac, sizeof(binding->compound_mac));
699 static struct wpabuf * eap_fast_build_pac(struct eap_sm *sm,
700 struct eap_fast_data *data)
702 u8 pac_key[EAP_FAST_PAC_KEY_LEN];
703 u8 *pac_buf, *pac_opaque;
706 size_t buf_len, srv_id_len, pac_len;
707 struct eap_tlv_hdr *pac_tlv;
708 struct pac_tlv_hdr *pac_info;
709 struct eap_tlv_result_tlv *result;
712 if (os_get_random(pac_key, EAP_FAST_PAC_KEY_LEN) < 0 ||
713 os_get_time(&now) < 0)
715 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: Generated PAC-Key",
716 pac_key, EAP_FAST_PAC_KEY_LEN);
718 pac_len = (2 + EAP_FAST_PAC_KEY_LEN) + (2 + 4) +
719 (2 + sm->identity_len) + 8;
720 pac_buf = os_malloc(pac_len);
724 srv_id_len = os_strlen(data->srv_id);
727 *pos++ = PAC_OPAQUE_TYPE_KEY;
728 *pos++ = EAP_FAST_PAC_KEY_LEN;
729 os_memcpy(pos, pac_key, EAP_FAST_PAC_KEY_LEN);
730 pos += EAP_FAST_PAC_KEY_LEN;
732 *pos++ = PAC_OPAQUE_TYPE_LIFETIME;
734 WPA_PUT_BE32(pos, now.sec + PAC_KEY_LIFETIME);
738 *pos++ = PAC_OPAQUE_TYPE_IDENTITY;
739 *pos++ = sm->identity_len;
740 os_memcpy(pos, sm->identity, sm->identity_len);
741 pos += sm->identity_len;
744 pac_len = pos - pac_buf;
746 *pos++ = PAC_OPAQUE_TYPE_PAD;
750 pac_opaque = os_malloc(pac_len + 8);
751 if (pac_opaque == NULL) {
755 if (aes_wrap(data->pac_opaque_encr, pac_len / 8, pac_buf,
764 wpa_hexdump(MSG_DEBUG, "EAP-FAST: PAC-Opaque",
765 pac_opaque, pac_len);
767 buf_len = sizeof(*pac_tlv) +
768 sizeof(struct pac_tlv_hdr) + EAP_FAST_PAC_KEY_LEN +
769 sizeof(struct pac_tlv_hdr) + pac_len +
770 2 * srv_id_len + 100 + sizeof(*result);
771 buf = wpabuf_alloc(buf_len);
778 wpa_printf(MSG_DEBUG, "EAP-FAST: Add PAC TLV");
779 pac_tlv = wpabuf_put(buf, sizeof(*pac_tlv));
780 pac_tlv->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY |
784 eap_fast_put_tlv(buf, PAC_TYPE_PAC_KEY, pac_key, EAP_FAST_PAC_KEY_LEN);
787 eap_fast_put_tlv(buf, PAC_TYPE_PAC_OPAQUE, pac_opaque, pac_len);
791 pac_info = wpabuf_put(buf, sizeof(*pac_info));
792 pac_info->type = host_to_be16(PAC_TYPE_PAC_INFO);
794 /* PAC-Lifetime (inside PAC-Info) */
795 eap_fast_put_tlv_hdr(buf, PAC_TYPE_CRED_LIFETIME, 4);
796 wpabuf_put_be32(buf, now.sec + PAC_KEY_LIFETIME);
798 /* A-ID (inside PAC-Info) */
799 eap_fast_put_tlv(buf, PAC_TYPE_A_ID, data->srv_id, srv_id_len);
801 /* Note: headers may be misaligned after A-ID */
803 /* A-ID-Info (inside PAC-Info) */
804 eap_fast_put_tlv(buf, PAC_TYPE_A_ID_INFO, data->srv_id, srv_id_len);
806 /* PAC-Type (inside PAC-Info) */
807 eap_fast_put_tlv_hdr(buf, PAC_TYPE_PAC_TYPE, 2);
808 wpabuf_put_be16(buf, PAC_TYPE_TUNNEL_PAC);
810 /* Update PAC-Info and PAC TLV Length fields */
811 pos = wpabuf_put(buf, 0);
812 pac_info->len = host_to_be16(pos - (u8 *) (pac_info + 1));
813 pac_tlv->length = host_to_be16(pos - (u8 *) (pac_tlv + 1));
816 wpa_printf(MSG_DEBUG, "EAP-FAST: Add Result TLV (status=SUCCESS)");
817 result = wpabuf_put(buf, sizeof(*result));
818 WPA_PUT_BE16((u8 *) &result->tlv_type,
819 EAP_TLV_TYPE_MANDATORY | EAP_TLV_RESULT_TLV);
820 WPA_PUT_BE16((u8 *) &result->length, 2);
821 WPA_PUT_BE16((u8 *) &result->status, EAP_TLV_RESULT_SUCCESS);
827 static struct wpabuf * eap_fast_buildReq(struct eap_sm *sm, void *priv, u8 id)
829 struct eap_fast_data *data = priv;
833 if (data->state == START)
834 return eap_fast_build_start(sm, data, id);
836 if (data->state == PHASE1)
837 return eap_fast_build_req(sm, data, id);
839 switch (data->state) {
842 req = eap_fast_build_phase2_req(sm, data, id);
845 req = eap_fast_build_crypto_binding(sm, data);
846 if (data->phase2_method) {
848 * Include the start of the next EAP method in the
849 * sequence in the same message with Crypto-Binding to
853 eap = eap_fast_build_phase2_req(sm, data, id);
854 req = wpabuf_concat(req, eap);
855 eap_fast_state(data, PHASE2_METHOD);
859 req = eap_fast_build_pac(sm, data);
862 wpa_printf(MSG_DEBUG, "EAP-FAST: %s - unexpected state %d",
863 __func__, data->state);
870 wpa_hexdump_buf_key(MSG_DEBUG, "EAP-FAST: Encrypting Phase 2 TLVs",
872 encr = eap_fast_encrypt(sm, data, id, wpabuf_mhead(req),
880 static Boolean eap_fast_check(struct eap_sm *sm, void *priv,
881 struct wpabuf *respData)
886 pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_FAST, respData, &len);
887 if (pos == NULL || len < 1) {
888 wpa_printf(MSG_INFO, "EAP-FAST: Invalid frame");
896 static int eap_fast_phase2_init(struct eap_sm *sm, struct eap_fast_data *data,
899 if (data->phase2_priv && data->phase2_method) {
900 data->phase2_method->reset(sm, data->phase2_priv);
901 data->phase2_method = NULL;
902 data->phase2_priv = NULL;
904 data->phase2_method = eap_server_get_eap_method(EAP_VENDOR_IETF,
906 if (!data->phase2_method)
909 if (data->key_block_p) {
910 sm->auth_challenge = data->key_block_p->server_challenge;
911 sm->peer_challenge = data->key_block_p->client_challenge;
914 data->phase2_priv = data->phase2_method->init(sm);
916 sm->auth_challenge = NULL;
917 sm->peer_challenge = NULL;
919 return data->phase2_priv == NULL ? -1 : 0;
923 static void eap_fast_process_phase2_response(struct eap_sm *sm,
924 struct eap_fast_data *data,
925 u8 *in_data, size_t in_len)
927 u8 next_type = EAP_TYPE_NONE;
932 const struct eap_method *m = data->phase2_method;
933 void *priv = data->phase2_priv;
936 wpa_printf(MSG_DEBUG, "EAP-FAST: %s - Phase2 not "
937 "initialized?!", __func__);
941 hdr = (struct eap_hdr *) in_data;
942 pos = (u8 *) (hdr + 1);
944 if (in_len > sizeof(*hdr) && *pos == EAP_TYPE_NAK) {
945 left = in_len - sizeof(*hdr);
946 wpa_hexdump(MSG_DEBUG, "EAP-FAST: Phase2 type Nak'ed; "
947 "allowed types", pos + 1, left - 1);
949 if (m && m->vendor == EAP_VENDOR_IETF &&
950 m->method == EAP_TYPE_TNC) {
951 wpa_printf(MSG_DEBUG, "EAP-FAST: Peer Nak'ed required "
953 next_type = eap_fast_req_failure(sm, data);
954 eap_fast_phase2_init(sm, data, next_type);
958 eap_sm_process_nak(sm, pos + 1, left - 1);
959 if (sm->user && sm->user_eap_method_index < EAP_MAX_METHODS &&
960 sm->user->methods[sm->user_eap_method_index].method !=
962 next_type = sm->user->methods[
963 sm->user_eap_method_index++].method;
964 wpa_printf(MSG_DEBUG, "EAP-FAST: try EAP type %d",
967 next_type = eap_fast_req_failure(sm, data);
969 eap_fast_phase2_init(sm, data, next_type);
973 wpabuf_set(&buf, in_data, in_len);
975 if (m->check(sm, priv, &buf)) {
976 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase2 check() asked to "
977 "ignore the packet");
978 next_type = eap_fast_req_failure(sm, data);
982 m->process(sm, priv, &buf);
984 if (!m->isDone(sm, priv))
987 if (!m->isSuccess(sm, priv)) {
988 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase2 method failed");
989 next_type = eap_fast_req_failure(sm, data);
990 eap_fast_phase2_init(sm, data, next_type);
994 switch (data->state) {
996 if (eap_user_get(sm, sm->identity, sm->identity_len, 1) != 0) {
997 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: Phase2 "
998 "Identity not found in the user "
1000 sm->identity, sm->identity_len);
1001 next_type = eap_fast_req_failure(sm, data);
1005 eap_fast_state(data, PHASE2_METHOD);
1006 if (data->anon_provisioning) {
1008 * Only EAP-MSCHAPv2 is allowed for anonymous
1011 next_type = EAP_TYPE_MSCHAPV2;
1012 sm->user_eap_method_index = 0;
1014 next_type = sm->user->methods[0].method;
1015 sm->user_eap_method_index = 1;
1017 wpa_printf(MSG_DEBUG, "EAP-FAST: try EAP type %d", next_type);
1020 case CRYPTO_BINDING:
1021 eap_fast_update_icmk(sm, data);
1022 eap_fast_state(data, CRYPTO_BINDING);
1024 next_type = EAP_TYPE_NONE;
1026 if (sm->tnc && !data->tnc_started) {
1027 wpa_printf(MSG_DEBUG, "EAP-FAST: Initialize TNC");
1028 next_type = EAP_TYPE_TNC;
1029 data->tnc_started = 1;
1031 #endif /* EAP_TNC */
1036 wpa_printf(MSG_DEBUG, "EAP-FAST: %s - unexpected state %d",
1037 __func__, data->state);
1041 eap_fast_phase2_init(sm, data, next_type);
1045 static void eap_fast_process_phase2_eap(struct eap_sm *sm,
1046 struct eap_fast_data *data,
1047 u8 *in_data, size_t in_len)
1049 struct eap_hdr *hdr;
1052 hdr = (struct eap_hdr *) in_data;
1053 if (in_len < (int) sizeof(*hdr)) {
1054 wpa_printf(MSG_INFO, "EAP-FAST: Too short Phase 2 "
1055 "EAP frame (len=%d)", in_len);
1056 eap_fast_req_failure(sm, data);
1059 len = be_to_host16(hdr->length);
1061 wpa_printf(MSG_INFO, "EAP-FAST: Length mismatch in "
1062 "Phase 2 EAP frame (len=%d hdr->length=%d)",
1064 eap_fast_req_failure(sm, data);
1067 wpa_printf(MSG_DEBUG, "EAP-FAST: Received Phase 2: code=%d "
1068 "identifier=%d length=%d", hdr->code, hdr->identifier, len);
1069 switch (hdr->code) {
1070 case EAP_CODE_RESPONSE:
1071 eap_fast_process_phase2_response(sm, data, (u8 *) hdr, len);
1074 wpa_printf(MSG_INFO, "EAP-FAST: Unexpected code=%d in "
1075 "Phase 2 EAP header", hdr->code);
1081 static int eap_fast_parse_tlvs(u8 *data, size_t data_len,
1082 struct eap_fast_tlv_parse *tlv)
1084 int mandatory, tlv_type, len, res;
1087 os_memset(tlv, 0, sizeof(*tlv));
1090 end = data + data_len;
1091 while (pos + 4 < end) {
1092 mandatory = pos[0] & 0x80;
1093 tlv_type = WPA_GET_BE16(pos) & 0x3fff;
1095 len = WPA_GET_BE16(pos);
1097 if (pos + len > end) {
1098 wpa_printf(MSG_INFO, "EAP-FAST: TLV overflow");
1101 wpa_printf(MSG_DEBUG, "EAP-FAST: Received Phase 2: "
1102 "TLV type %d length %d%s",
1103 tlv_type, len, mandatory ? " (mandatory)" : "");
1105 res = eap_fast_parse_tlv(tlv, tlv_type, pos, len);
1110 wpa_printf(MSG_DEBUG, "EAP-FAST: Nak unknown "
1111 "mandatory TLV type %d", tlv_type);
1112 /* TODO: generate Nak TLV */
1115 wpa_printf(MSG_DEBUG, "EAP-FAST: Ignored "
1116 "unknown optional TLV type %d",
1128 static int eap_fast_validate_crypto_binding(
1129 struct eap_fast_data *data, struct eap_tlv_crypto_binding_tlv *b,
1132 u8 cmac[SHA1_MAC_LEN];
1134 wpa_printf(MSG_DEBUG, "EAP-FAST: Reply Crypto-Binding TLV: "
1135 "Version %d Received Version %d SubType %d",
1136 b->version, b->received_version, b->subtype);
1137 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: NONCE",
1138 b->nonce, sizeof(b->nonce));
1139 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Compound MAC",
1140 b->compound_mac, sizeof(b->compound_mac));
1142 if (b->version != EAP_FAST_VERSION ||
1143 b->received_version != EAP_FAST_VERSION) {
1144 wpa_printf(MSG_DEBUG, "EAP-FAST: Unexpected version "
1145 "in Crypto-Binding: version %d "
1146 "received_version %d", b->version,
1147 b->received_version);
1151 if (b->subtype != EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE) {
1152 wpa_printf(MSG_DEBUG, "EAP-FAST: Unexpected subtype in "
1153 "Crypto-Binding: %d", b->subtype);
1157 if (os_memcmp(data->crypto_binding_nonce, b->nonce, 31) != 0 ||
1158 (data->crypto_binding_nonce[31] | 1) != b->nonce[31]) {
1159 wpa_printf(MSG_DEBUG, "EAP-FAST: Invalid nonce in "
1164 os_memcpy(cmac, b->compound_mac, sizeof(cmac));
1165 os_memset(b->compound_mac, 0, sizeof(cmac));
1166 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Crypto-Binding TLV for "
1167 "Compound MAC calculation",
1168 (u8 *) b, bind_len);
1169 hmac_sha1(data->cmk, EAP_FAST_CMK_LEN, (u8 *) b, bind_len,
1171 if (os_memcmp(cmac, b->compound_mac, sizeof(cmac)) != 0) {
1172 wpa_hexdump(MSG_MSGDUMP,
1173 "EAP-FAST: Calculated Compound MAC",
1174 b->compound_mac, sizeof(cmac));
1175 wpa_printf(MSG_INFO, "EAP-FAST: Compound MAC did not "
1184 static int eap_fast_pac_type(u8 *pac, size_t len, u16 type)
1186 struct eap_tlv_pac_type_tlv *tlv;
1188 if (pac == NULL || len != sizeof(*tlv))
1191 tlv = (struct eap_tlv_pac_type_tlv *) pac;
1193 return be_to_host16(tlv->tlv_type) == PAC_TYPE_PAC_TYPE &&
1194 be_to_host16(tlv->length) == 2 &&
1195 be_to_host16(tlv->pac_type) == type;
1199 static void eap_fast_process_phase2_tlvs(struct eap_sm *sm,
1200 struct eap_fast_data *data,
1201 u8 *in_data, size_t in_len)
1203 struct eap_fast_tlv_parse tlv;
1204 int check_crypto_binding = data->state == CRYPTO_BINDING;
1206 if (eap_fast_parse_tlvs(in_data, in_len, &tlv) < 0) {
1207 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to parse received "
1212 if (tlv.result == EAP_TLV_RESULT_FAILURE) {
1213 wpa_printf(MSG_DEBUG, "EAP-FAST: Result TLV indicated "
1215 eap_fast_state(data, FAILURE);
1219 if (data->state == REQUEST_PAC) {
1221 if (tlv.pac == NULL || tlv.pac_len < 6) {
1222 wpa_printf(MSG_DEBUG, "EAP-FAST: No PAC "
1223 "Acknowledgement received");
1224 eap_fast_state(data, FAILURE);
1228 type = WPA_GET_BE16(tlv.pac);
1229 len = WPA_GET_BE16(tlv.pac + 2);
1230 res = WPA_GET_BE16(tlv.pac + 4);
1232 if (type != PAC_TYPE_PAC_ACKNOWLEDGEMENT || len != 2 ||
1233 res != EAP_TLV_RESULT_SUCCESS) {
1234 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC TLV did not "
1235 "contain acknowledgement");
1236 eap_fast_state(data, FAILURE);
1240 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Acknowledgement received "
1241 "- PAC provisioning succeeded");
1242 eap_fast_state(data, data->anon_provisioning ?
1247 if (check_crypto_binding) {
1248 if (tlv.crypto_binding == NULL) {
1249 wpa_printf(MSG_DEBUG, "EAP-FAST: No Crypto-Binding "
1251 eap_fast_state(data, FAILURE);
1255 if (data->final_result &&
1256 tlv.result != EAP_TLV_RESULT_SUCCESS) {
1257 wpa_printf(MSG_DEBUG, "EAP-FAST: Crypto-Binding TLV "
1258 "without Success Result");
1259 eap_fast_state(data, FAILURE);
1263 if (!data->final_result &&
1264 tlv.iresult != EAP_TLV_RESULT_SUCCESS) {
1265 wpa_printf(MSG_DEBUG, "EAP-FAST: Crypto-Binding TLV "
1266 "without intermediate Success Result");
1267 eap_fast_state(data, FAILURE);
1271 if (eap_fast_validate_crypto_binding(data, tlv.crypto_binding,
1272 tlv.crypto_binding_len)) {
1273 eap_fast_state(data, FAILURE);
1277 wpa_printf(MSG_DEBUG, "EAP-FAST: Valid Crypto-Binding TLV "
1279 if (data->final_result) {
1280 wpa_printf(MSG_DEBUG, "EAP-FAST: Authentication "
1281 "completed successfully");
1284 if (data->anon_provisioning ||
1285 (tlv.request_action == EAP_TLV_ACTION_PROCESS_TLV &&
1286 eap_fast_pac_type(tlv.pac, tlv.pac_len,
1287 PAC_TYPE_TUNNEL_PAC))) {
1288 wpa_printf(MSG_DEBUG, "EAP-FAST: Requested a new "
1290 eap_fast_state(data, REQUEST_PAC);
1291 } else if (data->send_new_pac) {
1292 wpa_printf(MSG_DEBUG, "EAP-FAST: Server triggered "
1293 "re-keying of Tunnel PAC");
1294 eap_fast_state(data, REQUEST_PAC);
1295 } else if (data->final_result)
1296 eap_fast_state(data, SUCCESS);
1299 if (tlv.eap_payload_tlv) {
1300 eap_fast_process_phase2_eap(sm, data, tlv.eap_payload_tlv,
1301 tlv.eap_payload_tlv_len);
1306 static void eap_fast_process_phase2(struct eap_sm *sm,
1307 struct eap_fast_data *data,
1308 const u8 *in_data, size_t in_len)
1311 int len_decrypted, res;
1314 wpa_printf(MSG_DEBUG, "EAP-FAST: Received %lu bytes encrypted data for"
1315 " Phase 2", (unsigned long) in_len);
1317 if (data->pending_phase2_resp) {
1318 wpa_printf(MSG_DEBUG, "EAP-PEAP: Pending Phase 2 response - "
1319 "skip decryption and use old data");
1320 eap_fast_process_phase2_tlvs(
1321 sm, data, wpabuf_mhead(data->pending_phase2_resp),
1322 wpabuf_len(data->pending_phase2_resp));
1323 wpabuf_free(data->pending_phase2_resp);
1324 data->pending_phase2_resp = NULL;
1328 /* FIX: get rid of const -> non-const typecast */
1329 res = eap_server_tls_data_reassemble(sm, &data->ssl, (u8 **) &in_data,
1331 if (res < 0 || res == 1)
1335 if (data->ssl.tls_in_total > buf_len)
1336 buf_len = data->ssl.tls_in_total;
1337 in_decrypted = os_malloc(buf_len);
1338 if (in_decrypted == NULL) {
1339 os_free(data->ssl.tls_in);
1340 data->ssl.tls_in = NULL;
1341 data->ssl.tls_in_len = 0;
1342 wpa_printf(MSG_WARNING, "EAP-FAST: Failed to allocate memory "
1347 len_decrypted = tls_connection_decrypt(sm->ssl_ctx, data->ssl.conn,
1349 in_decrypted, buf_len);
1350 os_free(data->ssl.tls_in);
1351 data->ssl.tls_in = NULL;
1352 data->ssl.tls_in_len = 0;
1353 if (len_decrypted < 0) {
1354 wpa_printf(MSG_INFO, "EAP-FAST: Failed to decrypt Phase 2 "
1356 os_free(in_decrypted);
1357 eap_fast_state(data, FAILURE);
1361 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: Decrypted Phase 2 TLVs",
1362 in_decrypted, len_decrypted);
1364 eap_fast_process_phase2_tlvs(sm, data, in_decrypted, len_decrypted);
1366 if (sm->method_pending == METHOD_PENDING_WAIT) {
1367 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase2 method is in "
1368 "pending wait state - save decrypted response");
1369 wpabuf_free(data->pending_phase2_resp);
1370 data->pending_phase2_resp = wpabuf_alloc_copy(in_decrypted,
1374 os_free(in_decrypted);
1378 static int eap_fast_process_version(struct eap_fast_data *data,
1381 data->peer_version = peer_version;
1383 if (data->force_version >= 0 && peer_version != data->force_version) {
1384 wpa_printf(MSG_INFO, "EAP-FAST: peer did not select the forced"
1385 " version (forced=%d peer=%d) - reject",
1386 data->force_version, peer_version);
1387 eap_fast_state(data, FAILURE);
1391 if (peer_version < data->fast_version) {
1392 wpa_printf(MSG_DEBUG, "EAP-FAST: peer ver=%d, own ver=%d; "
1394 peer_version, data->fast_version, peer_version);
1395 data->fast_version = peer_version;
1402 static int eap_fast_process_length(struct eap_fast_data *data,
1403 const u8 **pos, size_t *left)
1408 wpa_printf(MSG_INFO, "EAP-FAST: Short frame with TLS "
1410 eap_fast_state(data, FAILURE);
1414 tls_msg_len = WPA_GET_BE32(*pos);
1415 wpa_printf(MSG_DEBUG, "EAP-FAST: TLS Message Length: %d",
1418 if (data->ssl.tls_in_left == 0) {
1419 data->ssl.tls_in_total = tls_msg_len;
1420 data->ssl.tls_in_left = tls_msg_len;
1421 os_free(data->ssl.tls_in);
1422 data->ssl.tls_in = NULL;
1423 data->ssl.tls_in_len = 0;
1433 static int eap_fast_process_phase1(struct eap_sm *sm,
1434 struct eap_fast_data *data,
1435 const u8 *pos, size_t left)
1437 if (eap_server_tls_process_helper(sm, &data->ssl, pos, left) < 0) {
1438 wpa_printf(MSG_INFO, "EAP-FAST: TLS processing failed");
1439 eap_fast_state(data, FAILURE);
1443 if (!tls_connection_established(sm->ssl_ctx, data->ssl.conn) ||
1444 data->ssl.tls_out_len > 0)
1448 * Phase 1 was completed with the received message (e.g., when using
1449 * abbreviated handshake), so Phase 2 can be started immediately
1450 * without having to send through an empty message to the peer.
1453 return eap_fast_phase1_done(sm, data);
1457 static void eap_fast_process_phase2_start(struct eap_sm *sm,
1458 struct eap_fast_data *data)
1462 if (data->identity) {
1463 os_free(sm->identity);
1464 sm->identity = data->identity;
1465 data->identity = NULL;
1466 sm->identity_len = data->identity_len;
1467 data->identity_len = 0;
1468 sm->require_identity_match = 1;
1469 if (eap_user_get(sm, sm->identity, sm->identity_len, 1) != 0) {
1470 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: "
1471 "Phase2 Identity not found "
1472 "in the user database",
1473 sm->identity, sm->identity_len);
1474 next_type = eap_fast_req_failure(sm, data);
1476 wpa_printf(MSG_DEBUG, "EAP-FAST: Identity already "
1477 "known - skip Phase 2 Identity Request");
1478 next_type = sm->user->methods[0].method;
1479 sm->user_eap_method_index = 1;
1482 eap_fast_state(data, PHASE2_METHOD);
1484 eap_fast_state(data, PHASE2_ID);
1485 next_type = EAP_TYPE_IDENTITY;
1488 eap_fast_phase2_init(sm, data, next_type);
1492 static void eap_fast_process(struct eap_sm *sm, void *priv,
1493 struct wpabuf *respData)
1495 struct eap_fast_data *data = priv;
1500 pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_FAST, respData,
1502 if (pos == NULL || left < 1)
1506 wpa_printf(MSG_DEBUG, "EAP-FAST: Received packet(len=%lu) - "
1507 "Flags 0x%02x", (unsigned long) wpabuf_len(respData),
1510 if (eap_fast_process_version(data, flags & EAP_PEAP_VERSION_MASK))
1513 if ((flags & EAP_TLS_FLAGS_LENGTH_INCLUDED) &&
1514 eap_fast_process_length(data, &pos, &left))
1517 switch (data->state) {
1519 if (eap_fast_process_phase1(sm, data, pos, left))
1522 /* fall through to PHASE2_START */
1524 eap_fast_process_phase2_start(sm, data);
1528 case CRYPTO_BINDING:
1530 eap_fast_process_phase2(sm, data, pos, left);
1533 wpa_printf(MSG_DEBUG, "EAP-FAST: Unexpected state %d in %s",
1534 data->state, __func__);
1538 if (tls_connection_get_write_alerts(sm->ssl_ctx, data->ssl.conn) > 1) {
1539 wpa_printf(MSG_INFO, "EAP-FAST: Locally detected fatal error "
1540 "in TLS processing");
1541 eap_fast_state(data, FAILURE);
1546 static Boolean eap_fast_isDone(struct eap_sm *sm, void *priv)
1548 struct eap_fast_data *data = priv;
1549 return data->state == SUCCESS || data->state == FAILURE;
1553 static u8 * eap_fast_getKey(struct eap_sm *sm, void *priv, size_t *len)
1555 struct eap_fast_data *data = priv;
1558 if (data->state != SUCCESS)
1561 eapKeyData = os_malloc(EAP_FAST_KEY_LEN);
1562 if (eapKeyData == NULL)
1565 eap_fast_derive_eap_msk(data->simck, eapKeyData);
1566 *len = EAP_FAST_KEY_LEN;
1572 static u8 * eap_fast_get_emsk(struct eap_sm *sm, void *priv, size_t *len)
1574 struct eap_fast_data *data = priv;
1577 if (data->state != SUCCESS)
1580 eapKeyData = os_malloc(EAP_EMSK_LEN);
1581 if (eapKeyData == NULL)
1584 eap_fast_derive_eap_emsk(data->simck, eapKeyData);
1585 *len = EAP_EMSK_LEN;
1591 static Boolean eap_fast_isSuccess(struct eap_sm *sm, void *priv)
1593 struct eap_fast_data *data = priv;
1594 return data->state == SUCCESS;
1598 int eap_server_fast_register(void)
1600 struct eap_method *eap;
1603 eap = eap_server_method_alloc(EAP_SERVER_METHOD_INTERFACE_VERSION,
1604 EAP_VENDOR_IETF, EAP_TYPE_FAST, "FAST");
1608 eap->init = eap_fast_init;
1609 eap->reset = eap_fast_reset;
1610 eap->buildReq = eap_fast_buildReq;
1611 eap->check = eap_fast_check;
1612 eap->process = eap_fast_process;
1613 eap->isDone = eap_fast_isDone;
1614 eap->getKey = eap_fast_getKey;
1615 eap->get_emsk = eap_fast_get_emsk;
1616 eap->isSuccess = eap_fast_isSuccess;
1618 ret = eap_server_method_register(eap);
1620 eap_server_method_free(eap);