]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Optimize M2 processing in AP Setup Locked case
authorJouni Malinen <j@w1.fi>
Tue, 24 Aug 2010 13:42:26 +0000 (16:42 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 24 Aug 2010 13:42:26 +0000 (16:42 +0300)
There is no need to process the public key and generate keys if
the AP is going to reject this M2 anyway. This limits effect of
potential CPU DoS attacks in cases where AP PIN is disabled.

src/wps/wps_enrollee.c

index 68bc802b2f248dbe48262327fae0d89019ae7042..dff24d491cee16f67b5624c902334df5d6afbdf8 100644 (file)
@@ -774,10 +774,7 @@ static enum wps_process_res wps_process_m2(struct wps_data *wps,
 
        if (wps_process_registrar_nonce(wps, attr->registrar_nonce) ||
            wps_process_enrollee_nonce(wps, attr->enrollee_nonce) ||
-           wps_process_uuid_r(wps, attr->uuid_r) ||
-           wps_process_pubkey(wps, attr->public_key, attr->public_key_len) ||
-           wps_process_authenticator(wps, attr->authenticator, msg) ||
-           wps_process_device_attrs(&wps->peer_dev, attr)) {
+           wps_process_uuid_r(wps, attr->uuid_r)) {
                wps->state = SEND_WSC_NACK;
                return WPS_CONTINUE;
        }
@@ -791,6 +788,13 @@ static enum wps_process_res wps_process_m2(struct wps_data *wps,
                return WPS_CONTINUE;
        }
 
+       if (wps_process_pubkey(wps, attr->public_key, attr->public_key_len) ||
+           wps_process_authenticator(wps, attr->authenticator, msg) ||
+           wps_process_device_attrs(&wps->peer_dev, attr)) {
+               wps->state = SEND_WSC_NACK;
+               return WPS_CONTINUE;
+       }
+
        wps->state = SEND_M3;
        return WPS_CONTINUE;
 }