mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-21 13:15:40 -05:00
DMR: Auctus / GoComm Encryption Support w/ Forced Application; #346
Use -, Secure04 to use this mode;
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
Build Version: AW 2026-30-g43d63b2
|
Build Version: AW 2026-36-g5e5c3c4
|
||||||
MBElib Version: 1.3.4
|
MBElib Version: 1.3.4
|
||||||
CODEC2 Support Enabled
|
CODEC2 Support Enabled
|
||||||
|
|
||||||
@@ -175,6 +175,9 @@ Advanced Decoder options:
|
|||||||
|
|
||||||
-A <hex> Manually Enter and Enforce Anytone 16-bit BP Key Value (DMR) (Hex Value)
|
-A <hex> Manually Enter and Enforce Anytone 16-bit BP Key Value (DMR) (Hex Value)
|
||||||
|
|
||||||
|
-, <string> Manually Enter and Enforce Auctus A6 (GoComm) 8 Char Key Value (DMR) (String Value)
|
||||||
|
-, Secure04
|
||||||
|
|
||||||
-S <str> Manually Enter and Enforce Generic Static Keystream -> Length and BYTE PACKED / ALIGNED String for AMBE (up to 882 bits)
|
-S <str> Manually Enter and Enforce Generic Static Keystream -> Length and BYTE PACKED / ALIGNED String for AMBE (up to 882 bits)
|
||||||
For Example, enter 16-bit Keystream 0909 as:
|
For Example, enter 16-bit Keystream 0909 as:
|
||||||
-S 16:0909
|
-S 16:0909
|
||||||
|
|||||||
@@ -1648,6 +1648,7 @@ void anytone_bp_keystream_creation(dsd_state * state, char * input);
|
|||||||
void baofeng_ap_pc5_keystream_creation(dsd_state *state, char *input);
|
void baofeng_ap_pc5_keystream_creation(dsd_state *state, char *input);
|
||||||
void csi72_ambe2_codeword_keystream(dsd_state * state, char ambe_fr[4][24]);
|
void csi72_ambe2_codeword_keystream(dsd_state * state, char ambe_fr[4][24]);
|
||||||
void straight_mod_xor_keystream_creation(dsd_state * state, char * input);
|
void straight_mod_xor_keystream_creation(dsd_state * state, char * input);
|
||||||
|
void auctus_keystream_creation(dsd_state * state, char * input);
|
||||||
|
|
||||||
//Kirisun
|
//Kirisun
|
||||||
uint32_t kirisun_lfsr(unsigned long long int mi);
|
uint32_t kirisun_lfsr(unsigned long long int mi);
|
||||||
|
|||||||
103
src/crypt-rc4.c
103
src/crypt-rc4.c
@@ -143,4 +143,105 @@ void hytera_enhanced_rc4_setup(dsd_opts * opts, dsd_state * state, unsigned long
|
|||||||
//end line break
|
//end line break
|
||||||
// fprintf (stderr, "\n");
|
// fprintf (stderr, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rc_poor_keystream_output(uint8_t * key, uint8_t * ks_bytes)
|
||||||
|
{
|
||||||
|
int16_t i, j, x, count;
|
||||||
|
uint8_t t, b;
|
||||||
|
|
||||||
|
//init Sbox
|
||||||
|
uint8_t S[255];
|
||||||
|
for(i = 0; i < 255; i++)
|
||||||
|
S[i] = i;
|
||||||
|
|
||||||
|
//Key Scheduling
|
||||||
|
j = 0;
|
||||||
|
for(i = 0; i < 255; i++)
|
||||||
|
{
|
||||||
|
j = (j + S[i] + key[i % 8]) % 255;
|
||||||
|
t = S[i];
|
||||||
|
S[i] = S[j];
|
||||||
|
S[j] = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
//KS Byte collection
|
||||||
|
i = j = x = 0;
|
||||||
|
for(count = 0; count < 6; count++)
|
||||||
|
{
|
||||||
|
i = (i + 1) % 255;
|
||||||
|
j = (j + S[i]) % 255;
|
||||||
|
t = S[i];
|
||||||
|
S[i] = S[j];
|
||||||
|
S[j] = t;
|
||||||
|
b = (S[i] + S[j]) % 255;
|
||||||
|
ks_bytes[x++] = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void auctus_keystream_creation(dsd_state * state, char * input)
|
||||||
|
{
|
||||||
|
|
||||||
|
uint8_t key[8];
|
||||||
|
memset (key, 0, sizeof(key));
|
||||||
|
|
||||||
|
uint16_t len = strlen((const char*)input);
|
||||||
|
|
||||||
|
//sanity check on provided char len
|
||||||
|
if (len > 8)
|
||||||
|
len = 8;
|
||||||
|
|
||||||
|
//load chars as uint8_t into key array
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
key[i] = (uint8_t)input[i];
|
||||||
|
|
||||||
|
//debug
|
||||||
|
fprintf (stderr, "Key String: %s; LEN: %d; HEX: ", input, len);
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
fprintf (stderr, "%02X", key[i]);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
|
||||||
|
uint8_t ks_bytes[6];
|
||||||
|
memset (ks_bytes, 0, sizeof(ks_bytes));
|
||||||
|
|
||||||
|
rc_poor_keystream_output(key, ks_bytes);
|
||||||
|
|
||||||
|
uint8_t ks_bits[48];
|
||||||
|
memset(ks_bits, 0, sizeof(ks_bits));
|
||||||
|
unpack_byte_array_into_bit_array(ks_bytes, ks_bits, 6);
|
||||||
|
|
||||||
|
//Reorder the bits of the keystream to compensate
|
||||||
|
//for 16-bit words with reversed bit storage
|
||||||
|
for (uint16_t j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
uint16_t k = ((j+1)*16) - 1;
|
||||||
|
uint16_t x = j*16;
|
||||||
|
for (uint16_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
state->static_ks_bits[0][x] = ks_bits[k];
|
||||||
|
state->static_ks_bits[1][x] = ks_bits[k];
|
||||||
|
|
||||||
|
//debug
|
||||||
|
// fprintf (stderr, " K: %02d; ", k);
|
||||||
|
|
||||||
|
//debug
|
||||||
|
// fprintf (stderr, " X: %02d; ", x);
|
||||||
|
|
||||||
|
k--;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (stderr,"Auctus Keystream: ");
|
||||||
|
for (uint16_t i = 0; i < 6; i++)
|
||||||
|
fprintf (stderr, "%02X", ks_bytes[i]);
|
||||||
|
fprintf (stderr," - Word Bit Reverse: ");
|
||||||
|
for (uint16_t i = 0; i < 6; i++)
|
||||||
|
fprintf (stderr, "%02X", convert_bits_into_output(state->static_ks_bits[0]+(i*8), 8));
|
||||||
|
fprintf (stderr, " with Forced Application \n");
|
||||||
|
|
||||||
|
state->straight_ks = 1;
|
||||||
|
state->straight_mod = 49;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1571,6 +1571,9 @@
|
|||||||
printf (" \n");
|
printf (" \n");
|
||||||
printf (" -A <hex> Manually Enter and Enforce Anytone 16-bit BP Key Value (DMR) (Hex Value) \n");
|
printf (" -A <hex> Manually Enter and Enforce Anytone 16-bit BP Key Value (DMR) (Hex Value) \n");
|
||||||
printf (" \n");
|
printf (" \n");
|
||||||
|
printf (" -, <string> Manually Enter and Enforce Auctus A6 (GoComm) 8 Char Key Value (DMR) (String Value) \n");
|
||||||
|
printf (" -, Secure04\n");
|
||||||
|
printf (" \n");
|
||||||
printf (" -S <str> Manually Enter and Enforce Generic Static Keystream -> Length and BYTE PACKED / ALIGNED String for AMBE (up to 882 bits)\n");
|
printf (" -S <str> Manually Enter and Enforce Generic Static Keystream -> Length and BYTE PACKED / ALIGNED String for AMBE (up to 882 bits)\n");
|
||||||
printf (" For Example, enter 16-bit Keystream 0909 as:\n");
|
printf (" For Example, enter 16-bit Keystream 0909 as:\n");
|
||||||
printf (" -S 16:0909\n");
|
printf (" -S 16:0909\n");
|
||||||
@@ -1898,7 +1901,7 @@
|
|||||||
|
|
||||||
exitflag = 0;
|
exitflag = 0;
|
||||||
|
|
||||||
while ((c = getopt (argc, argv, "~yhaepPqs:t:v:z:i:o:d:c:g:n:w:B:C:R:f:m:u:x:A:S:G:D:L:V:U:YK:b:H:X:M:NQ:WrlZTF@:!:01:2:345:6:^:7:8_:9:Ek:I:J:O+:j:")) != -1)
|
while ((c = getopt (argc, argv, "~yhaepPqs:t:v:z:i:o:d:c:g:n:w:B:C:R:f:m:u:x:A:S:G:D:L:V:U:YK:b:H:X:M:NQ:WrlZTF@:!:01:2:345:6:^:7:8_:9:Ek:I:J:O+:j:,:")) != -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
@@ -2017,6 +2020,11 @@
|
|||||||
baofeng_ap_pc5_keystream_creation(&state, optarg);
|
baofeng_ap_pc5_keystream_creation(&state, optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//Auctus (GoComm) Keystream Creation
|
||||||
|
case ',':
|
||||||
|
auctus_keystream_creation(&state, optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
//Straight KS Generation
|
//Straight KS Generation
|
||||||
case 'S':
|
case 'S':
|
||||||
straight_mod_xor_keystream_creation(&state, optarg);
|
straight_mod_xor_keystream_creation(&state, optarg);
|
||||||
|
|||||||
Reference in New Issue
Block a user