shithub: riscv

Download patch

ref: b6581f21e59e0a9575a46166dd7d95136fb4340e
parent: 6f374a524359173c87c046940853bf5d38444696
author: cinap_lenrek <[email protected]>
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)){