]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS NFC: Update DH keys for ER operations
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 11 Jul 2013 13:33:05 +0000 (16:33 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:44:30 +0000 (21:44 +0200)
Since wpa_s->conf->wps_nfc_dh_* parameters can be set in number of code
paths, update the wps_context copy of the DH keys even if no new keys
were generated for the request. This tries to avoid some cases where
public key hash may not have matched the public key used in the ER
operation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/wps_supplicant.c

index 02e33382f1a2f1c24a3b9f865ccd3ea25e5680a2..aaf563f59b8d9c1cad430ec77bfac500295d19c6 100644 (file)
@@ -2337,8 +2337,9 @@ wpas_wps_er_nfc_handover_sel(struct wpa_supplicant *wpa_s, int ndef,
        struct wpabuf *ret;
        u8 u[UUID_LEN], *use_uuid = NULL;
        u8 addr[ETH_ALEN], *use_addr = NULL;
+       struct wps_context *wps = wpa_s->wps;
 
-       if (wpa_s->wps == NULL)
+       if (wps == NULL)
                return NULL;
 
        if (uuid == NULL)
@@ -2351,21 +2352,18 @@ wpas_wps_er_nfc_handover_sel(struct wpa_supplicant *wpa_s, int ndef,
                return NULL;
 
        if (wpa_s->conf->wps_nfc_dh_pubkey == NULL) {
-               struct wps_context *wps = wpa_s->wps;
                if (wps_nfc_gen_dh(&wpa_s->conf->wps_nfc_dh_pubkey,
                                   &wpa_s->conf->wps_nfc_dh_privkey) < 0)
                        return NULL;
+       }
 
+       wpas_wps_nfc_clear(wps);
+       wps->ap_nfc_dev_pw_id = DEV_PW_NFC_CONNECTION_HANDOVER;
+       wps->ap_nfc_dh_pubkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey);
+       wps->ap_nfc_dh_privkey = wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey);
+       if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey) {
                wpas_wps_nfc_clear(wps);
-               wps->ap_nfc_dev_pw_id = DEV_PW_NFC_CONNECTION_HANDOVER;
-               wps->ap_nfc_dh_pubkey =
-                       wpabuf_dup(wpa_s->conf->wps_nfc_dh_pubkey);
-               wps->ap_nfc_dh_privkey =
-                       wpabuf_dup(wpa_s->conf->wps_nfc_dh_privkey);
-               if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey) {
-                       wpas_wps_nfc_clear(wps);
-                       return NULL;
-               }
+               return NULL;
        }
 
        ret = wps_er_nfc_handover_sel(wpa_s->wps_er, wpa_s->wps, use_uuid,