]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS NFC: New style connection handover select from AP/Registrar
authorJouni Malinen <jouni@qca.qualcomm.com>
Sat, 27 Apr 2013 13:58:56 +0000 (16:58 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:10:55 +0000 (21:10 +0200)
The contents of the WPS connection handover select message was modified
to include the Registrar public key hash instead of the credential.

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

src/ap/wps_hostapd.c

index 713218c73c6e1d6feaa49f4f2c35e50477ca9863..c306ad158d7c9b38114c7885f8c4521095d305df 100644 (file)
@@ -1800,11 +1800,41 @@ struct wpabuf * hostapd_wps_nfc_config_token(struct hostapd_data *hapd,
 
 struct wpabuf * hostapd_wps_nfc_hs_cr(struct hostapd_data *hapd, int ndef)
 {
-       /*
-        * Handover Select carrier record for WPS uses the same format as
-        * configuration token.
-        */
-       return hostapd_wps_nfc_config_token(hapd, ndef);
+       struct wpabuf *ret;
+
+       if (hapd->wps == NULL)
+               return NULL;
+
+       if (hapd->conf->wps_nfc_dh_pubkey == NULL) {
+               struct wps_context *wps = hapd->wps;
+               if (wps_nfc_gen_dh(&hapd->conf->wps_nfc_dh_pubkey,
+                                  &hapd->conf->wps_nfc_dh_privkey) < 0)
+                       return NULL;
+               hostapd_wps_nfc_clear(wps);
+               wps->ap_nfc_dev_pw_id = DEV_PW_NFC_CONNECTION_HANDOVER;
+               wps->ap_nfc_dh_pubkey =
+                       wpabuf_dup(hapd->conf->wps_nfc_dh_pubkey);
+               wps->ap_nfc_dh_privkey =
+                       wpabuf_dup(hapd->conf->wps_nfc_dh_privkey);
+               if (!wps->ap_nfc_dh_pubkey || !wps->ap_nfc_dh_privkey) {
+                       hostapd_wps_nfc_clear(wps);
+                       return NULL;
+               }
+       }
+
+       ret = wps_build_nfc_handover_sel(hapd->wps,
+                                        hapd->conf->wps_nfc_dh_pubkey);
+
+       if (ndef && ret) {
+               struct wpabuf *tmp;
+               tmp = ndef_build_wifi(ret);
+               wpabuf_free(ret);
+               if (tmp == NULL)
+                       return NULL;
+               ret = tmp;
+       }
+
+       return ret;
 }