mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-16 18:57:24 -05:00
YOLO:
Congratulations for clicking this link, you are now reading this description; Add DES-OFB Decryption Support for P25, NXDN, DMR (Tested); Add DES-XL Decryption Support for P25p1 (Tested); Add AES-OFB Decryption Support for P25, DMR (Tested); NXDN(untested); Add P25p1 PDU Decryption Support; (Untested)(Known Modes); Add Remaining (AES, DES) DMR PDU Decryption Support (Known DMRA Modes)(Untested); Decrypt Tytera 16-bit BP (works depending on model); Add AES Keys example csv file for import; Probably a few bugs that'll need to be massaged out now with all the code additions for several years of stashed code;
This commit is contained in:
@@ -632,4 +632,49 @@ void unpack_ambe (uint8_t * input, char * ambe)
|
||||
ambe[k++] = (input[i] >> 0) & 1;
|
||||
}
|
||||
ambe[48] = input[6] >> 7;
|
||||
}
|
||||
|
||||
//convert a user string into a uint8_t array
|
||||
uint16_t parse_raw_user_string (char * input, uint8_t * output)
|
||||
{
|
||||
//since we want this as octets, get strlen value, then divide by two
|
||||
uint16_t len = strlen((const char*)input);
|
||||
|
||||
uint8_t shift = 0;
|
||||
|
||||
//if zero is returned, just do two
|
||||
// if (len == 0) len = 2;
|
||||
|
||||
//if zero, return as 0 len string
|
||||
if (len == 0) return 0;
|
||||
|
||||
//if odd number, then user didn't pass complete octets,
|
||||
//add one to len value and set the shift flag to left shift
|
||||
if (len&1)
|
||||
{
|
||||
shift = 1;
|
||||
len++;
|
||||
}
|
||||
|
||||
//divide by two to get octet len
|
||||
len /= 2;
|
||||
|
||||
char octet_char[3];
|
||||
octet_char[2] = 0;
|
||||
uint16_t k = 0;
|
||||
uint16_t i = 0;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
strncpy (octet_char, input+k, 2);
|
||||
octet_char[2] = 0;
|
||||
sscanf (octet_char, "%hhX", &output[i]);
|
||||
|
||||
k += 2;
|
||||
}
|
||||
|
||||
//if we had an odd input value, then left shift the last octet 4 to make it flush
|
||||
if (shift) output[len-1] <<= 4;
|
||||
|
||||
return len;
|
||||
}
|
||||
Reference in New Issue
Block a user