undefined4
PeerWpaMessageSanity(undefined4 param_1,int param_2,undefined4 param_3,uint param_4,int param_5)
{
undefined1 uVar1;
bool bVar2;
code *pcVar3;
int iVar4;
char *pcVar5;
char *pcVar6;
undefined1 *puVar7;
undefined4 uVar8;
uint uVar9;
int iVar10;
undefined4 local_a8;
char *local_a4;
undefined4 local_a0;
undefined1 auStack_9c [16];
undefined1 auStack_8c [16];
undefined1 auStack_7c [88];
local_a4 = (char *)0x0;
param_4 = param_4 & 0xff;
os_alloc_mem(0,&local_a4,0xff);
if (local_a4 == (char *)0x0) {
if (RTDebugLevel == 0) {
return 0;
}
pcVar5 = "%s: Allocate memory fail!!!\n";
pcVar3 = printk;
pcVar6 = "PeerWpaMessageSanity";
goto LAB_00043588;
}
memset(auStack_9c,0,0x10) //possible issue identified - semgrep
memset(auStack_7c,0,0x50) //possible issue identified - semgrep
memset(local_a4,0,4) //possible issue identified - semgrep
memset(&local_a8,0,2) //possible issue identified - semgrep
memmove(&local_a8,(void *)(param_2 + 5),2) //possible issue identified - semgrep
iVar10 = *(int *)(param_5 + 0x1e4);
if ((param_4 - 1 & 0xff) < 6) {
if (((param_4 == 1) || (param_4 == 3)) || (param_4 == 5)) {
memset(auStack_8c,0,8) //possible issue identified - semgrep
iVar4 = RTMPCompareMemory(param_2 + 9,param_5 + 0x172,8);
if ((iVar4 == 1) || (iVar4 = RTMPCompareMemory(param_2 + 9,auStack_8c,8), iVar4 == 0)) {
if (param_4 != 1) {
uVar9 = (uint)*(byte *)(param_2 + 2);
goto LAB_00043280;
}
uVar1 = *(undefined1 *)(param_2 + 0x61);
goto LAB_00043428;
}
LAB_000435c0:
RtmpOsSendWirelessEvent
(param_1,0x205,param_5 + 600,*(undefined1 *)(param_5 + 0x31),0,
RtmpDrvSendWirelessEvent);
if (param_4 < 5) {
if (RTDebugLevel != 0) {
pcVar6 = "Replay Counter Different in pairwise msg %d of 4-way handshake!\n";
goto LAB_00043240;
}
}
else if (RTDebugLevel != 0) {
pcVar6 = "Replay Counter Different in group msg %d of 2-way handshake!\n";
param_4 = param_4 - 4;
LAB_00043240:
printk(pcVar6,param_4);
}
hex_dump("Receive replay counter ",param_2 + 9,8);
pcVar6 = "Current replay counter ";
puVar7 = (undefined1 *)(param_5 + 0x172);
uVar8 = 8;
}
else {
if (((param_4 == 2) || (param_4 == 4)) || (param_4 == 6)) {
iVar4 = memcmp((void *)(param_2 + 9),(void *)(param_5 + 0x172),8);
if (iVar4 != 0) goto LAB_000435c0;
uVar9 = (uint)*(byte *)(param_2 + 2);
}
else {
uVar9 = (uint)*(byte *)(param_2 + 2);
}
LAB_00043280:
iVar4 = (uVar9 << 8 | (uint)*(byte *)(param_2 + 3)) + 4;
memmove(auStack_8c,(void *)(param_2 + 0x51),0x10) //possible issue identified - semgrep
memset((void *)(param_2 + 0x51),0,0x10) //possible issue identified - semgrep
if ((local_a8._1_1_ & 7) == 1) {
RT_HMAC_MD5(param_5 + 0x17a,0x10,param_2,iVar4,auStack_9c,0x10);
}
else if ((local_a8._1_1_ & 7) == 2) {
RT_HMAC_SHA1(param_5 + 0x17a,0x10,param_2,iVar4,auStack_7c,0x14);
memmove(auStack_9c,auStack_7c,0x10) //possible issue identified - semgrep
}
iVar4 = memcmp(auStack_8c,auStack_9c,0x10);
if (iVar4 == 0) {
uVar1 = *(undefined1 *)(param_2 + 0x61);
LAB_00043428:
uVar9 = (uint)CONCAT11(uVar1,*(undefined1 *)(param_2 + 0x62));
if (uVar9 == 0) goto LAB_00043558;
bVar2 = iVar10 - 6U < 2;
if (param_4 == 3) {
if (bVar2) goto LAB_0004346c;
LAB_00043514:
memmove(local_a4,(void *)(param_2 + 99),uVar9) //possible issue identified - semgrep
uVar9 = 0;
LAB_0004352c:
uVar1 = *(undefined1 *)(param_2 + 0x62);
}
else {
if (param_4 != 5) {
if (param_4 != 2) goto LAB_00043558;
goto LAB_00043514;
}
LAB_0004346c:
if ((local_a8._1_1_ & 7) == 2) {
local_a0 = 0;
AES_Key_Unwrap(param_2 + 99,
CONCAT11(*(undefined1 *)(param_2 + 0x61),*(undefined1 *)(param_2 + 0x62))
,param_5 + 0x18a,0x10,local_a4,&local_a0);
*(char *)(param_2 + 0x61) = (char)((uint)local_a0 >> 8);
*(char *)(param_2 + 0x62) = (char)local_a0;
}
else {
TKIP_GTK_KEY_UNWRAP(param_5 + 0x18a,param_2 + 0x31,param_2 + 99,uVar9,local_a4);
}
uVar9 = 0;
if (bVar2) goto LAB_0004352c;
if (param_4 == 5) {
uVar9 = (uint)(local_a8 << 0x12) >> 0x1e;
goto LAB_0004352c;
}
uVar1 = *(undefined1 *)(param_2 + 0x62);
}
iVar10 = RTMPParseEapolKeyData(param_1,local_a4,uVar1,uVar9,param_4,bVar2,param_5);
if (iVar10 != 0) {
LAB_00043558:
if (local_a4 != (char *)0x0) {
os_free_mem(0);
return 1;
}
return 1;
}
goto LAB_00043578;
}
RtmpOsSendWirelessEvent
(param_1,0x207,param_5 + 600,*(undefined1 *)(param_5 + 0x31),0,
RtmpDrvSendWirelessEvent);
if (param_4 < 5) {
if (RTDebugLevel != 0) {
pcVar6 = "MIC Different in pairwise msg %d of 4-way handshake!\n";
LAB_000433dc:
printk(pcVar6,param_4);
}
}
else if (RTDebugLevel != 0) {
pcVar6 = "MIC Different in group msg %d of 2-way handshake!\n";
param_4 = param_4 - 4;
goto LAB_000433dc;
}
hex_dump("Received MIC",auStack_8c,0x10);
pcVar6 = "Desired MIC";
puVar7 = auStack_9c;
uVar8 = 0x10;
}
hex_dump(pcVar6,puVar7,uVar8);
}
else if (RTDebugLevel != 0) {
printk("The message type is invalid(%d)! \n",param_4);
}
LAB_00043578:
if (local_a4 == (char *)0x0) {
return 0;
}
pcVar5 = (char *)0x0;
pcVar3 = os_free_mem;
pcVar6 = local_a4;
LAB_00043588:
(*pcVar3)(pcVar5,pcVar6);
return 0;
}