mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
P25-P2 Encryption Synchronization ReSync (#1792)
* resync ess processor on PTT, END_PTT, HANGTIME, or IDLE * Re-order of AbstractVoiceTimeslot. Voice2 should be processed first, as any accumulated ESS information applies to the following Voice slots * Update P25 MBE recorders to include synchronized encryption information --------- Co-authored-by: Sawyer, Caleb (US) - ISR <Caleb.Sawyer@L3Harris.com>
This commit is contained in:
@@ -25,6 +25,9 @@ import io.github.dsheirer.audio.codec.mbe.MBECallSequenceRecorder;
|
||||
import io.github.dsheirer.bits.BinaryMessage;
|
||||
import io.github.dsheirer.message.IMessage;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.P25Message;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.hdu.HDUMessage;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.hdu.HeaderData;
|
||||
import io.github.dsheirer.identifier.encryption.EncryptionKeyIdentifier;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.lc.LinkControlWord;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.LCMotorolaPatchGroupVoiceChannelUpdate;
|
||||
import io.github.dsheirer.module.decode.p25.phase1.message.lc.motorola.LCMotorolaPatchGroupVoiceChannelUser;
|
||||
@@ -124,6 +127,10 @@ public class P25P1CallSequenceRecorder extends MBECallSequenceRecorder
|
||||
{
|
||||
flush();
|
||||
}
|
||||
else if (message instanceof HDUMessage)
|
||||
{
|
||||
process((HDUMessage)message);
|
||||
}
|
||||
}
|
||||
|
||||
private void process(TDULinkControlMessage tdulc)
|
||||
@@ -228,4 +235,21 @@ public class P25P1CallSequenceRecorder extends MBECallSequenceRecorder
|
||||
mCallSequence.setEncryptionSyncParameters(parameters);
|
||||
}
|
||||
}
|
||||
|
||||
private void process(HDUMessage hduMessage)
|
||||
{
|
||||
if(mCallSequence == null)
|
||||
{
|
||||
mCallSequence = new MBECallSequence(PROTOCOL);
|
||||
}
|
||||
|
||||
HeaderData hd = hduMessage.getHeaderData();
|
||||
|
||||
if (hd.isEncryptedAudio())
|
||||
{
|
||||
mCallSequence.setEncrypted(true);
|
||||
Phase2EncryptionSyncParameters esp = new Phase2EncryptionSyncParameters((EncryptionKeyIdentifier)hd.getEncryptionKey(), hd.getMessageIndicator());
|
||||
mCallSequence.setEncryptionSyncParameters(esp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import io.github.dsheirer.audio.codec.mbe.MBECallSequence;
|
||||
import io.github.dsheirer.audio.codec.mbe.MBECallSequenceRecorder;
|
||||
import io.github.dsheirer.bits.BinaryMessage;
|
||||
import io.github.dsheirer.message.IMessage;
|
||||
import io.github.dsheirer.module.decode.p25.phase2.message.EncryptionSynchronizationSequence;
|
||||
import io.github.dsheirer.module.decode.p25.phase2.message.P25P2Message;
|
||||
import io.github.dsheirer.module.decode.p25.phase2.message.mac.MacMessage;
|
||||
import io.github.dsheirer.module.decode.p25.phase2.message.mac.MacStructure;
|
||||
@@ -153,6 +154,10 @@ public class P25P2CallSequenceRecorder extends MBECallSequenceRecorder
|
||||
{
|
||||
process((MacMessage)message);
|
||||
}
|
||||
else if (message instanceof EncryptionSynchronizationSequence)
|
||||
{
|
||||
processEss((EncryptionSynchronizationSequence)message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,5 +387,18 @@ public class P25P2CallSequenceRecorder extends MBECallSequenceRecorder
|
||||
mLog.warn("Expected push-to-talk structure but found: " + mac.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
private void processEss(EncryptionSynchronizationSequence ess)
|
||||
{
|
||||
if(mCallSequence == null)
|
||||
{
|
||||
mCallSequence = new MBECallSequence(PROTOCOL);
|
||||
}
|
||||
if (ess.isEncrypted())
|
||||
{
|
||||
mCallSequence.setEncrypted(true);
|
||||
mCallSequence.setEncryptionSyncParameters(ess);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,11 +101,30 @@ public class P25P2MessageProcessor implements Listener<IMessage>
|
||||
mFrequencyBandMap.put(bandIdentifier.getIdentifier(), bandIdentifier);
|
||||
}
|
||||
|
||||
switch(macMessage.getMacPduType())
|
||||
{
|
||||
case MAC_1_PTT:
|
||||
case MAC_2_END_PTT:
|
||||
case MAC_6_HANGTIME:
|
||||
case MAC_3_IDLE:
|
||||
if (timeslot.getTimeslot() == 0)
|
||||
{
|
||||
mESSProcessor0.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
mESSProcessor1.reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
mMessageListener.receive(macMessage);
|
||||
}
|
||||
}
|
||||
else if(timeslot instanceof AbstractVoiceTimeslot)
|
||||
{
|
||||
mMessageListener.receive(timeslot);
|
||||
|
||||
if(timeslot.getTimeslot() == 0)
|
||||
{
|
||||
mESSProcessor0.process((AbstractVoiceTimeslot)timeslot);
|
||||
@@ -139,8 +158,6 @@ public class P25P2MessageProcessor implements Listener<IMessage>
|
||||
}
|
||||
}
|
||||
|
||||
mMessageListener.receive(timeslot);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user