P25: Clear Stale Keys when using the Keyloader and a CC Return is initiated via LCW or Logic on END_PTT;

This commit is contained in:
lwvmobile
2025-09-11 23:19:16 -04:00
parent 3aabd85604
commit b0a46a541d
2 changed files with 61 additions and 0 deletions

View File

@@ -310,6 +310,18 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
if (opts->p25_trunk == 1 && state->p25_cc_freq != 0 && opts->p25_is_tuned == 1)
{
//clear stale keys if loaded
if (state->keyloader == 1)
{
state->R = 0;
state->A1[0] = 0;
state->A2[0] = 0;
state->A3[0] = 0;
state->A4[0] = 0;
state->aes_key_loaded[0] = 0;
// state->H = 0; //shim for above (this apply here?)
}
//Will we need to check for a symbolrate change here, can a P25p2 TDMA-CC system
//revert back to a phase 1 traffic channel or carry a phase 1 traffic channel?
if (state->p25_cc_is_tdma == 1)

View File

@@ -317,6 +317,18 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
if (opts->floating_point == 1)
state->aout_gain = opts->audio_gain;
//clear stale keys if loaded
if (state->keyloader == 1)
{
state->R = 0;
state->A1[0] = 0;
state->A2[0] = 0;
state->A3[0] = 0;
state->A4[0] = 0;
state->aes_key_loaded[0] = 0;
// state->H = 0; //shim for above (this apply here?)
}
}
if (state->currentslot == 0)
{
@@ -346,6 +358,18 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180]
if (opts->floating_point == 1)
state->aout_gainR = opts->audio_gain;
//clear stale keys if loaded
if (state->keyloader == 1)
{
state->RR = 0;
state->A1[1] = 0;
state->A2[1] = 0;
state->A3[1] = 0;
state->A4[1] = 0;
state->aes_key_loaded[1] = 0;
// state->H = 0; //shim for above (this apply here?)
}
}
//Return to CC on MAC_END_PTT if other slot is idle
@@ -760,6 +784,18 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
if (opts->floating_point == 1)
state->aout_gain = opts->audio_gain; //reset
//clear stale keys if loaded
if (state->keyloader == 1)
{
state->R = 0;
state->A1[0] = 0;
state->A2[0] = 0;
state->A3[0] = 0;
state->A4[0] = 0;
state->aes_key_loaded[0] = 0;
// state->H = 0; //shim for above (this apply here?)
}
}
if (state->currentslot == 1)
{
@@ -785,6 +821,19 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156]
//reset gain
if (opts->floating_point == 1)
state->aout_gainR = opts->audio_gain;
//clear stale keys if loaded
if (state->keyloader == 1)
{
state->RR = 0;
state->A1[1] = 0;
state->A2[1] = 0;
state->A3[1] = 0;
state->A4[1] = 0;
state->aes_key_loaded[1] = 0;
// state->H = 0; //shim for above (this apply here?)
}
}
//Return to CC on MAC_END_PTT if other slot is idle