Extend RESEND_* test commands to allow forcing plaintext TX
This allows hostapd testing functionality to be forced to send out a plaintext EAPOL-Key frame with the RESEND_* command. That can be useful in seeing how the station behaves if an unencrypted EAPOL frame is received when TK is already configured. This is not really perfect since there is no convenient way of sending out a single unencrypted frame in the current nl80211 design. The monitor interface could likely still do this, but that's not really supposed to be used anymore. For now, clear and restore TK during this operation. The restore part is not really working correctly, though, since it ends up clearing the TSC value on the AP side and that shows up as replay protection issues on the station. Anyway, this is sufficient to generate sniffer captures to analyze station behavior. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
4be5bc98a8
commit
3d6953288b
4 changed files with 91 additions and 9 deletions
|
@ -4406,6 +4406,14 @@ void wpa_auth_eapol_key_tx_status(struct wpa_authenticator *wpa_auth,
|
|||
(timeout_ms % 1000) * 1000,
|
||||
wpa_send_eapol_timeout, wpa_auth, sm);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (sm->eapol_status_cb) {
|
||||
sm->eapol_status_cb(sm->eapol_status_cb_ctx1,
|
||||
sm->eapol_status_cb_ctx2);
|
||||
sm->eapol_status_cb = NULL;
|
||||
}
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
}
|
||||
|
||||
|
||||
|
@ -4523,7 +4531,9 @@ void wpa_auth_get_fils_aead_params(struct wpa_state_machine *sm,
|
|||
|
||||
#if CONFIG_TESTING_OPTIONS
|
||||
|
||||
int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce)
|
||||
int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2)
|
||||
{
|
||||
const u8 *anonce = sm->ANonce;
|
||||
u8 anonce_buf[WPA_NONCE_LEN];
|
||||
|
@ -4543,7 +4553,9 @@ int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce)
|
|||
}
|
||||
|
||||
|
||||
int wpa_auth_resend_m3(struct wpa_state_machine *sm)
|
||||
int wpa_auth_resend_m3(struct wpa_state_machine *sm,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2)
|
||||
{
|
||||
u8 rsc[WPA_KEY_RSC_LEN], *_rsc, *gtk, *kde, *pos, *opos;
|
||||
size_t gtk_len, kde_len;
|
||||
|
@ -4703,7 +4715,9 @@ int wpa_auth_resend_m3(struct wpa_state_machine *sm)
|
|||
}
|
||||
|
||||
|
||||
int wpa_auth_resend_group_m1(struct wpa_state_machine *sm)
|
||||
int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2)
|
||||
{
|
||||
u8 rsc[WPA_KEY_RSC_LEN];
|
||||
struct wpa_group *gsm = sm->group;
|
||||
|
@ -4743,6 +4757,10 @@ int wpa_auth_resend_group_m1(struct wpa_state_machine *sm)
|
|||
kde_len = gsm->GTK_len;
|
||||
}
|
||||
|
||||
sm->eapol_status_cb = cb;
|
||||
sm->eapol_status_cb_ctx1 = ctx1;
|
||||
sm->eapol_status_cb_ctx2 = ctx2;
|
||||
|
||||
wpa_send_eapol(sm->wpa_auth, sm,
|
||||
WPA_KEY_INFO_SECURE |
|
||||
(wpa_mic_len(sm->wpa_key_mgmt, sm->pmk_len) ?
|
||||
|
|
|
@ -428,8 +428,14 @@ u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm,
|
|||
u8 *pos, size_t max_len,
|
||||
const u8 *req_ies, size_t req_ies_len);
|
||||
|
||||
int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce);
|
||||
int wpa_auth_resend_m3(struct wpa_state_machine *sm);
|
||||
int wpa_auth_resend_group_m1(struct wpa_state_machine *sm);
|
||||
int wpa_auth_resend_m1(struct wpa_state_machine *sm, int change_anonce,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2);
|
||||
int wpa_auth_resend_m3(struct wpa_state_machine *sm,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2);
|
||||
int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
|
||||
void (*cb)(void *ctx1, void *ctx2),
|
||||
void *ctx1, void *ctx2);
|
||||
|
||||
#endif /* WPA_AUTH_H */
|
||||
|
|
|
@ -143,6 +143,12 @@ struct wpa_state_machine {
|
|||
size_t fils_key_auth_len;
|
||||
unsigned int fils_completed:1;
|
||||
#endif /* CONFIG_FILS */
|
||||
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
void (*eapol_status_cb)(void *ctx1, void *ctx2);
|
||||
void *eapol_status_cb_ctx1;
|
||||
void *eapol_status_cb_ctx2;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue