Lines Matching +full:entry +full:- +full:method

2  * EAP peer method: EAP-FAST (RFC 4851)
3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
25 * - test session resumption and enable it if it interoperates
26 * - password change (pending mschapv2 packet; replay decrypted packet)
81 wpa_printf(MSG_DEBUG, "EAP-FAST: SessionTicket callback"); in eap_fast_session_ticket_cb()
85 wpa_printf(MSG_DEBUG, "EAP-FAST: SessionTicket failed - fall " in eap_fast_session_ticket_cb()
87 data->session_ticket_used = 0; in eap_fast_session_ticket_cb()
88 if (data->provisioning_allowed) { in eap_fast_session_ticket_cb()
89 wpa_printf(MSG_DEBUG, "EAP-FAST: Try to provision a " in eap_fast_session_ticket_cb()
90 "new PAC-Key"); in eap_fast_session_ticket_cb()
91 data->provisioning = 1; in eap_fast_session_ticket_cb()
92 data->current_pac = NULL; in eap_fast_session_ticket_cb()
97 wpa_hexdump(MSG_DEBUG, "EAP-FAST: SessionTicket", ticket, len); in eap_fast_session_ticket_cb()
99 if (data->current_pac == NULL) { in eap_fast_session_ticket_cb()
100 wpa_printf(MSG_DEBUG, "EAP-FAST: No PAC-Key available for " in eap_fast_session_ticket_cb()
102 data->session_ticket_used = 0; in eap_fast_session_ticket_cb()
106 eap_fast_derive_master_secret(data->current_pac->pac_key, in eap_fast_session_ticket_cb()
110 data->session_ticket_used = 1; in eap_fast_session_ticket_cb()
123 data->provisioning_allowed = atoi(pos + 18); in eap_fast_parse_phase1()
124 wpa_printf(MSG_DEBUG, "EAP-FAST: Automatic PAC provisioning " in eap_fast_parse_phase1()
125 "mode: %d", data->provisioning_allowed); in eap_fast_parse_phase1()
130 data->max_pac_list_len = atoi(pos + 22); in eap_fast_parse_phase1()
131 if (data->max_pac_list_len == 0) in eap_fast_parse_phase1()
132 data->max_pac_list_len = 1; in eap_fast_parse_phase1()
133 wpa_printf(MSG_DEBUG, "EAP-FAST: Maximum PAC list length: %lu", in eap_fast_parse_phase1()
134 (unsigned long) data->max_pac_list_len); in eap_fast_parse_phase1()
139 data->use_pac_binary_format = 1; in eap_fast_parse_phase1()
140 wpa_printf(MSG_DEBUG, "EAP-FAST: Using binary format for PAC " in eap_fast_parse_phase1()
157 data->fast_version = EAP_FAST_VERSION; in eap_fast_init()
158 data->max_pac_list_len = 10; in eap_fast_init()
160 if (config->phase1) in eap_fast_init()
161 eap_fast_parse_phase1(data, config->phase1); in eap_fast_init()
164 &data->phase2_types, in eap_fast_init()
165 &data->num_phase2_types, 0) < 0) { in eap_fast_init()
170 data->phase2_type.vendor = EAP_VENDOR_IETF; in eap_fast_init()
171 data->phase2_type.method = EAP_TYPE_NONE; in eap_fast_init()
173 if (eap_peer_tls_ssl_init(sm, &data->ssl, config, EAP_TYPE_FAST)) { in eap_fast_init()
174 wpa_printf(MSG_INFO, "EAP-FAST: Failed to initialize SSL."); in eap_fast_init()
179 if (tls_connection_set_session_ticket_cb(sm->ssl_ctx, data->ssl.conn, in eap_fast_init()
182 wpa_printf(MSG_INFO, "EAP-FAST: Failed to set SessionTicket " in eap_fast_init()
193 if (tls_connection_enable_workaround(sm->ssl_ctx, data->ssl.conn)) { in eap_fast_init()
194 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to enable TLS " in eap_fast_init()
198 if (!config->pac_file) { in eap_fast_init()
199 wpa_printf(MSG_INFO, "EAP-FAST: No PAC file configured"); in eap_fast_init()
204 if (data->use_pac_binary_format && in eap_fast_init()
205 eap_fast_load_pac_bin(sm, &data->pac, config->pac_file) < 0) { in eap_fast_init()
206 wpa_printf(MSG_INFO, "EAP-FAST: Failed to load PAC file"); in eap_fast_init()
211 if (!data->use_pac_binary_format && in eap_fast_init()
212 eap_fast_load_pac(sm, &data->pac, config->pac_file) < 0) { in eap_fast_init()
213 wpa_printf(MSG_INFO, "EAP-FAST: Failed to load PAC file"); in eap_fast_init()
217 eap_fast_pac_list_truncate(data->pac, data->max_pac_list_len); in eap_fast_init()
219 if (data->pac == NULL && !data->provisioning_allowed) { in eap_fast_init()
220 wpa_printf(MSG_INFO, "EAP-FAST: No PAC configured and " in eap_fast_init()
237 if (data->phase2_priv && data->phase2_method) in eap_fast_deinit()
238 data->phase2_method->deinit(sm, data->phase2_priv); in eap_fast_deinit()
239 os_free(data->phase2_types); in eap_fast_deinit()
240 os_free(data->key_block_p); in eap_fast_deinit()
241 eap_peer_tls_ssl_deinit(sm, &data->ssl); in eap_fast_deinit()
243 pac = data->pac; in eap_fast_deinit()
247 pac = pac->next; in eap_fast_deinit()
250 os_memset(data->key_data, 0, EAP_FAST_KEY_LEN); in eap_fast_deinit()
251 os_memset(data->emsk, 0, EAP_EMSK_LEN); in eap_fast_deinit()
252 os_free(data->session_id); in eap_fast_deinit()
253 wpabuf_clear_free(data->pending_phase2_req); in eap_fast_deinit()
254 wpabuf_clear_free(data->pending_resp); in eap_fast_deinit()
261 if (eap_fast_derive_eap_msk(data->simck, data->key_data) < 0 || in eap_fast_derive_msk()
262 eap_fast_derive_eap_emsk(data->simck, data->emsk) < 0) in eap_fast_derive_msk()
263 return -1; in eap_fast_derive_msk()
264 data->success = 1; in eap_fast_derive_msk()
278 sks = eap_fast_derive_key(sm->ssl_ctx, data->ssl.conn, in eap_fast_derive_key_auth()
281 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to derive " in eap_fast_derive_key_auth()
283 return -1; in eap_fast_derive_key_auth()
288 * S-IMCK[0] = session_key_seed in eap_fast_derive_key_auth()
291 "EAP-FAST: session_key_seed (SKS = S-IMCK[0])", in eap_fast_derive_key_auth()
293 data->simck_idx = 0; in eap_fast_derive_key_auth()
294 os_memcpy(data->simck, sks, EAP_FAST_SIMCK_LEN); in eap_fast_derive_key_auth()
303 os_free(data->key_block_p); in eap_fast_derive_key_provisioning()
304 data->key_block_p = (struct eap_fast_key_block_provisioning *) in eap_fast_derive_key_provisioning()
305 eap_fast_derive_key(sm->ssl_ctx, data->ssl.conn, in eap_fast_derive_key_provisioning()
306 sizeof(*data->key_block_p)); in eap_fast_derive_key_provisioning()
307 if (data->key_block_p == NULL) { in eap_fast_derive_key_provisioning()
308 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to derive key block"); in eap_fast_derive_key_provisioning()
309 return -1; in eap_fast_derive_key_provisioning()
313 * S-IMCK[0] = session_key_seed in eap_fast_derive_key_provisioning()
316 "EAP-FAST: session_key_seed (SKS = S-IMCK[0])", in eap_fast_derive_key_provisioning()
317 data->key_block_p->session_key_seed, in eap_fast_derive_key_provisioning()
318 sizeof(data->key_block_p->session_key_seed)); in eap_fast_derive_key_provisioning()
319 data->simck_idx = 0; in eap_fast_derive_key_provisioning()
320 os_memcpy(data->simck, data->key_block_p->session_key_seed, in eap_fast_derive_key_provisioning()
322 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: server_challenge", in eap_fast_derive_key_provisioning()
323 data->key_block_p->server_challenge, in eap_fast_derive_key_provisioning()
324 sizeof(data->key_block_p->server_challenge)); in eap_fast_derive_key_provisioning()
325 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: client_challenge", in eap_fast_derive_key_provisioning()
326 data->key_block_p->client_challenge, in eap_fast_derive_key_provisioning()
327 sizeof(data->key_block_p->client_challenge)); in eap_fast_derive_key_provisioning()
336 if (data->anon_provisioning) in eap_fast_derive_keys()
347 data->phase2_method = in eap_fast_init_phase2_method()
348 eap_peer_get_eap_method(data->phase2_type.vendor, in eap_fast_init_phase2_method()
349 data->phase2_type.method); in eap_fast_init_phase2_method()
350 if (data->phase2_method == NULL) in eap_fast_init_phase2_method()
351 return -1; in eap_fast_init_phase2_method()
353 if (data->key_block_p) { in eap_fast_init_phase2_method()
354 sm->auth_challenge = data->key_block_p->server_challenge; in eap_fast_init_phase2_method()
355 sm->peer_challenge = data->key_block_p->client_challenge; in eap_fast_init_phase2_method()
357 sm->eap_fast_mschapv2 = true; in eap_fast_init_phase2_method()
358 sm->init_phase2 = 1; in eap_fast_init_phase2_method()
359 data->phase2_priv = data->phase2_method->init(sm); in eap_fast_init_phase2_method()
360 sm->init_phase2 = 0; in eap_fast_init_phase2_method()
361 sm->auth_challenge = NULL; in eap_fast_init_phase2_method()
362 sm->peer_challenge = NULL; in eap_fast_init_phase2_method()
364 return data->phase2_priv == NULL ? -1 : 0; in eap_fast_init_phase2_method()
376 if (data->anon_provisioning && in eap_fast_select_phase2_method()
379 …"EAP-FAST: Only EAP-MSCHAPv2 is allowed during unauthenticated provisioning; reject phase2 type %u… in eap_fast_select_phase2_method()
381 return -1; in eap_fast_select_phase2_method()
386 data->phase2_type.vendor = EAP_VENDOR_IETF; in eap_fast_select_phase2_method()
387 data->phase2_type.method = EAP_TYPE_TNC; in eap_fast_select_phase2_method()
388 wpa_printf(MSG_DEBUG, "EAP-FAST: Selected Phase 2 EAP " in eap_fast_select_phase2_method()
389 "vendor %d method %d for TNC", in eap_fast_select_phase2_method()
390 data->phase2_type.vendor, in eap_fast_select_phase2_method()
391 data->phase2_type.method); in eap_fast_select_phase2_method()
396 for (i = 0; i < data->num_phase2_types; i++) { in eap_fast_select_phase2_method()
397 if (data->phase2_types[i].vendor != vendor || in eap_fast_select_phase2_method()
398 data->phase2_types[i].method != type) in eap_fast_select_phase2_method()
401 data->phase2_type.vendor = data->phase2_types[i].vendor; in eap_fast_select_phase2_method()
402 data->phase2_type.method = data->phase2_types[i].method; in eap_fast_select_phase2_method()
403 wpa_printf(MSG_DEBUG, "EAP-FAST: Selected Phase 2 EAP " in eap_fast_select_phase2_method()
404 "vendor %d method %d", in eap_fast_select_phase2_method()
405 data->phase2_type.vendor, in eap_fast_select_phase2_method()
406 data->phase2_type.method); in eap_fast_select_phase2_method()
410 if (vendor != data->phase2_type.vendor || in eap_fast_select_phase2_method()
411 type != data->phase2_type.method || in eap_fast_select_phase2_method()
413 return -1; in eap_fast_select_phase2_method()
425 size_t len = be_to_host16(hdr->length); in eap_fast_phase2_request()
431 enum eap_type method; in eap_fast_phase2_request() local
434 wpa_printf(MSG_INFO, "EAP-FAST: too short " in eap_fast_phase2_request()
436 return -1; in eap_fast_phase2_request()
439 method = *pos; in eap_fast_phase2_request()
440 if (method == EAP_TYPE_EXPANDED) { in eap_fast_phase2_request()
443 "EAP-FAST: Too short Phase 2 request (expanded header) (len=%lu)", in eap_fast_phase2_request()
445 return -1; in eap_fast_phase2_request()
448 method = WPA_GET_BE32(pos + 4); in eap_fast_phase2_request()
450 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase 2 Request: type=%u:%u", in eap_fast_phase2_request()
451 vendor, method); in eap_fast_phase2_request()
452 if (vendor == EAP_VENDOR_IETF && method == EAP_TYPE_IDENTITY) { in eap_fast_phase2_request()
453 *resp = eap_sm_buildIdentity(sm, hdr->identifier, 1); in eap_fast_phase2_request()
457 if (data->phase2_priv && data->phase2_method && in eap_fast_phase2_request()
458 (vendor != data->phase2_type.vendor || in eap_fast_phase2_request()
459 method != data->phase2_type.method)) { in eap_fast_phase2_request()
460 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase 2 EAP sequence - " in eap_fast_phase2_request()
461 "deinitialize previous method"); in eap_fast_phase2_request()
462 data->phase2_method->deinit(sm, data->phase2_priv); in eap_fast_phase2_request()
463 data->phase2_method = NULL; in eap_fast_phase2_request()
464 data->phase2_priv = NULL; in eap_fast_phase2_request()
465 data->phase2_type.vendor = EAP_VENDOR_IETF; in eap_fast_phase2_request()
466 data->phase2_type.method = EAP_TYPE_NONE; in eap_fast_phase2_request()
469 if (data->phase2_type.vendor == EAP_VENDOR_IETF && in eap_fast_phase2_request()
470 data->phase2_type.method == EAP_TYPE_NONE && in eap_fast_phase2_request()
471 eap_fast_select_phase2_method(data, vendor, method) < 0) { in eap_fast_phase2_request()
472 if (eap_peer_tls_phase2_nak(data->phase2_types, in eap_fast_phase2_request()
473 data->num_phase2_types, in eap_fast_phase2_request()
475 return -1; in eap_fast_phase2_request()
479 if ((data->phase2_priv == NULL && in eap_fast_phase2_request()
481 data->phase2_method == NULL) { in eap_fast_phase2_request()
483 "EAP-FAST: Failed to initialize Phase 2 EAP method %u:%u", in eap_fast_phase2_request()
484 vendor, method); in eap_fast_phase2_request()
485 ret->methodState = METHOD_DONE; in eap_fast_phase2_request()
486 ret->decision = DECISION_FAIL; in eap_fast_phase2_request()
487 return -1; in eap_fast_phase2_request()
492 *resp = data->phase2_method->process(sm, data->phase2_priv, &iret, in eap_fast_phase2_request()
497 ret->methodState = METHOD_DONE; in eap_fast_phase2_request()
498 ret->decision = DECISION_FAIL; in eap_fast_phase2_request()
503 data->phase2_success = 1; in eap_fast_phase2_request()
507 (config->pending_req_identity || config->pending_req_password || in eap_fast_phase2_request()
508 config->pending_req_otp || config->pending_req_new_password || in eap_fast_phase2_request()
509 config->pending_req_sim)) { in eap_fast_phase2_request()
510 wpabuf_clear_free(data->pending_phase2_req); in eap_fast_phase2_request()
511 data->pending_phase2_req = wpabuf_alloc_copy(hdr, len); in eap_fast_phase2_request()
513 return -1; in eap_fast_phase2_request()
527 nak->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY | EAP_TLV_NAK_TLV); in eap_fast_tlv_nak()
528 nak->length = host_to_be16(6); in eap_fast_tlv_nak()
529 nak->vendor_id = host_to_be32(vendor_id); in eap_fast_tlv_nak()
530 nak->nak_type = host_to_be16(tlv_type); in eap_fast_tlv_nak()
542 wpa_printf(MSG_DEBUG, "EAP-FAST: Add %sResult TLV(status=%d)", in eap_fast_tlv_result()
545 result->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY | in eap_fast_tlv_result()
549 result->length = host_to_be16(2); in eap_fast_tlv_result()
550 result->status = host_to_be16(status); in eap_fast_tlv_result()
565 wpa_printf(MSG_DEBUG, "EAP-FAST: Add PAC TLV (ack)"); in eap_fast_tlv_pac_ack()
567 ack->tlv_type = host_to_be16(EAP_TLV_PAC_TLV | in eap_fast_tlv_pac_ack()
569 ack->length = host_to_be16(sizeof(*ack) - sizeof(struct eap_tlv_hdr)); in eap_fast_tlv_pac_ack()
570 ack->pac_type = host_to_be16(PAC_TYPE_PAC_ACKNOWLEDGEMENT); in eap_fast_tlv_pac_ack()
571 ack->pac_len = host_to_be16(2); in eap_fast_tlv_pac_ack()
572 ack->result = host_to_be16(EAP_TLV_RESULT_SUCCESS); in eap_fast_tlv_pac_ack()
587 wpa_printf(MSG_DEBUG, "EAP-FAST: too short EAP " in eap_fast_process_eap_payload_tlv()
594 if (be_to_host16(hdr->length) > eap_payload_tlv_len) { in eap_fast_process_eap_payload_tlv()
595 wpa_printf(MSG_DEBUG, "EAP-FAST: EAP packet overflow in " in eap_fast_process_eap_payload_tlv()
600 if (hdr->code != EAP_CODE_REQUEST) { in eap_fast_process_eap_payload_tlv()
601 wpa_printf(MSG_INFO, "EAP-FAST: Unexpected code=%d in " in eap_fast_process_eap_payload_tlv()
602 "Phase 2 EAP header", hdr->code); in eap_fast_process_eap_payload_tlv()
607 wpa_printf(MSG_INFO, "EAP-FAST: Phase2 Request processing " in eap_fast_process_eap_payload_tlv()
619 wpa_printf(MSG_DEBUG, "EAP-FAST: Crypto-Binding TLV: Version %d " in eap_fast_validate_crypto_binding()
621 _bind->version, _bind->received_version, _bind->subtype); in eap_fast_validate_crypto_binding()
622 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: NONCE", in eap_fast_validate_crypto_binding()
623 _bind->nonce, sizeof(_bind->nonce)); in eap_fast_validate_crypto_binding()
624 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Compound MAC", in eap_fast_validate_crypto_binding()
625 _bind->compound_mac, sizeof(_bind->compound_mac)); in eap_fast_validate_crypto_binding()
627 if (_bind->version != EAP_FAST_VERSION || in eap_fast_validate_crypto_binding()
628 _bind->received_version != EAP_FAST_VERSION || in eap_fast_validate_crypto_binding()
629 _bind->subtype != EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST) { in eap_fast_validate_crypto_binding()
630 wpa_printf(MSG_INFO, "EAP-FAST: Invalid version/subtype in " in eap_fast_validate_crypto_binding()
631 "Crypto-Binding TLV: Version %d " in eap_fast_validate_crypto_binding()
633 _bind->version, _bind->received_version, in eap_fast_validate_crypto_binding()
634 _bind->subtype); in eap_fast_validate_crypto_binding()
635 return -1; in eap_fast_validate_crypto_binding()
646 rbind->tlv_type = host_to_be16(EAP_TLV_TYPE_MANDATORY | in eap_fast_write_crypto_binding()
648 rbind->length = host_to_be16(sizeof(*rbind) - in eap_fast_write_crypto_binding()
650 rbind->version = EAP_FAST_VERSION; in eap_fast_write_crypto_binding()
651 rbind->received_version = _bind->version; in eap_fast_write_crypto_binding()
652 rbind->subtype = EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE; in eap_fast_write_crypto_binding()
653 os_memcpy(rbind->nonce, _bind->nonce, sizeof(_bind->nonce)); in eap_fast_write_crypto_binding()
654 inc_byte_array(rbind->nonce, sizeof(rbind->nonce)); in eap_fast_write_crypto_binding()
656 rbind->compound_mac); in eap_fast_write_crypto_binding()
658 wpa_printf(MSG_DEBUG, "EAP-FAST: Reply Crypto-Binding TLV: Version %d " in eap_fast_write_crypto_binding()
660 rbind->version, rbind->received_version, rbind->subtype); in eap_fast_write_crypto_binding()
661 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: NONCE", in eap_fast_write_crypto_binding()
662 rbind->nonce, sizeof(rbind->nonce)); in eap_fast_write_crypto_binding()
663 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Compound MAC", in eap_fast_write_crypto_binding()
664 rbind->compound_mac, sizeof(rbind->compound_mac)); in eap_fast_write_crypto_binding()
677 if (data->phase2_method == NULL || data->phase2_priv == NULL) { in eap_fast_get_phase2_key()
678 wpa_printf(MSG_DEBUG, "EAP-FAST: Phase 2 method not " in eap_fast_get_phase2_key()
680 return -1; in eap_fast_get_phase2_key()
683 if (data->phase2_method->isKeyAvailable == NULL || in eap_fast_get_phase2_key()
684 data->phase2_method->getKey == NULL) in eap_fast_get_phase2_key()
687 if (!data->phase2_method->isKeyAvailable(sm, data->phase2_priv) || in eap_fast_get_phase2_key()
688 (key = data->phase2_method->getKey(sm, data->phase2_priv, in eap_fast_get_phase2_key()
690 wpa_printf(MSG_DEBUG, "EAP-FAST: Could not get key material " in eap_fast_get_phase2_key()
692 return -1; in eap_fast_get_phase2_key()
709 wpa_printf(MSG_DEBUG, "EAP-FAST: Determining CMK[%d] for Compound MIC " in eap_fast_get_cmk()
710 "calculation", data->simck_idx + 1); in eap_fast_get_cmk()
714 * IMCK[j] = T-PRF(S-IMCK[j-1], "Inner Methods Compound Keys", in eap_fast_get_cmk()
716 * S-IMCK[j] = first 40 octets of IMCK[j] in eap_fast_get_cmk()
721 return -1; in eap_fast_get_cmk()
722 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: ISK[j]", isk, sizeof(isk)); in eap_fast_get_cmk()
723 if (sha1_t_prf(data->simck, EAP_FAST_SIMCK_LEN, in eap_fast_get_cmk()
726 return -1; in eap_fast_get_cmk()
727 data->simck_idx++; in eap_fast_get_cmk()
728 os_memcpy(data->simck, imck, EAP_FAST_SIMCK_LEN); in eap_fast_get_cmk()
729 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: S-IMCK[j]", in eap_fast_get_cmk()
730 data->simck, EAP_FAST_SIMCK_LEN); in eap_fast_get_cmk()
732 wpa_hexdump_key(MSG_MSGDUMP, "EAP-FAST: CMK[j]", in eap_fast_get_cmk()
746 act->tlv_type = host_to_be16(EAP_TLV_REQUEST_ACTION_TLV); in eap_fast_write_pac_request()
747 act->length = host_to_be16(2); in eap_fast_write_pac_request()
748 act->action = host_to_be16(EAP_TLV_ACTION_PROCESS_TLV); in eap_fast_write_pac_request()
751 pac->tlv_type = host_to_be16(EAP_TLV_PAC_TLV); in eap_fast_write_pac_request()
752 pac->length = host_to_be16(sizeof(*type)); in eap_fast_write_pac_request()
755 type->tlv_type = host_to_be16(PAC_TYPE_PAC_TYPE); in eap_fast_write_pac_request()
756 type->length = host_to_be16(2); in eap_fast_write_pac_request()
757 type->pac_type = host_to_be16(pac_type); in eap_fast_write_pac_request()
781 os_memcpy(cmac, _bind->compound_mac, sizeof(cmac)); in eap_fast_process_crypto_binding()
782 os_memset(_bind->compound_mac, 0, sizeof(cmac)); in eap_fast_process_crypto_binding()
783 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Crypto-Binding TLV for Compound " in eap_fast_process_crypto_binding()
786 _bind->compound_mac); in eap_fast_process_crypto_binding()
787 res = os_memcmp_const(cmac, _bind->compound_mac, sizeof(cmac)); in eap_fast_process_crypto_binding()
788 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Received Compound MAC", in eap_fast_process_crypto_binding()
790 wpa_hexdump(MSG_MSGDUMP, "EAP-FAST: Calculated Compound MAC", in eap_fast_process_crypto_binding()
791 _bind->compound_mac, sizeof(cmac)); in eap_fast_process_crypto_binding()
793 wpa_printf(MSG_INFO, "EAP-FAST: Compound MAC did not match"); in eap_fast_process_crypto_binding()
794 os_memcpy(_bind->compound_mac, cmac, sizeof(cmac)); in eap_fast_process_crypto_binding()
808 if (!data->anon_provisioning && data->phase2_success && in eap_fast_process_crypto_binding()
810 wpa_printf(MSG_INFO, "EAP-FAST: Failed to generate MSK"); in eap_fast_process_crypto_binding()
811 ret->methodState = METHOD_DONE; in eap_fast_process_crypto_binding()
812 ret->decision = DECISION_FAIL; in eap_fast_process_crypto_binding()
813 data->phase2_success = 0; in eap_fast_process_crypto_binding()
818 if (!data->anon_provisioning && data->phase2_success) { in eap_fast_process_crypto_binding()
819 os_free(data->session_id); in eap_fast_process_crypto_binding()
820 data->session_id = eap_peer_tls_derive_session_id( in eap_fast_process_crypto_binding()
821 sm, &data->ssl, EAP_TYPE_FAST, &data->id_len); in eap_fast_process_crypto_binding()
822 if (data->session_id) { in eap_fast_process_crypto_binding()
823 wpa_hexdump(MSG_DEBUG, "EAP-FAST: Derived Session-Id", in eap_fast_process_crypto_binding()
824 data->session_id, data->id_len); in eap_fast_process_crypto_binding()
826 wpa_printf(MSG_ERROR, "EAP-FAST: Failed to derive " in eap_fast_process_crypto_binding()
827 "Session-Id"); in eap_fast_process_crypto_binding()
841 static void eap_fast_parse_pac_tlv(struct eap_fast_pac *entry, int type, in eap_fast_parse_pac_tlv() argument
846 wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: PAC-Key", pos, len); in eap_fast_parse_pac_tlv()
848 wpa_printf(MSG_DEBUG, "EAP-FAST: Invalid PAC-Key " in eap_fast_parse_pac_tlv()
853 os_memcpy(entry->pac_key, pos, len); in eap_fast_parse_pac_tlv()
856 wpa_hexdump(MSG_DEBUG, "EAP-FAST: PAC-Opaque", pos, len); in eap_fast_parse_pac_tlv()
857 entry->pac_opaque = pos; in eap_fast_parse_pac_tlv()
858 entry->pac_opaque_len = len; in eap_fast_parse_pac_tlv()
861 wpa_hexdump(MSG_DEBUG, "EAP-FAST: PAC-Info", pos, len); in eap_fast_parse_pac_tlv()
862 entry->pac_info = pos; in eap_fast_parse_pac_tlv()
863 entry->pac_info_len = len; in eap_fast_parse_pac_tlv()
866 wpa_printf(MSG_DEBUG, "EAP-FAST: Ignored unknown PAC type %d", in eap_fast_parse_pac_tlv()
873 static int eap_fast_process_pac_tlv(struct eap_fast_pac *entry, in eap_fast_process_pac_tlv() argument
886 type = be_to_host16(hdr->type); in eap_fast_process_pac_tlv()
887 len = be_to_host16(hdr->len); in eap_fast_process_pac_tlv()
889 left -= sizeof(*hdr); in eap_fast_process_pac_tlv()
891 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC TLV overrun " in eap_fast_process_pac_tlv()
895 return -1; in eap_fast_process_pac_tlv()
898 eap_fast_parse_pac_tlv(entry, type, pos, len, &pac_key_found); in eap_fast_process_pac_tlv()
901 left -= len; in eap_fast_process_pac_tlv()
904 if (!pac_key_found || !entry->pac_opaque || !entry->pac_info) { in eap_fast_process_pac_tlv()
905 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC TLV does not include " in eap_fast_process_pac_tlv()
907 return -1; in eap_fast_process_pac_tlv()
914 static int eap_fast_parse_pac_info(struct eap_fast_pac *entry, int type, in eap_fast_parse_pac_info() argument
924 wpa_hexdump(MSG_DEBUG, "EAP-FAST: PAC-Info - " in eap_fast_parse_pac_info()
925 "Invalid CRED_LIFETIME length - ignored", in eap_fast_parse_pac_info()
933 * needed. Anyway, the information is available from PAC-Info in eap_fast_parse_pac_info()
938 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Info - CRED_LIFETIME %d " in eap_fast_parse_pac_info()
940 lifetime, (lifetime - (u32) now.sec) / 86400); in eap_fast_parse_pac_info()
943 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: PAC-Info - A-ID", in eap_fast_parse_pac_info()
945 entry->a_id = pos; in eap_fast_parse_pac_info()
946 entry->a_id_len = len; in eap_fast_parse_pac_info()
949 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: PAC-Info - I-ID", in eap_fast_parse_pac_info()
951 entry->i_id = pos; in eap_fast_parse_pac_info()
952 entry->i_id_len = len; in eap_fast_parse_pac_info()
955 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: PAC-Info - A-ID-Info", in eap_fast_parse_pac_info()
957 entry->a_id_info = pos; in eap_fast_parse_pac_info()
958 entry->a_id_info_len = len; in eap_fast_parse_pac_info()
961 /* RFC 5422, Section 4.2.6 - PAC-Type TLV */ in eap_fast_parse_pac_info()
963 wpa_printf(MSG_INFO, "EAP-FAST: Invalid PAC-Type " in eap_fast_parse_pac_info()
967 "EAP-FAST: PAC-Info - PAC-Type", in eap_fast_parse_pac_info()
969 return -1; in eap_fast_parse_pac_info()
975 wpa_printf(MSG_INFO, "EAP-FAST: Unsupported PAC Type " in eap_fast_parse_pac_info()
977 return -1; in eap_fast_parse_pac_info()
980 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Info - PAC-Type %d", in eap_fast_parse_pac_info()
982 entry->pac_type = pac_type; in eap_fast_parse_pac_info()
985 wpa_printf(MSG_DEBUG, "EAP-FAST: Ignored unknown PAC-Info " in eap_fast_parse_pac_info()
994 static int eap_fast_process_pac_info(struct eap_fast_pac *entry) in eap_fast_process_pac_info() argument
1003 /* PAC-Type defaults to Tunnel PAC (Type 1) */ in eap_fast_process_pac_info()
1004 entry->pac_type = PAC_TYPE_TUNNEL_PAC; in eap_fast_process_pac_info()
1006 pos = entry->pac_info; in eap_fast_process_pac_info()
1007 left = entry->pac_info_len; in eap_fast_process_pac_info()
1010 type = be_to_host16(hdr->type); in eap_fast_process_pac_info()
1011 len = be_to_host16(hdr->len); in eap_fast_process_pac_info()
1013 left -= sizeof(*hdr); in eap_fast_process_pac_info()
1015 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Info overrun " in eap_fast_process_pac_info()
1019 return -1; in eap_fast_process_pac_info()
1022 if (eap_fast_parse_pac_info(entry, type, pos, len) < 0) in eap_fast_process_pac_info()
1023 return -1; in eap_fast_process_pac_info()
1026 left -= len; in eap_fast_process_pac_info()
1029 if (entry->a_id == NULL || entry->a_id_info == NULL) { in eap_fast_process_pac_info()
1030 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Info does not include " in eap_fast_process_pac_info()
1032 return -1; in eap_fast_process_pac_info()
1045 struct eap_fast_pac entry; in eap_fast_process_pac() local
1047 os_memset(&entry, 0, sizeof(entry)); in eap_fast_process_pac()
1048 if (eap_fast_process_pac_tlv(&entry, pac, pac_len) || in eap_fast_process_pac()
1049 eap_fast_process_pac_info(&entry)) in eap_fast_process_pac()
1052 eap_fast_add_pac(&data->pac, &data->current_pac, &entry); in eap_fast_process_pac()
1053 eap_fast_pac_list_truncate(data->pac, data->max_pac_list_len); in eap_fast_process_pac()
1054 if (data->use_pac_binary_format) in eap_fast_process_pac()
1055 eap_fast_save_pac_bin(sm, data->pac, config->pac_file); in eap_fast_process_pac()
1057 eap_fast_save_pac(sm, data->pac, config->pac_file); in eap_fast_process_pac()
1059 if (data->provisioning) { in eap_fast_process_pac()
1060 if (data->anon_provisioning) { in eap_fast_process_pac()
1063 * material and must end with an EAP-Failure. in eap_fast_process_pac()
1066 data->success = 0; in eap_fast_process_pac()
1067 ret->decision = DECISION_FAIL; in eap_fast_process_pac()
1073 ret->decision = DECISION_COND_SUCC; in eap_fast_process_pac()
1075 wpa_printf(MSG_DEBUG, "EAP-FAST: Send PAC-Acknowledgement TLV " in eap_fast_process_pac()
1076 "- Provisioning completed successfully"); in eap_fast_process_pac()
1077 sm->expected_failure = 1; in eap_fast_process_pac()
1081 * expected to be completed with an EAP-Success. However, in eap_fast_process_pac()
1082 * RFC 5422, Section 3.5 allows EAP-Failure to be sent even in eap_fast_process_pac()
1083 * after protected success exchange in case of EAP-Fast in eap_fast_process_pac()
1087 wpa_printf(MSG_DEBUG, "EAP-FAST: Send PAC-Acknowledgement TLV " in eap_fast_process_pac()
1088 "- PAC refreshing completed successfully"); in eap_fast_process_pac()
1089 ret->decision = DECISION_COND_SUCC; in eap_fast_process_pac()
1091 ret->methodState = METHOD_DONE; in eap_fast_process_pac()
1109 while (end - pos > 4) { in eap_fast_parse_decrypted()
1115 if (len > (size_t) (end - pos)) { in eap_fast_parse_decrypted()
1116 wpa_printf(MSG_INFO, "EAP-FAST: TLV overflow"); in eap_fast_parse_decrypted()
1117 return -1; in eap_fast_parse_decrypted()
1119 wpa_printf(MSG_DEBUG, "EAP-FAST: Received Phase 2: " in eap_fast_parse_decrypted()
1125 if (res == -2) in eap_fast_parse_decrypted()
1129 wpa_printf(MSG_DEBUG, "EAP-FAST: Nak unknown " in eap_fast_parse_decrypted()
1134 wpa_printf(MSG_DEBUG, "EAP-FAST: ignored " in eap_fast_parse_decrypted()
1155 wpa_hexdump_buf(MSG_DEBUG, "EAP-FAST: Encrypting Phase 2 data", in eap_fast_encrypt_response()
1157 if (eap_peer_tls_encrypt(sm, &data->ssl, EAP_TYPE_FAST, in eap_fast_encrypt_response()
1158 data->fast_version, identifier, in eap_fast_encrypt_response()
1160 wpa_printf(MSG_INFO, "EAP-FAST: Failed to encrypt a Phase 2 " in eap_fast_encrypt_response()
1182 wpabuf_put(tmp, pos2 - pos); in eap_fast_pac_request()
1240 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC TLV without Result TLV " in eap_fast_process_decrypted()
1249 if (data->current_pac == NULL && data->provisioning && in eap_fast_process_decrypted()
1250 !data->anon_provisioning && !tlv.pac && in eap_fast_process_decrypted()
1257 wpa_printf(MSG_DEBUG, "EAP-FAST: Request Tunnel PAC"); in eap_fast_process_decrypted()
1271 tlv.crypto_binding && data->phase2_success) { in eap_fast_process_decrypted()
1272 if (data->anon_provisioning) { in eap_fast_process_decrypted()
1273 wpa_printf(MSG_DEBUG, "EAP-FAST: Unauthenticated " in eap_fast_process_decrypted()
1275 ret->methodState = METHOD_DONE; in eap_fast_process_decrypted()
1276 ret->decision = DECISION_FAIL; in eap_fast_process_decrypted()
1277 sm->expected_failure = 1; in eap_fast_process_decrypted()
1279 wpa_printf(MSG_DEBUG, "EAP-FAST: Authentication " in eap_fast_process_decrypted()
1281 if (data->provisioning) in eap_fast_process_decrypted()
1282 ret->methodState = METHOD_MAY_CONT; in eap_fast_process_decrypted()
1284 ret->methodState = METHOD_DONE; in eap_fast_process_decrypted()
1285 ret->decision = DECISION_UNCOND_SUCC; in eap_fast_process_decrypted()
1290 wpa_printf(MSG_DEBUG, "EAP-FAST: No recognized TLVs - send " in eap_fast_process_decrypted()
1308 wpa_printf(MSG_DEBUG, "EAP-FAST: Received %lu bytes encrypted data for" in eap_fast_decrypt()
1311 if (data->pending_phase2_req) { in eap_fast_decrypt()
1312 wpa_printf(MSG_DEBUG, "EAP-FAST: Pending Phase 2 request - " in eap_fast_decrypt()
1315 eap_peer_tls_reset_input(&data->ssl); in eap_fast_decrypt()
1317 in_decrypted = data->pending_phase2_req; in eap_fast_decrypt()
1318 data->pending_phase2_req = NULL; in eap_fast_decrypt()
1323 /* Received TLS ACK - requesting more fragments */ in eap_fast_decrypt()
1324 return eap_peer_tls_encrypt(sm, &data->ssl, EAP_TYPE_FAST, in eap_fast_decrypt()
1325 data->fast_version, in eap_fast_decrypt()
1329 res = eap_peer_tls_decrypt(sm, &data->ssl, in_data, &in_decrypted); in eap_fast_decrypt()
1334 wpa_hexdump_buf(MSG_MSGDUMP, "EAP-FAST: Decrypted Phase 2 TLV(s)", in eap_fast_decrypt()
1338 wpa_printf(MSG_INFO, "EAP-FAST: Too short Phase 2 " in eap_fast_decrypt()
1342 return -1; in eap_fast_decrypt()
1360 * Parse authority identity (A-ID) from the EAP-FAST/Start. This in eap_fast_get_a_id()
1361 * supports both raw A-ID and one inside an A-ID TLV. in eap_fast_get_a_id()
1368 tlen = be_to_host16(hdr->len); in eap_fast_get_a_id()
1369 if (be_to_host16(hdr->type) == PAC_TYPE_A_ID && in eap_fast_get_a_id()
1371 wpa_printf(MSG_DEBUG, "EAP-FAST: A-ID was in TLV " in eap_fast_get_a_id()
1377 wpa_hexdump_ascii(MSG_DEBUG, "EAP-FAST: A-ID", a_id, *id_len); in eap_fast_get_a_id()
1386 data->current_pac = eap_fast_get_pac(data->pac, a_id, a_id_len, in eap_fast_select_pac()
1388 if (data->current_pac == NULL) { in eap_fast_select_pac()
1390 * Tunnel PAC was not available for this A-ID. Try to use in eap_fast_select_pac()
1393 data->current_pac = eap_fast_get_pac( in eap_fast_select_pac()
1394 data->pac, a_id, a_id_len, in eap_fast_select_pac()
1398 if (data->current_pac) { in eap_fast_select_pac()
1399 wpa_printf(MSG_DEBUG, "EAP-FAST: PAC found for this A-ID " in eap_fast_select_pac()
1400 "(PAC-Type %d)", data->current_pac->pac_type); in eap_fast_select_pac()
1401 wpa_hexdump_ascii(MSG_MSGDUMP, "EAP-FAST: A-ID-Info", in eap_fast_select_pac()
1402 data->current_pac->a_id_info, in eap_fast_select_pac()
1403 data->current_pac->a_id_info_len); in eap_fast_select_pac()
1416 olen = pac->pac_opaque_len; in eap_fast_use_pac_opaque()
1421 ehdr->tlv_type = host_to_be16(PAC_TYPE_PAC_OPAQUE); in eap_fast_use_pac_opaque()
1422 ehdr->length = host_to_be16(olen); in eap_fast_use_pac_opaque()
1423 os_memcpy(ehdr + 1, pac->pac_opaque, olen); in eap_fast_use_pac_opaque()
1426 tls_connection_client_hello_ext(sm->ssl_ctx, data->ssl.conn, in eap_fast_use_pac_opaque()
1429 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to add PAC-Opaque TLS " in eap_fast_use_pac_opaque()
1432 return -1; in eap_fast_use_pac_opaque()
1443 if (tls_connection_client_hello_ext(sm->ssl_ctx, data->ssl.conn, in eap_fast_clear_pac_opaque_ext()
1445 wpa_printf(MSG_DEBUG, "EAP-FAST: Failed to remove PAC-Opaque " in eap_fast_clear_pac_opaque_ext()
1447 return -1; in eap_fast_clear_pac_opaque_ext()
1459 if (data->provisioning_allowed & EAP_FAST_PROV_UNAUTH) { in eap_fast_set_provisioning_ciphers()
1460 wpa_printf(MSG_DEBUG, "EAP-FAST: Enabling unauthenticated " in eap_fast_set_provisioning_ciphers()
1465 if (data->provisioning_allowed & EAP_FAST_PROV_AUTH) { in eap_fast_set_provisioning_ciphers()
1466 wpa_printf(MSG_DEBUG, "EAP-FAST: Enabling authenticated " in eap_fast_set_provisioning_ciphers()
1477 if (tls_connection_set_cipher_list(sm->ssl_ctx, data->ssl.conn, in eap_fast_set_provisioning_ciphers()
1479 wpa_printf(MSG_INFO, "EAP-FAST: Could not configure TLS " in eap_fast_set_provisioning_ciphers()
1481 return -1; in eap_fast_set_provisioning_ciphers()
1495 /* EAP-FAST Version negotiation (section 3.1) */ in eap_fast_process_start()
1496 wpa_printf(MSG_DEBUG, "EAP-FAST: Start (server ver=%d, own ver=%d)", in eap_fast_process_start()
1497 flags & EAP_TLS_VERSION_MASK, data->fast_version); in eap_fast_process_start()
1498 if ((flags & EAP_TLS_VERSION_MASK) < data->fast_version) in eap_fast_process_start()
1499 data->fast_version = flags & EAP_TLS_VERSION_MASK; in eap_fast_process_start()
1500 wpa_printf(MSG_DEBUG, "EAP-FAST: Using FAST version %d", in eap_fast_process_start()
1501 data->fast_version); in eap_fast_process_start()
1506 if (data->resuming && data->current_pac) { in eap_fast_process_start()
1507 wpa_printf(MSG_DEBUG, "EAP-FAST: Trying to resume session - " in eap_fast_process_start()
1508 "do not add PAC-Opaque to TLS ClientHello"); in eap_fast_process_start()
1510 return -1; in eap_fast_process_start()
1511 } else if (data->current_pac) { in eap_fast_process_start()
1513 * PAC found for the A-ID and we are not resuming an old in eap_fast_process_start()
1514 * session, so add PAC-Opaque extension to ClientHello. in eap_fast_process_start()
1516 if (eap_fast_use_pac_opaque(sm, data, data->current_pac) < 0) in eap_fast_process_start()
1517 return -1; in eap_fast_process_start()
1520 if (!data->provisioning_allowed) { in eap_fast_process_start()
1521 wpa_printf(MSG_DEBUG, "EAP-FAST: No PAC found and " in eap_fast_process_start()
1523 return -1; in eap_fast_process_start()
1525 wpa_printf(MSG_DEBUG, "EAP-FAST: No PAC found - " in eap_fast_process_start()
1529 return -1; in eap_fast_process_start()
1530 data->provisioning = 1; in eap_fast_process_start()
1550 pos = eap_peer_tls_process_init(sm, &data->ssl, EAP_TYPE_FAST, ret, in eap_fast_process()
1556 id = req->identifier; in eap_fast_process()
1562 left = 0; /* A-ID is not used in further packet processing */ in eap_fast_process()
1568 if (tls_connection_established(sm->ssl_ctx, data->ssl.conn) && in eap_fast_process()
1569 !data->resuming) { in eap_fast_process()
1573 ret->methodState = METHOD_DONE; in eap_fast_process()
1574 ret->decision = DECISION_FAIL; in eap_fast_process()
1582 if (sm->waiting_ext_cert_check && data->pending_resp) { in eap_fast_process()
1585 if (config->pending_ext_cert_check == in eap_fast_process()
1588 "EAP-FAST: External certificate check succeeded - continue handshake"); in eap_fast_process()
1589 resp = data->pending_resp; in eap_fast_process()
1590 data->pending_resp = NULL; in eap_fast_process()
1591 sm->waiting_ext_cert_check = 0; in eap_fast_process()
1595 if (config->pending_ext_cert_check == in eap_fast_process()
1598 "EAP-FAST: External certificate check failed - force authentication failure"); in eap_fast_process()
1599 ret->methodState = METHOD_DONE; in eap_fast_process()
1600 ret->decision = DECISION_FAIL; in eap_fast_process()
1601 sm->waiting_ext_cert_check = 0; in eap_fast_process()
1606 "EAP-FAST: Continuing to wait external server certificate validation"); in eap_fast_process()
1611 res = eap_peer_tls_process_helper(sm, &data->ssl, in eap_fast_process()
1613 data->fast_version, id, &msg, in eap_fast_process()
1617 "EAP-FAST: TLS processing failed"); in eap_fast_process()
1618 ret->methodState = METHOD_DONE; in eap_fast_process()
1619 ret->decision = DECISION_FAIL; in eap_fast_process()
1623 if (sm->waiting_ext_cert_check) { in eap_fast_process()
1625 "EAP-FAST: Waiting external server certificate validation"); in eap_fast_process()
1626 wpabuf_clear_free(data->pending_resp); in eap_fast_process()
1627 data->pending_resp = resp; in eap_fast_process()
1631 if (tls_connection_established(sm->ssl_ctx, data->ssl.conn)) { in eap_fast_process()
1634 "EAP-FAST: TLS done, proceed to Phase 2"); in eap_fast_process()
1635 if (data->provisioning && in eap_fast_process()
1636 (!(data->provisioning_allowed & in eap_fast_process()
1638 tls_get_cipher(sm->ssl_ctx, data->ssl.conn, in eap_fast_process()
1640 os_strstr(cipher, "ADH-") || in eap_fast_process()
1642 wpa_printf(MSG_DEBUG, "EAP-FAST: Using " in eap_fast_process()
1645 data->anon_provisioning = 1; in eap_fast_process()
1647 data->anon_provisioning = 0; in eap_fast_process()
1648 data->resuming = 0; in eap_fast_process()
1651 "EAP-FAST: Could not derive keys"); in eap_fast_process()
1652 ret->methodState = METHOD_DONE; in eap_fast_process()
1653 ret->decision = DECISION_FAIL; in eap_fast_process()
1663 wpabuf_clear_free(data->pending_phase2_req); in eap_fast_process()
1664 data->pending_phase2_req = resp; in eap_fast_process()
1673 data->fast_version); in eap_fast_process()
1684 return tls_connection_established(sm->ssl_ctx, data->ssl.conn);
1692 if (data->phase2_priv && data->phase2_method &&
1693 data->phase2_method->deinit_for_reauth)
1694 data->phase2_method->deinit_for_reauth(sm, data->phase2_priv);
1695 os_free(data->key_block_p);
1696 data->key_block_p = NULL;
1697 wpabuf_clear_free(data->pending_phase2_req);
1698 data->pending_phase2_req = NULL;
1699 wpabuf_clear_free(data->pending_resp);
1700 data->pending_resp = NULL;
1707 if (eap_peer_tls_reauth_init(sm, &data->ssl)) {
1711 os_memset(data->key_data, 0, EAP_FAST_KEY_LEN);
1712 os_memset(data->emsk, 0, EAP_EMSK_LEN);
1713 os_free(data->session_id);
1714 data->session_id = NULL;
1715 if (data->phase2_priv && data->phase2_method &&
1716 data->phase2_method->init_for_reauth)
1717 data->phase2_method->init_for_reauth(sm, data->phase2_priv);
1718 data->phase2_success = 0;
1719 data->resuming = 1;
1720 data->provisioning = 0;
1721 data->anon_provisioning = 0;
1722 data->simck_idx = 0;
1734 len = eap_peer_tls_status(sm, &data->ssl, buf, buflen, verbose); in eap_fast_get_status()
1735 if (data->phase2_method) { in eap_fast_get_status()
1736 ret = os_snprintf(buf + len, buflen - len, in eap_fast_get_status()
1737 "EAP-FAST Phase2 method=%s\n", in eap_fast_get_status()
1738 data->phase2_method->name); in eap_fast_get_status()
1739 if (os_snprintf_error(buflen - len, ret)) in eap_fast_get_status()
1750 return data->success; in eap_fast_isKeyAvailable()
1759 if (!data->success) in eap_fast_getKey()
1762 key = os_memdup(data->key_data, EAP_FAST_KEY_LEN); in eap_fast_getKey()
1777 if (!data->success || !data->session_id) in eap_fast_get_session_id()
1780 id = os_memdup(data->session_id, data->id_len); in eap_fast_get_session_id()
1784 *len = data->id_len; in eap_fast_get_session_id()
1795 if (!data->success) in eap_fast_get_emsk()
1798 key = os_memdup(data->emsk, EAP_EMSK_LEN); in eap_fast_get_emsk()
1815 return -1; in eap_peer_fast_register()
1817 eap->init = eap_fast_init; in eap_peer_fast_register()
1818 eap->deinit = eap_fast_deinit; in eap_peer_fast_register()
1819 eap->process = eap_fast_process; in eap_peer_fast_register()
1820 eap->isKeyAvailable = eap_fast_isKeyAvailable; in eap_peer_fast_register()
1821 eap->getKey = eap_fast_getKey; in eap_peer_fast_register()
1822 eap->getSessionId = eap_fast_get_session_id; in eap_peer_fast_register()
1823 eap->get_status = eap_fast_get_status; in eap_peer_fast_register()
1825 eap->has_reauth_data = eap_fast_has_reauth_data; in eap_peer_fast_register()
1826 eap->deinit_for_reauth = eap_fast_deinit_for_reauth; in eap_peer_fast_register()
1827 eap->init_for_reauth = eap_fast_init_for_reauth; in eap_peer_fast_register()
1829 eap->get_emsk = eap_fast_get_emsk; in eap_peer_fast_register()