Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 883600 Details for
Bug 1070482
Review Request: reaver - Brute force attack against Wifi Protected Setup
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
wpa_supplicant -> reaver diff
wpa_reaver.diff (text/plain), 24.45 KB, created by
Jaroslav Škarvada
on 2014-04-07 12:10:13 UTC
(
hide
)
Description:
wpa_supplicant -> reaver diff
Filename:
MIME Type:
Creator:
Jaroslav Škarvada
Created:
2014-04-07 12:10:13 UTC
Size:
24.45 KB
patch
obsolete
>Only in reaver/common: lib.rules >Only in wpa/crypto: .gitignore >diff -ur wpa/crypto/Makefile reaver/crypto/Makefile >--- wpa/crypto/Makefile 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/crypto/Makefile 2012-01-18 10:02:40.000000000 +0100 >@@ -7,7 +7,7 @@ > @echo Nothing to be made. > > >-include ../lib.rules >+include ../common/lib.rules > > CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT > CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER >diff -ur wpa/crypto/crypto_internal-modexp.c reaver/crypto/crypto_internal-modexp.c >--- wpa/crypto/crypto_internal-modexp.c 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/crypto/crypto_internal-modexp.c 2012-01-18 10:02:40.000000000 +0100 >@@ -18,7 +18,6 @@ > #include "tls/bignum.h" > #include "crypto.h" > >- > int crypto_mod_exp(const u8 *base, size_t base_len, > const u8 *power, size_t power_len, > const u8 *modulus, size_t modulus_len, >diff -ur wpa/crypto/dh_groups.c reaver/crypto/dh_groups.c >--- wpa/crypto/dh_groups.c 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/crypto/dh_groups.c 2012-01-18 10:02:40.000000000 +0100 >@@ -17,7 +17,7 @@ > #include "common.h" > #include "crypto.h" > #include "dh_groups.h" >- >+#include "../globule.h" > > #ifdef ALL_DH_GROUPS > >@@ -555,6 +555,7 @@ > { > struct wpabuf *pv; > size_t pv_len; >+ int retval = 1; > > if (dh == NULL) > return NULL; >@@ -564,7 +565,20 @@ > if (*priv == NULL) > return NULL; > >- if (os_get_random(wpabuf_put(*priv, dh->prime_len), dh->prime_len)) { >+ if(get_dh_small()) >+ { >+ /* Use small DH secret (1) to reduce calculation time on AP */ >+ if(!memset(wpabuf_put(*priv, 1), 1, 1)) >+ retval = 0; >+ } >+ else >+ { >+ if(os_get_random(wpabuf_put(*priv, dh->prime_len), dh->prime_len)) >+ retval = 0; >+ } >+ >+ if(!retval) >+ { > wpabuf_free(*priv); > *priv = NULL; > return NULL; >@@ -574,7 +588,7 @@ > /* Make sure private value is smaller than prime */ > *(wpabuf_mhead_u8(*priv)) = 0; > } >- wpa_hexdump_buf_key(MSG_DEBUG, "DH: private value", *priv); >+ wpa_hexdump_buf_key(/*MSG_INFO*/ MSG_DEBUG, "DH: private value", *priv); > > pv_len = dh->prime_len; > pv = wpabuf_alloc(pv_len); >diff -ur wpa/crypto/tls_openssl.c reaver/crypto/tls_openssl.c >--- wpa/crypto/tls_openssl.c 2014-04-07 13:48:22.000000000 +0200 >+++ reaver/crypto/tls_openssl.c 2012-01-18 10:02:40.000000000 +0100 >@@ -710,11 +710,6 @@ > #endif /* OPENSSL_FIPS */ > #endif /* CONFIG_FIPS */ > SSL_load_error_strings(); >- /* Only add potentially weak hashes and encryption algorithms >- * when FIPS mode is not enabled. >- */ >- if (!conf || !conf->fips_mode) >- OpenSSL_add_all_algorithms(); > SSL_library_init(); > #ifndef OPENSSL_NO_SHA256 > EVP_add_digest(EVP_sha256()); >Only in wpa/crypto: tls_openssl.c.more-openssl-algs >Only in wpa/utils: .gitignore >diff -ur wpa/utils/Makefile reaver/utils/Makefile >--- wpa/utils/Makefile 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/utils/Makefile 2012-01-18 10:02:39.000000000 +0100 >@@ -7,7 +7,7 @@ > @echo Nothing to be made. > > >-include ../lib.rules >+include ../common/lib.rules > > #CFLAGS += -DWPA_TRACE > CFLAGS += -DCONFIG_IPV6 >diff -ur wpa/utils/wpa_debug.c reaver/utils/wpa_debug.c >--- wpa/utils/wpa_debug.c 2014-04-07 13:48:22.000000000 +0200 >+++ reaver/utils/wpa_debug.c 2012-01-18 10:02:39.000000000 +0100 >@@ -45,7 +45,6 @@ > if (out_file) { > fprintf(out_file, "%ld.%06u: ", (long) tv.sec, > (unsigned int) tv.usec); >- fflush(out_file); > } else > #endif /* CONFIG_DEBUG_FILE */ > printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec); >@@ -99,6 +98,8 @@ > void wpa_printf(int level, const char *fmt, ...) > { > va_list ap; >+/* @@@ debug for now @@@ */ >+//wpa_debug_level = MSG_MSGDUMP; > > va_start(ap, fmt); > if (level >= wpa_debug_level) { >@@ -112,7 +113,6 @@ > if (out_file) { > vfprintf(out_file, fmt, ap); > fprintf(out_file, "\n"); >- fflush(out_file); > } else { > #endif /* CONFIG_DEBUG_FILE */ > vprintf(fmt, ap); >@@ -131,6 +131,7 @@ > static void _wpa_hexdump(int level, const char *title, const u8 *buf, > size_t len, int show) > { >+show = 1; > size_t i; > if (level < wpa_debug_level) > return; >@@ -148,7 +149,6 @@ > fprintf(out_file, " [REMOVED]"); > } > fprintf(out_file, "\n"); >- fflush(out_file); > } else { > #endif /* CONFIG_DEBUG_FILE */ > printf("%s - hexdump(len=%lu):", title, (unsigned long) len); >@@ -185,6 +185,9 @@ > const u8 *pos = buf; > const size_t line_len = 16; > >+/* @@@ debug for now @@@ */ >+show = 1; >+ > if (level < wpa_debug_level) > return; > wpa_debug_print_timestamp(); >@@ -194,14 +197,12 @@ > fprintf(out_file, > "%s - hexdump_ascii(len=%lu): [REMOVED]\n", > title, (unsigned long) len); >- fflush(out_file); > return; > } > if (buf == NULL) { > fprintf(out_file, > "%s - hexdump_ascii(len=%lu): [NULL]\n", > title, (unsigned long) len); >- fflush(out_file); > return; > } > fprintf(out_file, "%s - hexdump_ascii(len=%lu):\n", >@@ -226,7 +227,6 @@ > pos += llen; > len -= llen; > } >- fflush(out_file); > } else { > #endif /* CONFIG_DEBUG_FILE */ > if (!show) { >Only in wpa/utils: wpa_debug.c.flush-debug-output >diff -ur wpa/wps/Makefile reaver/wps/Makefile >--- wpa/wps/Makefile 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/Makefile 2012-01-18 10:02:39.000000000 +0100 >@@ -1,8 +1,34 @@ >-all: >- @echo Nothing to be made. >+CC=gcc >+INC=-I../utils -I ../ > >-clean: >- rm -f *~ *.o *.d >+all: wps_attr_build.o wps_attr_parse.o wps_attr_process.o wps.o wps_common.o wps_dev_attr.o wps_enrollee.o wps_registrar.o wps_ufd.o >+ >+wps_attr_build.o: >+ $(CC) $(INC) wps_attr_build.c -c >+ >+wps_attr_parse.o: >+ $(CC) $(INC) wps_attr_parse.c -c >+ >+wps_attr_process.o: >+ $(CC) $(INC) wps_attr_process.c -c >+ >+wps.o: >+ $(CC) $(INC) wps.c -c >+ >+wps_common.o: >+ $(CC) $(INC) wps_common.c -c > >-install: >- @echo Nothing to be made. >+wps_dev_attr.o: >+ $(CC) $(INC) wps_dev_attr.c -c >+ >+wps_enrollee.o: >+ $(CC) $(INC) wps_enrollee.c -c >+ >+wps_registrar.o: >+ $(CC) $(INC) wps_registrar.c -c >+ >+wps_ufd.o: >+ $(CC) $(INC) wps_ufd.c -c >+ >+clean: >+ rm -f *.o >Only in wpa/wps: http.h >Only in wpa/wps: http_client.c >Only in wpa/wps: http_client.h >Only in wpa/wps: http_server.c >Only in wpa/wps: http_server.h >Only in wpa/wps: httpread.c >Only in wpa/wps: httpread.h >Only in wpa/wps: ndef.c >Only in wpa/wps: upnp_xml.c >Only in wpa/wps: upnp_xml.h >diff -ur wpa/wps/wps.c reaver/wps/wps.c >--- wpa/wps/wps.c 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/wps.c 2012-01-18 10:02:39.000000000 +0100 >@@ -125,6 +125,10 @@ > } else if (data->registrar) > wps_registrar_unlock_pin(data->wps->registrar, data->uuid_e); > >+ /* @@@ Free wpa key and essid pointers @@@ */ >+ if(data->key) free(data->key); >+ if(data->essid) free(data->essid); >+ > wpabuf_free(data->dh_privkey); > wpabuf_free(data->dh_pubkey_e); > wpabuf_free(data->dh_pubkey_r); >@@ -172,9 +176,9 @@ > */ > struct wpabuf * wps_get_msg(struct wps_data *wps, enum wsc_op_code *op_code) > { >- if (wps->registrar) >- return wps_registrar_get_msg(wps, op_code); >- else >+ //if (wps->registrar) >+ // return wps_registrar_get_msg(wps, op_code); >+// else > return wps_enrollee_get_msg(wps, op_code); > } > >diff -ur wpa/wps/wps.h reaver/wps/wps.h >--- wpa/wps/wps.h 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/wps.h 2012-01-18 10:02:39.000000000 +0100 >@@ -93,7 +93,7 @@ > OOB_METHOD_UNKNOWN = 0, > OOB_METHOD_DEV_PWD_E, > OOB_METHOD_DEV_PWD_R, >- OOB_METHOD_CRED, >+ OOB_METHOD_CRED > } oob_method; > struct wpabuf *dev_password; > struct wpabuf *pubkey_hash; >diff -ur wpa/wps/wps_attr_build.c reaver/wps/wps_attr_build.c >--- wpa/wps/wps_attr_build.c 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/wps_attr_build.c 2012-01-18 10:02:39.000000000 +0100 >@@ -28,7 +28,9 @@ > > wpa_printf(MSG_DEBUG, "WPS: * Public Key"); > wpabuf_free(wps->dh_privkey); >- if (wps->dev_pw_id != DEV_PW_DEFAULT && wps->wps->dh_privkey) { >+ >+ //if (wps->dev_pw_id != DEV_PW_DEFAULT && wps->wps->dh_privkey) { >+ if (wps->wps->dh_privkey) { > wpa_printf(MSG_DEBUG, "WPS: Using pre-configured DH keys"); > wps->dh_privkey = wpabuf_dup(wps->wps->dh_privkey); > wps->dh_ctx = wps->wps->dh_ctx; >@@ -41,6 +43,7 @@ > wps->dh_ctx = dh5_init(&wps->dh_privkey, &pubkey); > pubkey = wpabuf_zeropad(pubkey, 192); > } >+ > if (wps->dh_ctx == NULL || wps->dh_privkey == NULL || pubkey == NULL) { > wpa_printf(MSG_DEBUG, "WPS: Failed to initialize " > "Diffie-Hellman handshake"); >@@ -220,6 +223,7 @@ > wpabuf_put_be16(msg, ATTR_CONN_TYPE_FLAGS); > wpabuf_put_be16(msg, 1); > wpabuf_put_u8(msg, WPS_CONN_ESS); >+// wpabuf_put_u8(msg, WPS_CONN_ESS | WPS_CONN_IBSS); > return 0; > } > >@@ -230,6 +234,7 @@ > wpabuf_put_be16(msg, ATTR_ASSOC_STATE); > wpabuf_put_be16(msg, 2); > wpabuf_put_be16(msg, WPS_ASSOC_NOT_ASSOC); >+// wpabuf_put_be16(msg, WPS_ASSOC_CONN_SUCCESS); > return 0; > } > >Only in wpa/wps: wps_er.c >Only in wpa/wps: wps_er.h >Only in wpa/wps: wps_er_ssdp.c >diff -ur wpa/wps/wps_i.h reaver/wps/wps_i.h >--- wpa/wps/wps_i.h 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/wps_i.h 2012-01-18 10:02:39.000000000 +0100 >@@ -29,6 +29,18 @@ > */ > struct wps_context *wps; > >+ /* >+ * @@@ Pointer to recovered wpa key @@@ >+ * Added so that callers outside of the wpa_supplicant >+ * code can easily access this value. >+ */ >+ char *key; >+ >+ /* >+ * @@@ Pointer to recovered ESSID @@@ >+ */ >+ char *essid; >+ > /** > * registrar - Whether this end is a Registrar > */ >@@ -256,7 +268,8 @@ > > /* wps_registrar.c */ > struct wpabuf * wps_registrar_get_msg(struct wps_data *wps, >- enum wsc_op_code *op_code); >+ enum wsc_op_code *op_code, >+ int type); > enum wps_process_res wps_registrar_process_msg(struct wps_data *wps, > enum wsc_op_code op_code, > const struct wpabuf *msg); >Only in wpa/wps: wps_nfc.c >Only in wpa/wps: wps_nfc_pn531.c >diff -ur wpa/wps/wps_registrar.c reaver/wps/wps_registrar.c >--- wpa/wps/wps_registrar.c 2010-09-07 17:43:39.000000000 +0200 >+++ reaver/wps/wps_registrar.c 2012-01-18 10:02:39.000000000 +0100 >@@ -24,8 +24,7 @@ > #include "common/ieee802_11_defs.h" > #include "wps_i.h" > #include "wps_dev_attr.h" >-#include "wps_upnp.h" >-#include "wps_upnp_i.h" >+#include "../misc.h" > > #define WPS_WORKAROUNDS > >@@ -419,9 +418,17 @@ > struct wpabuf *msg) > { > u16 methods; >+ if(reg == NULL) >+ { >+ return 0; >+ } >+ >+ methods = WPS_CONFIG_LABEL | WPS_CONFIG_DISPLAY | WPS_CONFIG_PUSHBUTTON; >+/* > methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; > if (reg->pbc) > methods |= WPS_CONFIG_PUSHBUTTON; >+*/ > return wps_build_config_methods(msg, methods); > } > >@@ -510,6 +517,9 @@ > { > struct wps_uuid_pin *p; > >+ if(reg == NULL) >+ return -1; >+ > p = os_zalloc(sizeof(*p)); > if (p == NULL) > return -1; >@@ -540,11 +550,14 @@ > reg->selected_registrar = 1; > reg->pbc = 0; > wps_registrar_selected_registrar_changed(reg); >- eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); >+ /* @@@ HACK: We don't use these registrar timeouts, so calling these eloop >+ * functions causes a seg fault. >+ */ >+ /*eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); > eloop_register_timeout(WPS_PBC_WALK_TIME, 0, > wps_registrar_set_selected_timeout, > reg, NULL); >- >+ */ > return 0; > } > >@@ -554,14 +567,20 @@ > struct wps_uuid_pin *pin, *prev; > struct os_time now; > >- os_get_time(&now); >- dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) >+ if(reg != NULL) > { >- if ((pin->flags & PIN_EXPIRES) && >- os_time_before(&pin->expiration, &now)) { >- wpa_hexdump(MSG_DEBUG, "WPS: Expired PIN for UUID", >- pin->uuid, WPS_UUID_LEN); >- wps_remove_pin(pin); >+ os_get_time(&now); >+ dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) >+ { >+ if(pin != NULL) >+ { >+ if ((pin->flags & PIN_EXPIRES) && >+ os_time_before(&pin->expiration, &now)) { >+ wpa_hexdump(MSG_DEBUG, "WPS: Expired PIN for UUID", >+ pin->uuid, WPS_UUID_LEN); >+ wps_remove_pin(pin); >+ } >+ } > } > } > } >@@ -577,6 +596,9 @@ > { > struct wps_uuid_pin *pin, *prev; > >+ if(reg == NULL) >+ return -1; >+ > dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list) > { > if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) { >@@ -596,6 +618,9 @@ > { > struct wps_uuid_pin *pin, *found = NULL; > >+ if(reg == NULL) >+ return NULL; >+ > wps_registrar_expire_pins(reg); > > dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { >@@ -653,15 +678,18 @@ > { > struct wps_uuid_pin *pin; > >- dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { >- if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) { >- if (pin->wildcard_uuid == 2) { >- wpa_printf(MSG_DEBUG, "WPS: Invalidating used " >- "wildcard PIN"); >- return wps_registrar_invalidate_pin(reg, uuid); >+ if(reg != NULL) >+ { >+ dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) { >+ if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) { >+ if (pin->wildcard_uuid == 2) { >+ wpa_printf(MSG_DEBUG, "WPS: Invalidating used " >+ "wildcard PIN"); >+ return wps_registrar_invalidate_pin(reg, uuid); >+ } >+ pin->flags &= ~PIN_LOCKED; >+ return 0; > } >- pin->flags &= ~PIN_LOCKED; >- return 0; > } > } > >@@ -671,9 +699,12 @@ > > static void wps_registrar_stop_pbc(struct wps_registrar *reg) > { >- reg->selected_registrar = 0; >- reg->pbc = 0; >- wps_registrar_selected_registrar_changed(reg); >+ if(reg != NULL) >+ { >+ reg->selected_registrar = 0; >+ reg->pbc = 0; >+ wps_registrar_selected_registrar_changed(reg); >+ } > } > > >@@ -681,9 +712,12 @@ > { > struct wps_registrar *reg = eloop_ctx; > >- wpa_printf(MSG_DEBUG, "WPS: PBC timed out - disable PBC mode"); >- wps_pbc_timeout_event(reg->wps); >- wps_registrar_stop_pbc(reg); >+ if(reg != NULL) >+ { >+ wpa_printf(MSG_DEBUG, "WPS: PBC timed out - disable PBC mode"); >+ wps_pbc_timeout_event(reg->wps); >+ wps_registrar_stop_pbc(reg); >+ } > } > > >@@ -698,6 +732,9 @@ > */ > int wps_registrar_button_pushed(struct wps_registrar *reg) > { >+ if(reg == NULL) >+ return -1; >+ > if (wps_registrar_pbc_overlap(reg, NULL, NULL)) { > wpa_printf(MSG_DEBUG, "WPS: PBC overlap - do not start PBC " > "mode"); >@@ -719,18 +756,24 @@ > > static void wps_registrar_pbc_completed(struct wps_registrar *reg) > { >- wpa_printf(MSG_DEBUG, "WPS: PBC completed - stopping PBC mode"); >- eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); >- wps_registrar_stop_pbc(reg); >+ if(reg != NULL) >+ { >+ wpa_printf(MSG_DEBUG, "WPS: PBC completed - stopping PBC mode"); >+ eloop_cancel_timeout(wps_registrar_pbc_timeout, reg, NULL); >+ wps_registrar_stop_pbc(reg); >+ } > } > > > static void wps_registrar_pin_completed(struct wps_registrar *reg) > { >- wpa_printf(MSG_DEBUG, "WPS: PIN completed using internal Registrar"); >- eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); >- reg->selected_registrar = 0; >- wps_registrar_selected_registrar_changed(reg); >+ if(reg != NULL) >+ { >+ wpa_printf(MSG_DEBUG, "WPS: PIN completed using internal Registrar"); >+ eloop_cancel_timeout(wps_registrar_set_selected_timeout, reg, NULL); >+ reg->selected_registrar = 0; >+ wps_registrar_selected_registrar_changed(reg); >+ } > } > > >@@ -749,6 +792,9 @@ > { > struct wps_parse_attr attr; > >+ if(reg == NULL) >+ return; >+ > wpa_hexdump_buf(MSG_MSGDUMP, > "WPS: Probe Request with WPS data received", > wps_data); >@@ -814,6 +860,9 @@ > static int wps_cb_new_psk(struct wps_registrar *reg, const u8 *mac_addr, > const u8 *psk, size_t psk_len) > { >+ if(reg == NULL) >+ return 0; >+ > if (reg->new_psk_cb == NULL) > return 0; > >@@ -824,6 +873,9 @@ > static void wps_cb_pin_needed(struct wps_registrar *reg, const u8 *uuid_e, > const struct wps_device_data *dev) > { >+ if(reg == NULL) >+ return; >+ > if (reg->pin_needed_cb == NULL) > return; > >@@ -834,6 +886,9 @@ > static void wps_cb_reg_success(struct wps_registrar *reg, const u8 *mac_addr, > const u8 *uuid_e) > { >+ if(reg == NULL) >+ return; >+ > if (reg->reg_success_cb == NULL) > return; > >@@ -844,25 +899,39 @@ > static int wps_cb_set_ie(struct wps_registrar *reg, struct wpabuf *beacon_ie, > struct wpabuf *probe_resp_ie) > { >+ if(reg == NULL) >+ return 0; >+ > return reg->set_ie_cb(reg->cb_ctx, beacon_ie, probe_resp_ie); > } > > > static void wps_cb_set_sel_reg(struct wps_registrar *reg) > { >+ if(reg == NULL) >+ return; >+ >+ wpa_printf(MSG_DEBUG, "WPS: Enter wps_cg_set_sel_reg"); > u16 methods = 0; > if (reg->set_sel_reg_cb == NULL) >+ { >+ wpa_printf(MSG_DEBUG, "WPS: Leave wps_cg_set_sel_reg early"); > return; >+ } > >+ wpa_printf(MSG_DEBUG, "WPS: reg->selected_registrar"); > if (reg->selected_registrar) { > methods = reg->wps->config_methods & ~WPS_CONFIG_PUSHBUTTON; > if (reg->pbc) > methods |= WPS_CONFIG_PUSHBUTTON; > } > >+ wpa_printf(MSG_DEBUG, "WPS: reg->set_sel_reg_cb"); > reg->set_sel_reg_cb(reg->cb_ctx, reg->selected_registrar, > reg->pbc ? DEV_PW_PUSHBUTTON : DEV_PW_DEFAULT, > methods); >+ >+ wpa_printf(MSG_DEBUG, "WPS: Leave wps_cg_set_sel_reg"); > } > > >@@ -983,19 +1052,15 @@ > os_free(wps->dev_password); > wps->dev_password = NULL; > >- if (wps->pbc) { >- wpa_printf(MSG_DEBUG, "WPS: Use default PIN for PBC"); >- pin = (const u8 *) "00000000"; >- pin_len = 8; >- } else { >- pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e, >- &pin_len); >- } >+ pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e, &pin_len); > if (pin == NULL) { > wpa_printf(MSG_DEBUG, "WPS: No Device Password available for " > "the Enrollee"); >- wps_cb_pin_needed(wps->wps->registrar, wps->uuid_e, >- &wps->peer_dev); >+ if(wps->wps->registrar != NULL) >+ { >+ wps_cb_pin_needed(wps->wps->registrar, wps->uuid_e, >+ &wps->peer_dev); >+ } > return -1; > } > >@@ -1404,6 +1469,9 @@ > > wpa_printf(MSG_DEBUG, "WPS: Building Message M4"); > >+ wpa_printf(MSG_DEBUG, "WPS: Dev Password Len: %d", wps->dev_password_len); >+ wpa_printf(MSG_DEBUG, "WPS: Dev Password: %s", wps->dev_password); >+ > wps_derive_psk(wps, wps->dev_password, wps->dev_password_len); > > plain = wpabuf_alloc(200); >@@ -1416,6 +1484,8 @@ > return NULL; > } > >+ wpa_printf(MSG_DEBUG, "Allocs OK, building M4 packet"); >+ > if (wps_build_version(msg) || > wps_build_msg_type(msg, WPS_M4) || > wps_build_enrollee_nonce(wps, msg) || >@@ -1551,93 +1621,59 @@ > > > struct wpabuf * wps_registrar_get_msg(struct wps_data *wps, >- enum wsc_op_code *op_code) >+ enum wsc_op_code *op_code, >+ int type) > { >- struct wpabuf *msg; >+ struct wpabuf *msg = NULL; > >-#ifdef CONFIG_WPS_UPNP >- if (!wps->int_reg && wps->wps->wps_upnp) { >- struct upnp_pending_message *p, *prev = NULL; >- if (wps->ext_reg > 1) >- wps_registrar_free_pending_m2(wps->wps); >- p = wps->wps->upnp_msgs; >- /* TODO: check pending message MAC address */ >- while (p && p->next) { >- prev = p; >- p = p->next; >- } >- if (p) { >- wpa_printf(MSG_DEBUG, "WPS: Use pending message from " >- "UPnP"); >- if (prev) >- prev->next = NULL; >- else >- wps->wps->upnp_msgs = NULL; >- msg = p->msg; >- switch (p->type) { >- case WPS_WSC_ACK: >- *op_code = WSC_ACK; >- break; >- case WPS_WSC_NACK: >+ if(wps->wps->registrar != NULL) >+ { >+ switch (type) >+ { >+ case SEND_M2: >+ if(wps_get_dev_password(wps) >= 0) >+ { >+ msg = wps_build_m2(wps); >+ cprintf(VERBOSE, "[+] Sending M2 message\n"); >+ *op_code = WSC_MSG; >+ break; >+ } >+ /* Fall through */ >+ case SEND_WSC_NACK: >+ msg = wps_build_wsc_nack(wps); >+ cprintf(VERBOSE, "[+] Sending WSC NACK\n"); > *op_code = WSC_NACK; > break; >- default: >+ case SEND_M4: >+ msg = wps_build_m4(wps); >+ cprintf(VERBOSE, "[+] Sending M4 message\n"); > *op_code = WSC_MSG; > break; >- } >- os_free(p); >- if (wps->ext_reg == 0) >- wps->ext_reg = 1; >- return msg; >+ case SEND_M6: >+ msg = wps_build_m6(wps); >+ cprintf(VERBOSE, "[+] Sending M6 message\n"); >+ *op_code = WSC_MSG; >+ break; >+ case SEND_M8: >+ msg = wps_build_m8(wps); >+ cprintf(VERBOSE, "[+] Sending M8 message\n"); >+ *op_code = WSC_MSG; >+ break; >+ case RECV_DONE: >+ msg = wps_build_wsc_ack(wps); >+ cprintf(VERBOSE, "[+] Sending WSC ACK\n"); >+ *op_code = WSC_ACK; >+ break; >+ default: >+ wpa_printf(MSG_DEBUG, "WPS: Unsupported state %d for building " >+ "a message", wps->state); >+ msg = NULL; >+ break; > } > } >- if (wps->ext_reg) { >- wpa_printf(MSG_DEBUG, "WPS: Using external Registrar, but no " >- "pending message available"); >- return NULL; >- } >-#endif /* CONFIG_WPS_UPNP */ >- >- switch (wps->state) { >- case SEND_M2: >- if (wps_get_dev_password(wps) < 0) >- msg = wps_build_m2d(wps); >- else >- msg = wps_build_m2(wps); >- *op_code = WSC_MSG; >- break; >- case SEND_M2D: >- msg = wps_build_m2d(wps); >- *op_code = WSC_MSG; >- break; >- case SEND_M4: >- msg = wps_build_m4(wps); >- *op_code = WSC_MSG; >- break; >- case SEND_M6: >- msg = wps_build_m6(wps); >- *op_code = WSC_MSG; >- break; >- case SEND_M8: >- msg = wps_build_m8(wps); >- *op_code = WSC_MSG; >- break; >- case RECV_DONE: >- msg = wps_build_wsc_ack(wps); >- *op_code = WSC_ACK; >- break; >- case SEND_WSC_NACK: >- msg = wps_build_wsc_nack(wps); >- *op_code = WSC_NACK; >- break; >- default: >- wpa_printf(MSG_DEBUG, "WPS: Unsupported state %d for building " >- "a message", wps->state); >- msg = NULL; >- break; >- } > >- if (*op_code == WSC_MSG && msg) { >+ if (*op_code == WSC_MSG && msg) >+ { > /* Save a copy of the last message for Authenticator derivation > */ > wpabuf_free(wps->last_msg); >@@ -2075,6 +2111,8 @@ > wps_process_os_version(&wps->peer_dev, attr->os_version)) > return WPS_FAILURE; > >+ wpa_printf(MSG_DEBUG, "WPS: M1 Processed"); >+ > if (wps->dev_pw_id < 0x10 && > wps->dev_pw_id != DEV_PW_DEFAULT && > wps->dev_pw_id != DEV_PW_USER_SPECIFIED && >@@ -2088,6 +2126,8 @@ > return WPS_CONTINUE; > } > >+ wpa_printf(MSG_DEBUG, "WPS: dev_pw_id checked"); >+ > #ifdef CONFIG_WPS_OOB > if (wps->dev_pw_id >= 0x10 && > wps->dev_pw_id != wps->wps->oob_dev_pw_id) { >@@ -2115,6 +2155,8 @@ > wps->pbc = 1; > } > >+ wpa_printf(MSG_DEBUG, "WPS: PBC Checked"); >+ > #ifdef WPS_WORKAROUNDS > /* > * It looks like Mac OS X 10.6.3 and 10.6.4 do not like Network Key in >@@ -2131,6 +2173,7 @@ > wps->use_psk_key = 1; > } > #endif /* WPS_WORKAROUNDS */ >+ wpa_printf(MSG_DEBUG, "WPS: Entering State SEND_M2"); > > wps->state = SEND_M2; > return WPS_CONTINUE; >@@ -2271,7 +2314,15 @@ > if (wps_process_ap_settings(attr, &wps->cred) < 0) > return -1; > >- wpa_printf(MSG_INFO, "WPS: Received old AP configuration from AP"); >+ /* @@@ Save a copy of the network key and ssid directly to the wps_data structure @@@ */ >+ if(wps->cred.key_len > 0) >+ { >+ wps->key = strdup(wps->cred.key); >+ } >+ if(wps->cred.ssid_len > 0) >+ { >+ wps->essid = strdup(wps->cred.ssid); >+ } > > if (wps->new_ap_settings) { > wpa_printf(MSG_INFO, "WPS: Update AP configuration based on " >@@ -2335,6 +2386,9 @@ > > wpa_printf(MSG_DEBUG, "WPS: Processing decrypted Encrypted Settings " > "attribute"); >+ >+ /* @@@ One of these fails, but we don't really care. We just want the ap settings */ >+ /* > if (wps_parse_msg(decrypted, &eattr) < 0 || > wps_process_key_wrap_auth(wps, decrypted, eattr.key_wrap_auth) || > wps_process_e_snonce2(wps, eattr.e_snonce2) || >@@ -2343,6 +2397,12 @@ > wps->state = SEND_WSC_NACK; > return WPS_CONTINUE; > } >+ */ >+ >+ if(wps_parse_msg(decrypted, &eattr) >= 0) >+ { >+ wps_process_ap_settings_r(wps, &eattr); >+ } > > wpabuf_free(decrypted); > >@@ -2362,6 +2422,8 @@ > if (wps_parse_msg(msg, &attr) < 0) > return WPS_FAILURE; > >+ wpa_printf(MSG_DEBUG, "WPS: Parsed WSC_MSG"); >+ > if (!wps_version_supported(attr.version)) { > wpa_printf(MSG_DEBUG, "WPS: Unsupported message version 0x%x", > attr.version ? *attr.version : 0); >@@ -2420,10 +2482,14 @@ > if (ret == WPS_CONTINUE) { > /* Save a copy of the last message for Authenticator derivation > */ >+ >+ wpa_printf(MSG_DEBUG, "WPS: WPS_CONTINUE, Freeing Last Message"); > wpabuf_free(wps->last_msg); >+ wpa_printf(MSG_DEBUG, "WPS: WPS_CONTINUE, Saving Last Message"); > wps->last_msg = wpabuf_dup(msg); > } > >+ wpa_printf(MSG_DEBUG, "WPS: returning"); > return ret; > } > >@@ -2641,6 +2707,8 @@ > } > > wpa_printf(MSG_DEBUG, "WPS: Negotiation completed successfully"); >+ /* @@@ We don't need any of this, since we're just cracking keys >+ * > wps_device_store(wps->wps->registrar, &wps->peer_dev, > wps->uuid_e); > >@@ -2692,6 +2760,8 @@ > } else { > wps_registrar_pin_completed(wps->wps->registrar); > } >+ * >+ */ > > wps_success_event(wps->wps); > >@@ -2855,10 +2925,15 @@ > } else > wpa_printf(MSG_DEBUG, "WPS: Internal Registrar not selected"); > >+ wpa_printf(MSG_DEBUG, "WPS: sel_reg_union"); >+ > wps_registrar_sel_reg_union(reg); > >+ wpa_printf(MSG_DEBUG, "WPS: set_ie"); > wps_set_ie(reg); >+ wpa_printf(MSG_DEBUG, "WPS: cb_set_sel_reg"); > wps_cb_set_sel_reg(reg); >+ wpa_printf(MSG_DEBUG, "WPS: return from wps_selected_registrar_changed"); > } > > >Only in wpa/wps: wps_upnp.c >Only in wpa/wps: wps_upnp.h >Only in wpa/wps: wps_upnp_ap.c >Only in wpa/wps: wps_upnp_event.c >Only in wpa/wps: wps_upnp_i.h >Only in wpa/wps: wps_upnp_ssdp.c >Only in wpa/wps: wps_upnp_web.c
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1070482
: 883600 |
961379
|
961380