git: 9front

Download patch

ref: fd83a7d1829e1fca461bde207b5b14b6d9b8ed81
parent: ae442b9d3008de0e1a54218ed553c139e5d405ad
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sat Mar 9 13:12:49 EST 2013

aux/wpa: check reply counter only after mic check

--- a/sys/src/cmd/aux/wpa.c
+++ b/sys/src/cmd/aux/wpa.c
@@ -368,18 +368,6 @@
 			(uvlong)kd->rsc[4]<<32 |
 			(uvlong)kd->rsc[5]<<40;
 
-		repc =	(uvlong)kd->repc[7] |
-			(uvlong)kd->repc[6]<<8 |
-			(uvlong)kd->repc[5]<<16 |
-			(uvlong)kd->repc[4]<<24 |
-			(uvlong)kd->repc[3]<<32 |
-			(uvlong)kd->repc[2]<<40 |
-			(uvlong)kd->repc[1]<<48 |
-			(uvlong)kd->repc[0]<<56;
-
-		if(repc <= lastrepc)
-			continue;
-
 		if((flags & Fmic) == 0){
 			if((flags & (Fptk|Fack)) != (Fptk|Fack))
 				continue;
@@ -404,6 +392,16 @@
 			if(memcmp(tmp, mic, sizeof(mic)) != 0)
 				continue;
 
+			repc =	(uvlong)kd->repc[7] |
+				(uvlong)kd->repc[6]<<8 |
+				(uvlong)kd->repc[5]<<16 |
+				(uvlong)kd->repc[4]<<24 |
+				(uvlong)kd->repc[3]<<32 |
+				(uvlong)kd->repc[2]<<40 |
+				(uvlong)kd->repc[1]<<48 |
+				(uvlong)kd->repc[0]<<56;
+			if(repc <= lastrepc)
+				continue;
 			lastrepc = repc;
 
 			if((flags & (Fptk|Fsec|Fack)) == (Fptk|Fack)){
--