From: Jouni Malinen Date: Thu, 11 Jul 2013 13:33:05 +0000 (+0300) Subject: WPS NFC: Update DH keys for ER operations X-Git-Tag: hostap_2_1~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4b4d7fe3c8792b05199f16bb3dc78036d3a20fe;p=thirdparty%2Fhostap.git WPS NFC: Update DH keys for ER operations 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 --- diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 02e33382f..aaf563f59 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -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,