Deleted Added
full compact
wpa_auth_ft.c (302408) wpa_auth_ft.c (324697)
1/*
2 * hostapd - IEEE 802.11r - Fast BSS Transition
3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

--- 766 unchanged lines hidden (view full) ---

775 alg = wpa_cipher_to_alg(sm->pairwise);
776 klen = wpa_cipher_key_len(sm->pairwise);
777 if (!wpa_cipher_valid_pairwise(sm->pairwise)) {
778 wpa_printf(MSG_DEBUG, "FT: Unknown pairwise alg 0x%x - skip "
779 "PTK configuration", sm->pairwise);
780 return;
781 }
782
1/*
2 * hostapd - IEEE 802.11r - Fast BSS Transition
3 * Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8

--- 766 unchanged lines hidden (view full) ---

775 alg = wpa_cipher_to_alg(sm->pairwise);
776 klen = wpa_cipher_key_len(sm->pairwise);
777 if (!wpa_cipher_valid_pairwise(sm->pairwise)) {
778 wpa_printf(MSG_DEBUG, "FT: Unknown pairwise alg 0x%x - skip "
779 "PTK configuration", sm->pairwise);
780 return;
781 }
782
783 if (sm->tk_already_set) {
784 /* Must avoid TK reconfiguration to prevent clearing of TX/RX
785 * PN in the driver */
786 wpa_printf(MSG_DEBUG,
787 "FT: Do not re-install same PTK to the driver");
788 return;
789 }
790
783 /* FIX: add STA entry to kernel/driver here? The set_key will fail
784 * most likely without this.. At the moment, STA entry is added only
785 * after association has been completed. This function will be called
786 * again after association to get the PTK configured, but that could be
787 * optimized by adding the STA entry earlier.
788 */
789 if (wpa_auth_set_key(sm->wpa_auth, 0, alg, sm->addr, 0,
790 sm->PTK.tk, klen))
791 return;
792
793 /* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */
794 sm->pairwise_set = TRUE;
791 /* FIX: add STA entry to kernel/driver here? The set_key will fail
792 * most likely without this.. At the moment, STA entry is added only
793 * after association has been completed. This function will be called
794 * again after association to get the PTK configured, but that could be
795 * optimized by adding the STA entry earlier.
796 */
797 if (wpa_auth_set_key(sm->wpa_auth, 0, alg, sm->addr, 0,
798 sm->PTK.tk, klen))
799 return;
800
801 /* FIX: MLME-SetProtection.Request(TA, Tx_Rx) */
802 sm->pairwise_set = TRUE;
803 sm->tk_already_set = TRUE;
795}
796
797
798static int wpa_ft_process_auth_req(struct wpa_state_machine *sm,
799 const u8 *ies, size_t ies_len,
800 u8 **resp_ies, size_t *resp_ies_len)
801{
802 struct rsn_mdie *mdie;

--- 90 unchanged lines hidden (view full) ---

893 if (wpa_pmk_r1_to_ptk(pmk_r1, sm->SNonce, sm->ANonce, sm->addr,
894 sm->wpa_auth->addr, pmk_r1_name,
895 &sm->PTK, ptk_name, sm->wpa_key_mgmt,
896 pairwise) < 0)
897 return WLAN_STATUS_UNSPECIFIED_FAILURE;
898
899 sm->pairwise = pairwise;
900 sm->PTK_valid = TRUE;
804}
805
806
807static int wpa_ft_process_auth_req(struct wpa_state_machine *sm,
808 const u8 *ies, size_t ies_len,
809 u8 **resp_ies, size_t *resp_ies_len)
810{
811 struct rsn_mdie *mdie;

--- 90 unchanged lines hidden (view full) ---

902 if (wpa_pmk_r1_to_ptk(pmk_r1, sm->SNonce, sm->ANonce, sm->addr,
903 sm->wpa_auth->addr, pmk_r1_name,
904 &sm->PTK, ptk_name, sm->wpa_key_mgmt,
905 pairwise) < 0)
906 return WLAN_STATUS_UNSPECIFIED_FAILURE;
907
908 sm->pairwise = pairwise;
909 sm->PTK_valid = TRUE;
910 sm->tk_already_set = FALSE;
901 wpa_ft_install_ptk(sm);
902
903 buflen = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
904 2 + FT_R1KH_ID_LEN + 200;
905 *resp_ies = os_zalloc(buflen);
906 if (*resp_ies == NULL) {
907 return WLAN_STATUS_UNSPECIFIED_FAILURE;
908 }

--- 884 unchanged lines hidden ---
911 wpa_ft_install_ptk(sm);
912
913 buflen = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
914 2 + FT_R1KH_ID_LEN + 200;
915 *resp_ies = os_zalloc(buflen);
916 if (*resp_ies == NULL) {
917 return WLAN_STATUS_UNSPECIFIED_FAILURE;
918 }

--- 884 unchanged lines hidden ---