diff options
| author | Jouni Malinen <j@w1.fi> | 2017-10-12 22:52:42 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-10-12 22:52:42 +0000 |
| commit | a1f3ac5a6ec8e69f65cafeb3b7f57ca43302fa28 (patch) | |
| tree | 231f181ccfc0d3082bc578472989de124913a436 | |
| parent | 83b7bd2ef9dbf09362713ae8258f4cdfb96d516d (diff) | |
| parent | e52ae8e63a78f72480c802930053c727ce1ee724 (diff) | |
| download | android_external_wpa_supplicant_8-a1f3ac5a6ec8e69f65cafeb3b7f57ca43302fa28.tar.gz android_external_wpa_supplicant_8-a1f3ac5a6ec8e69f65cafeb3b7f57ca43302fa28.tar.bz2 android_external_wpa_supplicant_8-a1f3ac5a6ec8e69f65cafeb3b7f57ca43302fa28.zip | |
Fix PTK rekeying to generate a new ANonce
am: e52ae8e63a
Change-Id: Icde8c1667c866274cb59a7c5504506607189abe7
| -rw-r--r-- | src/ap/wpa_auth.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 1a16b5c8..d6c37780 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -1710,6 +1710,21 @@ SM_STATE(WPA_PTK, AUTHENTICATION2) } +static int wpa_auth_sm_ptk_update(struct wpa_state_machine *sm) +{ + if (random_get_bytes(sm->ANonce, WPA_NONCE_LEN)) { + wpa_printf(MSG_ERROR, + "WPA: Failed to get random data for ANonce"); + sm->Disconnect = TRUE; + return -1; + } + wpa_hexdump(MSG_DEBUG, "WPA: Assign new ANonce", sm->ANonce, + WPA_NONCE_LEN); + sm->TimeoutCtr = 0; + return 0; +} + + SM_STATE(WPA_PTK, INITPMK) { u8 msk[2 * PMK_LEN]; @@ -2221,9 +2236,12 @@ SM_STEP(WPA_PTK) SM_ENTER(WPA_PTK, AUTHENTICATION); else if (sm->ReAuthenticationRequest) SM_ENTER(WPA_PTK, AUTHENTICATION2); - else if (sm->PTKRequest) - SM_ENTER(WPA_PTK, PTKSTART); - else switch (sm->wpa_ptk_state) { + else if (sm->PTKRequest) { + if (wpa_auth_sm_ptk_update(sm) < 0) + SM_ENTER(WPA_PTK, DISCONNECTED); + else + SM_ENTER(WPA_PTK, PTKSTART); + } else switch (sm->wpa_ptk_state) { case WPA_PTK_INITIALIZE: break; case WPA_PTK_DISCONNECT: |
