diff --git a/src/p25_lcw.c b/src/p25_lcw.c index 1ddea2f..ff8856d 100644 --- a/src/p25_lcw.c +++ b/src/p25_lcw.c @@ -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) diff --git a/src/p25p2_xcch.c b/src/p25p2_xcch.c index ff9cabb..a6e5c61 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -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