mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-16 10:47:21 -05:00
Fix Some Tab Alignment Issues;
NXDN: Make seperate AES IV expansion function;
This commit is contained in:
@@ -47,43 +47,43 @@ void rc4_voice_decrypt(int drop, uint8_t keylength, uint8_t messagelength, uint8
|
||||
//this is for PDU usage
|
||||
void rc4_block_output (int drop, int keylen, int meslen, uint8_t * key, uint8_t * output_blocks)
|
||||
{
|
||||
int i, j, x, count;
|
||||
unsigned int keylength = (unsigned int)keylen;
|
||||
int i, j, x, count;
|
||||
unsigned int keylength = (unsigned int)keylen;
|
||||
unsigned int messagelength = (unsigned int)meslen;
|
||||
unsigned int S[256];
|
||||
unsigned int S[256];
|
||||
|
||||
for(i=0; i<256; i++)
|
||||
S[i] = i;
|
||||
for(i=0; i<256; i++)
|
||||
S[i] = i;
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i<256; i++)
|
||||
{
|
||||
j = (j + S[i] + key[i % keylength]) % 256;
|
||||
unsigned int temp = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = temp;
|
||||
}
|
||||
j = 0;
|
||||
for(i = 0; i<256; i++)
|
||||
{
|
||||
j = (j + S[i] + key[i % keylength]) % 256;
|
||||
unsigned int temp = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = temp;
|
||||
}
|
||||
|
||||
//Generate Keystream
|
||||
i = 0;
|
||||
j = 0;
|
||||
//Generate Keystream
|
||||
i = 0;
|
||||
j = 0;
|
||||
x = 0;
|
||||
unsigned int byte;
|
||||
unsigned int byte;
|
||||
|
||||
// fprintf (stderr, " Keystream Octets = ");
|
||||
for(count = 0; count < (messagelength + drop); count++)
|
||||
{
|
||||
i = (i + 1) % 256;
|
||||
j = (j + S[i]) % 256;
|
||||
unsigned int temp = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = temp;
|
||||
byte = S[(S[i] + S[j]) % 256];
|
||||
// fprintf (stderr, " Keystream Octets = ");
|
||||
for(count = 0; count < (messagelength + drop); count++)
|
||||
{
|
||||
i = (i + 1) % 256;
|
||||
j = (j + S[i]) % 256;
|
||||
unsigned int temp = S[i];
|
||||
S[i] = S[j];
|
||||
S[j] = temp;
|
||||
byte = S[(S[i] + S[j]) % 256];
|
||||
|
||||
//Collect Output blocks
|
||||
if (count >= drop)
|
||||
//Collect Output blocks
|
||||
if (count >= drop)
|
||||
output_blocks[x++] = byte;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user