Congratulations for clicking this link, you are now reading this description;

Add DES-OFB Decryption Support for P25, NXDN, DMR (Tested);

Add DES-XL Decryption Support for P25p1 (Tested);

Add AES-OFB Decryption Support for P25, DMR (Tested); NXDN(untested);

Add P25p1 PDU Decryption Support; (Untested)(Known Modes);

Add Remaining (AES, DES) DMR PDU Decryption Support (Known DMRA Modes)(Untested);

Decrypt Tytera 16-bit BP (works depending on model);

Add AES Keys example csv file for import;

Probably a few bugs that'll need to be massaged out now with all the code additions for several years of stashed code;
This commit is contained in:
lwvmobile
2025-03-14 23:54:58 -04:00
parent 9f59729fb1
commit eac360571e
28 changed files with 3752 additions and 197 deletions

View File

@@ -93,13 +93,21 @@ void playSynthesizedVoiceFS3 (dsd_opts * opts, dsd_state * state)
encL = 0;
}
}
else if (state->payload_algid == 0x21)
else if (state->payload_algid == 0x21 || state->payload_algid == 0x22)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x24 || state->payload_algid == 0x25)
{
//going to need a better check for this later on, or seperated keys or something
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
if (encR)
@@ -111,15 +119,27 @@ void playSynthesizedVoiceFS3 (dsd_opts * opts, dsd_state * state)
encR = 0;
}
}
else if (state->payload_algidR == 0x21)
else if (state->payload_algidR == 0x21 || state->payload_algidR == 0x22)
{
if (state->RR != 0)
{
encR = 0;
}
}
else if (state->payload_algidR == 0x24 || state->payload_algidR == 0x25)
{
//going to need a better check for this later on, or seperated keys or something
if (state->aes_key_loaded[1] == 1)
{
encR = 0;
}
}
}
//debug disable enc check for AES testing
// encL = 0;
// encR = 0;
//TODO: add option to bypass enc with a toggle as well
//CHEAT: Using the slot on/off, use that to set encL or encR back on
@@ -312,6 +332,20 @@ void playSynthesizedVoiceFS4 (dsd_opts * opts, dsd_state * state)
encL = 0;
}
}
else if (state->payload_algid == 0x81)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x84 || state->payload_algid == 0x89)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
if (encR)
@@ -323,6 +357,20 @@ void playSynthesizedVoiceFS4 (dsd_opts * opts, dsd_state * state)
encR = 0;
}
}
else if (state->payload_algidR == 0x81)
{
if (state->R != 0)
{
encR = 0;
}
}
else if (state->payload_algidR == 0x84 || state->payload_algidR == 0x89)
{
if (state->aes_key_loaded[1] == 1)
{
encR = 0;
}
}
}
//CHEAT: Using the slot on/off, use that to set encL or encR back on
@@ -520,13 +568,20 @@ void playSynthesizedVoiceFS (dsd_opts * opts, dsd_state * state)
//checkdown to see if we can lift the 'mute' if a key is available
if (encL)
{
if (state->payload_algid == 0xAA)
if (state->payload_algid == 0xAA || state->payload_algid == 0x81 || state->payload_algid == 0x9F)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x84 || state->payload_algid == 0x89 || state->payload_algid == 0x83)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
//TODO: add option to bypass enc with a toggle as well
@@ -654,13 +709,20 @@ void playSynthesizedVoiceFM (dsd_opts * opts, dsd_state * state)
//checkdown to see if we can lift the 'mute' if a key is available
if (encL)
{
if (state->payload_algid == 0xAA || state->nxdn_cipher_type == 0x1)
if (state->payload_algid == 0xAA || state->payload_algid == 0x81 || state->payload_algid == 0x83 || state->payload_algid == 0x9F || state->nxdn_cipher_type == 0x1 || state->nxdn_cipher_type == 0x2)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x84 || state->payload_algid == 0x89 || state->nxdn_cipher_type == 0x3)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
//WIP: Mute if on B list (or not W list)
@@ -870,13 +932,20 @@ void playSynthesizedVoiceSS (dsd_opts * opts, dsd_state * state)
//checkdown to see if we can lift the 'mute' if a key is available
if (encL)
{
if (state->payload_algid == 0xAA)
if (state->payload_algid == 0xAA || state->payload_algid == 0x81 || state->payload_algid == 0x9F || state->payload_algid == 0x83)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x84 || state->payload_algid == 0x89)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
//TODO: add option to bypass enc with a toggle as well
@@ -993,7 +1062,7 @@ void playSynthesizedVoiceSS3 (dsd_opts * opts, dsd_state * state)
encL = (state->dmr_so >> 6) & 0x1;
encR = (state->dmr_soR >> 6) & 0x1;
//checkdown to see if we can lift the 'mute' if a key is available
//checkdown to see if we can lift the 'mute' if a key is available
if (encL)
{
if (state->payload_algid == 0)
@@ -1003,13 +1072,21 @@ void playSynthesizedVoiceSS3 (dsd_opts * opts, dsd_state * state)
encL = 0;
}
}
else if (state->payload_algid == 0x21)
else if (state->payload_algid == 0x21 || state->payload_algid == 0x22)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x24 || state->payload_algid == 0x25)
{
//going to need a better check for this later on, or seperated keys or something
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
if (encR)
@@ -1021,15 +1098,26 @@ void playSynthesizedVoiceSS3 (dsd_opts * opts, dsd_state * state)
encR = 0;
}
}
else if (state->payload_algidR == 0x21)
else if (state->payload_algidR == 0x21 || state->payload_algidR == 0x22)
{
if (state->RR != 0)
{
encR = 0;
}
}
else if (state->payload_algidR == 0x24 || state->payload_algidR == 0x25)
{
//going to need a better check for this later on, or seperated keys or something
if (state->aes_key_loaded[1] == 1)
{
encR = 0;
}
}
}
//debug for AES
// encL = encR = 0;
//TODO: add option to bypass enc with a toggle as well
//CHEAT: Using the slot on/off, use that to set encL or encR back on
@@ -1342,6 +1430,20 @@ void playSynthesizedVoiceSS4 (dsd_opts * opts, dsd_state * state)
encL = 0;
}
}
else if (state->payload_algid == 0x81)
{
if (state->R != 0)
{
encL = 0;
}
}
else if (state->payload_algid == 0x84 || state->payload_algid == 0x89)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
if (encR)
@@ -1353,6 +1455,20 @@ void playSynthesizedVoiceSS4 (dsd_opts * opts, dsd_state * state)
encR = 0;
}
}
else if (state->payload_algidR == 0x81)
{
if (state->R != 0)
{
encR = 0;
}
}
else if (state->payload_algidR == 0x84 || state->payload_algidR == 0x89)
{
if (state->aes_key_loaded[1] == 1)
{
encR = 0;
}
}
}
@@ -1552,26 +1668,52 @@ void playSynthesizedVoiceSS18 (dsd_opts * opts, dsd_state * state)
//checkdown to see if we can lift the 'mute' if a key is available
if (encL)
{
if (state->payload_algid == 0xAA)
//RC4 or DES
if (state->payload_algid == 0xAA || state->payload_algid == 0x81)
{
if (state->R != 0)
{
encL = 0;
}
}
//AES
if (state->payload_algid == 0x84 || state->payload_algid == 0x89)
{
if (state->aes_key_loaded[0] == 1)
{
encL = 0;
}
}
}
if (encR)
{
if (state->payload_algidR == 0xAA)
//RC4 or DES
if (state->payload_algidR == 0xAA || state->payload_algidR == 0x81)
{
if (state->RR != 0)
{
encR = 0;
}
}
//AES
if (state->payload_algidR == 0x84 || state->payload_algidR == 0x89)
{
if (state->aes_key_loaded[1] == 1)
{
encR = 0;
}
}
}
//debug, unmute both slots
// encL = 0;
// encR = 0;
//WIP: Mute if on B list (or not W list)
char modeL[8];
sprintf (modeL, "%s", "");