public unsafe override PacketMainReturn interiorMain(ref Packet in_packet) { lock (padlock) { if (theirMac == null) { return(null); } EthPacket e = (EthPacket)in_packet; if ((e.Proto[0] & 0x01) == 0x01 && (CompareMac(theirMac, e.FromMac) && CompareMac(myMac, e.ToMac) || (CompareMac(theirMac, e.ToMac) && CompareMac(myMac, e.FromMac)))) { INTERMEDIATE_BUFFER *IB = e.IB; rc4.SetKeyState(key); INTERMEDIATE_BUFFER *iba = (INTERMEDIATE_BUFFER *)Marshal.AllocHGlobal(Marshal.SizeOf(new INTERMEDIATE_BUFFER())); iba->m_dwDeviceFlags = IB->m_dwDeviceFlags; iba->m_Flags = IB->m_Flags; iba->m_Length = IB->m_Length; iba->m_qLink = IB->m_qLink; for (int x = 12; x < IB->m_Length; x++) { iba->m_IBuffer[x] = (byte)(IB->m_IBuffer[x] ^ rc4.Next()); } EthPacket nPacket = new EthPacket(iba); nPacket.FromMac = e.FromMac; nPacket.ToMac = e.ToMac; nPacket.Proto = new byte[2]; nPacket.Proto[0] = (byte)(0xFE & e.Proto[0]); nPacket.Proto[1] = e.Proto[1]; adapter.ProcessPacket(nPacket); return(new PacketMainReturn("SimpleMacEncryption") { returnType = PacketMainReturnType.Drop }); } } return(null); }