Code Tweak and Clean Up More DEV Code

Tweaks to when to run LFSR and remove unused code
This commit is contained in:
lwvmobile 2022-06-12 13:10:26 -04:00 committed by GitHub
parent 3f586d9c98
commit c402dfff96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 102 deletions

View File

@ -2096,16 +2096,16 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
//assuming the TLC frame comes on the same slot as the call it was terminating? not sure? //assuming the TLC frame comes on the same slot as the call it was terminating? not sure?
if (state->currentslot == 0) if (state->currentslot == 0)
{ {
state->payload_algid = 0; //state->payload_algid = 0; //try disablign all of these?
state->payload_keyid = 0; //state->payload_keyid = 0;
//state->payload_mfid = 0; //state->payload_mfid = 0;
//state->payload_mi = 0; //let's try disabling this for a bit //state->payload_mi = 0; //let's try disabling this for a bit
} }
if (state->currentslot == 1) if (state->currentslot == 1)
{ {
state->payload_algidR = 0; //state->payload_algidR = 0; //try disablign all of these?
state->payload_keyidR = 0; //state->payload_keyidR = 0;
//state->payload_mfid = 0; //state->payload_mfid = 0;
//state->payload_miR = 0; ////let's try disabling this for a bit //state->payload_miR = 0; ////let's try disabling this for a bit
@ -2582,20 +2582,26 @@ int LFSR(dsd_state * state)
} }
if (state->currentslot == 0) if (state->currentslot == 0)
{ {
fprintf (stderr, "%s", KYEL); if (1 == 1)
fprintf (stderr, "\n Slot 1"); {
fprintf (stderr, " DMR PI Continuation ALG ID: 0x%02X KEY ID: 0x%02X", state->payload_algid, state->payload_keyid); fprintf (stderr, "%s", KYEL);
fprintf(stderr, " Next MI: 0x%08X", lfsr); fprintf (stderr, "\n Slot 1");
fprintf (stderr, "%s", KNRM); fprintf (stderr, " DMR PI Continuation ALG ID: 0x%02X KEY ID: 0x%02X", state->payload_algid, state->payload_keyid);
fprintf(stderr, " Next MI: 0x%08X", lfsr);
fprintf (stderr, "%s", KNRM);
}
state->payload_mi = lfsr; state->payload_mi = lfsr;
} }
else if (state->currentslot == 1) //else
{ {
fprintf (stderr, "%s", KYEL); if (1 == 1)
fprintf (stderr, "\n Slot 2"); {
fprintf (stderr, " DMR PI Continuation ALG ID: 0x%02X KEY ID: 0x%02X", state->payload_algidR, state->payload_keyidR); fprintf (stderr, "%s", KYEL);
fprintf(stderr, " Next MI: 0x%08X", lfsr); fprintf (stderr, "\n Slot 2");
fprintf (stderr, "%s", KNRM); fprintf (stderr, " DMR PI Continuation ALG ID: 0x%02X KEY ID: 0x%02X", state->payload_algidR, state->payload_keyidR);
fprintf(stderr, " Next MI: 0x%08X", lfsr);
fprintf (stderr, "%s", KNRM);
}
state->payload_miR = lfsr; state->payload_miR = lfsr;
} }
} }
@ -2776,89 +2782,4 @@ uint8_t ComputeCrc5Bit(uint8_t * DMRData)
return CRC; return CRC;
} /* End ComputeCrc5Bit() */ } /* End ComputeCrc5Bit() */
/*
* @brief : This function returns the Algorithm ID into an explicit string
*
* @param AlgID : The algorithm ID
* @arg : 0x21 for ARC4
* @arg : 0x22 for DES
* @arg : 0x25 for AES256
*
* @return A constant string pointer that explain the Alg ID used
*/
/*
uint8_t * DmrAlgIdToStr(uint8_t AlgID)
{
if(AlgID == 0x21) return (uint8_t *)"ARC4";
else if(AlgID == 0x25) return (uint8_t *)"AES256";
else return (uint8_t *)"UNKNOWN";
//state->payload_algid = AlgID;
} // End DmrAlgIdToStr
*/
/*
* @brief : This function returns the encryption mode into an explicit string
*
* @param PrivacyMode : The algorithm ID
* @arg : MODE_UNENCRYPTED
* @arg : MODE_BASIC_PRIVACY
* @arg : MODE_ENHANCED_PRIVACY_ARC4
* @arg : MODE_ENHANCED_PRIVACY_DES
* @arg : MODE_ENHANCED_PRIVACY_AES256
* @arg : MODE_HYTERA_BASIC_40_BIT
* @arg : MODE_HYTERA_BASIC_128_BIT
* @arg : MODE_HYTERA_BASIC_256_BIT
*
* @return A constant string pointer that explain the encryption mode used
*/
/*
uint8_t * DmrAlgPrivacyModeToStr(uint32_t PrivacyMode)
{
switch(PrivacyMode)
{
case MODE_UNENCRYPTED:
{
return (uint8_t *)"NOT ENC";
break;
}
case MODE_BASIC_PRIVACY:
{
return (uint8_t *)"BP";
break;
}
case MODE_ENHANCED_PRIVACY_ARC4:
{
return (uint8_t *)"EP ARC4";
break;
}
case MODE_ENHANCED_PRIVACY_AES256:
{
return (uint8_t *)"EP AES256";
break;
}
case MODE_HYTERA_BASIC_40_BIT:
{
return (uint8_t *)"HYTERA BASIC 40 BIT";
break;
}
case MODE_HYTERA_BASIC_128_BIT:
{
return (uint8_t *)"HYTERA BASIC 128 BIT";
break;
}
case MODE_HYTERA_BASIC_256_BIT:
{
return (uint8_t *)"HYTERA BASIC 256 BIT";
break;
}
default:
{
return (uint8_t *)"UNKNOWN";
break;
}
} // End switch(PrivacyMode) /
} //End DmrAlgPrivacyModeToStr() /
*/
/* End of file */ /* End of file */

View File

@ -646,8 +646,8 @@ void processDMRvoice (dsd_opts * opts, dsd_state * state)
ProcessDMR(opts, state); ProcessDMR(opts, state);
//LFSR if required, change condition? //LFSR if required, change condition?
if ( (state->currentslot == 0 && state->payload_algid != 0 && opts->payload == 1) || if ( (state->currentslot == 0 && state->payload_algid != 0 ) || //&& opts->payload == 1
(state->currentslot == 1 && state->payload_algidR != 0 && opts->payload == 1) ) (state->currentslot == 1 && state->payload_algidR != 0 ) ) //&& opts->payload == 1
{ {
LFSR(state); LFSR(state);
} }