void PeerPairMsg4Action(int param_1,int *param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  int iVar5;
  uint uVar6;
  undefined1 auStack_88 [4];
  undefined1 auStack_84 [8];
  undefined1 auStack_7c [6];
  undefined1 auStack_76 [6];
  undefined1 local_70;
  undefined1 local_6f;
  undefined1 local_6e;
  undefined1 local_6d;
  undefined1 local_6c;
  undefined1 local_6b;
  
  if (2 < RTDebugLevel) {
    printk("===> PeerPairMsg4Action\n");
  }
  if ((((param_2 != (int *)0x0) && (*param_2 == 1)) && (0x82 < *(uint *)(param_3 + 0x648))) &&
     ((8 < *(byte *)(param_2 + 0x7c) &&
      ((uint)*(byte *)((int)param_2 + 0x31) < (uint)*(byte *)(param_1 + 0x51aa))))) {
    uVar6 = *(uint *)((uint)*(byte *)((int)param_2 + 0x31) * 0x1140 + param_1 + 0x51e4);
    iVar1 = PeerWpaMessageSanity(param_1,param_3 + 0x20,*(uint *)(param_3 + 0x648) - 0x20,4,param_2)
    ;
    if (iVar1 != 0) {
      WPAInstallPairwiseKey(param_1,*(undefined1 *)((int)param_2 + 0x31),param_2,1);
      *(undefined2 *)((int)param_2 + 0x1f2) = 1;
      *(undefined1 *)(param_2 + 0x7c) = 10;
      param_2[0x7d] = 0;
      if (param_2[0x79] - 6U < 2) {
        *(undefined1 *)((int)param_2 + 0x1f1) = 1;
        RTMPCancelTimer(param_2 + 0x6f,auStack_88);
        if (param_2[0x79] == 6) {
          memmove(auStack_84,"PMK Name",8)   //possible issue identified - semgrep
          memmove(auStack_7c,
                  (void *)((uint)*(byte *)((int)param_2 + 0x31) * 0x1140 + param_1 + 0x51ac),6)   //possible issue identified - semgrep
          memmove(auStack_76,param_2 + 0x96,6)   //possible issue identified - semgrep
          RT_HMAC_SHA1((uint)*(byte *)((int)param_2 + 0x31) * 0x1140 + param_1 + 0x5275,0x20,
                       auStack_84,0x14,&local_70,0x14);
          RTMPAddPMKIDCache(param_1,(uint)*(byte *)((int)param_2 + 0x31),param_2 + 0x96,&local_70,
                            (uint)*(byte *)((int)param_2 + 0x31) * 0x1140 + param_1 + 0x5275);
          if (2 < RTDebugLevel) {
            printk("Calc PMKID=%02x:%02x:%02x:%02x:%02x:%02x\n",local_70,local_6f,local_6e,local_6d,
                   local_6c,local_6b);
          }
        }
        RtmpOsSendWirelessEvent
                  (param_1,0x20e,param_2 + 0x96,*(undefined1 *)((int)param_2 + 0x31),0,
                   RtmpDrvSendWirelessEvent);
        iVar5 = param_2[0x79];
        uVar2 = GetAuthMode((int)(char)iVar5);
        iVar1 = param_2[0x7a];
        uVar3 = GetEncryptType((int)(char)iVar1);
        uVar4 = GetEncryptType((int)(char)uVar6);
        printk("AP SETKEYS DONE - WPA2, AuthMode(%d)=%s, WepStatus(%d)=%s, GroupWepStatus(%d)=%s\n\n"
               ,iVar5,uVar2,iVar1,uVar3,uVar6 & 0xff,uVar4);
      }
      else {
        WPAStart2WayGroupHS(param_1,param_2);
        *(undefined1 *)((int)param_2 + 0x1ba) = 0x14;
        RTMPModTimer(param_2 + 0x6f,3000);
      }
    }
  }
  return;
}