DMR TYT AP (PC4) Encryption Mode Support; #302

Above Commit is by Anonymous Submission;
This commit is contained in:
lwvmobile
2025-08-15 11:14:46 -04:00
parent 6ebe3eff58
commit c888dfc1d6
5 changed files with 554 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
#include "dsd.h"
#include "bp.h"
#include "pc4.h"
//NOTE: This set of functions will be reorganized and simplified (hopefully) or at least
//a more logical flow will be established to jive with the new audio handling
@@ -857,6 +858,33 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
unpack_ambe(plain, ambe_d);
}
//DMR TYT AP, Slot 1
if (state->currentslot == 0 && state->tyt_ap == 1)
{
short frame1_cipher[49];
for (int i = 0; i < 49; i++) frame1_cipher[i] = ambe_d[i];
decrypt_frame_49(frame1_cipher);
memset (ambe_d, 0, 49*sizeof(char));
for (int i = 0; i < 49; i++) ambe_d[i] = ctx.bits[i];
}
//DMR TYT AP, Slot 2
if (state->currentslot == 1 && state->tyt_ap == 1)
{
short frame1_cipher[49];
for (int i = 0; i < 49; i++) frame1_cipher[i] = ambe_d[i];
decrypt_frame_49(frame1_cipher);
memset (ambe_d, 0, 49*sizeof(char));
for (int i = 0; i < 49; i++) ambe_d[i] = ctx.bits[i];
}
//P25p2 RC4 Handling, VCH 0
if (state->currentslot == 0 && state->payload_algid == 0xAA && state->R != 0 && ((state->synctype == 35) || (state->synctype == 36)))