Skip to content

Instantly share code, notes, and snippets.

@teekennedy
Last active September 26, 2015 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teekennedy/384348407d9a1fe10c1b to your computer and use it in GitHub Desktop.
Save teekennedy/384348407d9a1fe10c1b to your computer and use it in GitHub Desktop.
Reaver Patch for Wii U
diff --git a/src/wps/wps_common.c b/src/wps/wps_common.c
index 6ef14db..d4880ee 100755
--- a/src/wps/wps_common.c
+++ b/src/wps/wps_common.c
@@ -66,6 +66,7 @@ int wps_derive_keys(struct wps_data *wps)
{
struct wpabuf *pubkey, *dh_shared;
u8 dhkey[SHA256_MAC_LEN], kdk[SHA256_MAC_LEN];
+ u8 kdk_rot[sizeof(kdk)];
const u8 *addr[3];
size_t len[3];
u8 keys[WPS_AUTHKEY_LEN + WPS_KEYWRAPKEY_LEN + WPS_EMSK_LEN];
@@ -113,7 +114,9 @@ int wps_derive_keys(struct wps_data *wps)
hmac_sha256_vector(dhkey, sizeof(dhkey), 3, addr, len, kdk);
wpa_hexdump_key(MSG_DEBUG, "WPS: KDK", kdk, sizeof(kdk));
- wps_kdf(kdk, NULL, 0, "Wi-Fi Easy and Secure Key Derivation",
+ os_memcpy(kdk_rot, kdk + 3, sizeof(kdk) - 3);
+ os_memcpy(kdk_rot + sizeof(kdk) - 3, kdk, 3);
+ wps_kdf(kdk_rot, NULL, 0, "Wi-Fi Easy and Secure Key Derivation",
keys, sizeof(keys));
os_memcpy(wps->authkey, keys, WPS_AUTHKEY_LEN);
os_memcpy(wps->keywrapkey, keys + WPS_AUTHKEY_LEN, WPS_KEYWRAPKEY_LEN);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment