Fix RC4 'Pop' on DMR when VC6 is Null; Fix Align;

This commit is contained in:
lwvmobile 2023-06-17 17:29:03 -04:00
parent 15a12acfd3
commit b6a12b6ceb
2 changed files with 784 additions and 772 deletions

View File

@ -1606,7 +1606,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
if ((opts->errorbars == 1) && (opts->verbose > 1) && (state->carrier == 1))
{
fprintf (stderr,"Sync: no sync\n");
fprintf (stderr,"Press CTRL + C to close.\n");
// fprintf (stderr,"Press CTRL + C to close.\n");
}
noCarrier (opts, state);

View File

@ -17,16 +17,17 @@
#include "dsd.h"
//test for potential clashing with other key loading mechanisms (bp key loading on tgid, nxdn key loading, etc)
//NOTE: I attempted to fix the atrocious tab/space alignnment issues that happened in this file,
//it looks fine in VSCodium, but no telling how it will translate when pushed to Github or another editor
void keyring(dsd_opts * opts, dsd_state * state)
{
//keys now loaded from csv files with the -K key.csv file (capital K)
if (state->currentslot == 0)
state->R = state->rkey_array[state->payload_keyid];
if (state->currentslot == 1)
state->RR = state->rkey_array[state->payload_keyidR];
}
void RC4(int drop, uint8_t keylength, uint8_t messagelength, uint8_t key[], uint8_t cipher[], uint8_t plain[])
@ -132,9 +133,7 @@ void playMbeFiles (dsd_opts * opts, dsd_state * state, int argc, char **argv)
if (opts->audio_out == 1)
{
playSynthesizedVoice (opts, state);
}
}
else if (state->mbe_file_type > 0) //ambe files
@ -572,7 +571,14 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
cipher[o] = b;
}
//only run keystream application if errs < 3 -- this is a fix to the pop sound
//that may occur on some systems that preempt VC6 voice for a RC opportuninity (TXI)
//this occurs because we are supposed to either have a a 'repeat' frame, or 'silent' frame play
//due to the error, but the keystream application makes it random 'pfft pop' sound instead
if (state->errs < 3)
RC4(state->dropL, 9, 7, rckey, cipher, plain);
else memcpy (plain, cipher, sizeof(plain));
state->dropL += 7;
short z = 0;
@ -851,7 +857,13 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
cipher[o] = b;
}
//only run keystream application if errs < 3 -- this is a fix to the pop sound
//that may occur on some systems that preempt VC6 voice for a RC opportuninity (TXI)
//this occurs because we are supposed to either have a a 'repeat' frame, or 'silent' frame play
//due to the error, but the keystream application makes it random 'pfft pop' sound instead
if (state->errsR < 3)
RC4(state->dropR, 9, 7, rckey, cipher, plain);
else memcpy (plain, cipher, sizeof(plain));
state->dropR += 7;
short z = 0;