From 544d576551b0d1bda3bc04d0ece6f3a7da3165f7 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sat, 7 Nov 2026 19:35:47 -0500 Subject: [PATCH] DMR: Fix Hytera OTA Encryption VLC Pseudo Call Information TGT Value on Slot 2. Verbage Tweaks; #373 DMR: Fix Kirisun "Ultra" Cipher Name in Code (Ultra, not Ultimate). Remove Unvalidated Code Bits regarding Kirisun; #319 --- src/crypt-kir.c | 4 ++-- src/dmr_flco.c | 15 ++++++++------- src/dmr_le.c | 6 +++--- src/dmr_ms.c | 10 ---------- src/dmr_pi.c | 7 +------ 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/crypt-kir.c b/src/crypt-kir.c index 939fbf4..7edc3d2 100644 --- a/src/crypt-kir.c +++ b/src/crypt-kir.c @@ -1063,7 +1063,7 @@ void decode_block(const uint64_t input[2], uint64_t output[2], const uint8_t sch output[1] = left_word; } -void kirisun_ultimate_keystream_creation(dsd_state *state) +void kirisun_ultra_keystream_creation(dsd_state *state) { uint8_t slot = 0; if (state->currentslot == 0) @@ -1237,6 +1237,6 @@ void kirisun_keystream_creation(dsd_state * state) kirisun_top_keystream_creation(state); else if (algid == 0x3A) - kirisun_ultimate_keystream_creation(state); + kirisun_ultra_keystream_creation(state); } diff --git a/src/dmr_flco.c b/src/dmr_flco.c index 8e42149..3ed8b31 100644 --- a/src/dmr_flco.c +++ b/src/dmr_flco.c @@ -89,23 +89,24 @@ void dmr_flco (dsd_opts * opts, dsd_state * state, uint8_t lc_bits[], uint32_t C //so assign static value if (state->hota_enc_check) { + uint32_t t_target = 8686868; if (type == 1) { if (slot == 0) { state->lastsrc = source; - state->lasttg = 8686868; + state->lasttg = t_target; } else { state->lastsrcR = source; - state->lasttgR = 8686868; + state->lasttgR = t_target; } fprintf (stderr, "\n%s", KYEL); fprintf (stderr, " SLOT %d ", slot+1); - fprintf(stderr, "TGT=%u SRC=%u ", state->lasttg, source); - fprintf (stderr, "Forced Pseudo Call Information"); + fprintf(stderr, "TGT=%u SRC=%u ", t_target, source); + fprintf (stderr, "Encrypted Pseudo Call Information"); fprintf (stderr, "%s", KNRM); return; @@ -114,7 +115,7 @@ void dmr_flco (dsd_opts * opts, dsd_state * state, uint8_t lc_bits[], uint32_t C { fprintf (stderr, "\n%s", KRED); fprintf (stderr, " SLOT %d", slot+1); - fprintf (stderr, " TLC Undecryptable;"); + fprintf (stderr, " TLC Encrypted;"); fprintf (stderr, "%s", KNRM); return; } @@ -122,7 +123,7 @@ void dmr_flco (dsd_opts * opts, dsd_state * state, uint8_t lc_bits[], uint32_t C { fprintf (stderr, "%s", KRED); fprintf (stderr, " SLOT %d", slot+1); - fprintf (stderr, " EMB LC Undecryptable;"); + fprintf (stderr, " EMB LC Encrypted;"); fprintf (stderr, "%s", KNRM); return; } @@ -132,7 +133,7 @@ void dmr_flco (dsd_opts * opts, dsd_state * state, uint8_t lc_bits[], uint32_t C { fprintf (stderr, "%s", KRED); fprintf (stderr, " SLOT %d", slot+1); - fprintf (stderr, " EMB LC Missing CTX; Undecryptable;"); + fprintf (stderr, " EMB LC Missing CTX; Encrypted;"); fprintf (stderr, "%s", KNRM); return; } diff --git a/src/dmr_le.c b/src/dmr_le.c index 2fbe80a..82b3898 100644 --- a/src/dmr_le.c +++ b/src/dmr_le.c @@ -478,7 +478,7 @@ void dmr_sbrc (dsd_opts * opts, dsd_state * state, uint8_t power) state->hota_sbrc_idx2[state->currentslot] = -1; fprintf (stderr, "%s \n", KRED); fprintf (stderr, " SLOT %d ", slot+1); - fprintf (stderr, "SB_RC Missing IDX; Undecryptable;"); + fprintf (stderr, "SB_RC Missing IDX; Encrypted;"); fprintf (stderr, "%s\n", KNRM); goto SBRC_END; } @@ -488,7 +488,7 @@ void dmr_sbrc (dsd_opts * opts, dsd_state * state, uint8_t power) state->hota_sbrc_idx2[state->currentslot] = -1; fprintf (stderr, "%s \n", KRED); fprintf (stderr, " SLOT %d ", slot+1); - fprintf (stderr, "SB_RC Incorrect IDX or FEC Errors; Undecryptable;"); + fprintf (stderr, "SB_RC Incorrect IDX or FEC Errors; Encrypted;"); fprintf (stderr, "%s\n", KNRM); goto SBRC_END; } @@ -496,7 +496,7 @@ void dmr_sbrc (dsd_opts * opts, dsd_state * state, uint8_t power) { fprintf (stderr, "%s \n", KRED); fprintf (stderr, " SLOT %d ", slot+1); - fprintf (stderr, "SB_RC Undecryptable;"); + fprintf (stderr, "SB_RC Encrypted;"); fprintf (stderr, "%s\n", KNRM); goto SBRC_END; } diff --git a/src/dmr_ms.c b/src/dmr_ms.c index e22a3a3..bdeb726 100644 --- a/src/dmr_ms.c +++ b/src/dmr_ms.c @@ -167,16 +167,6 @@ void dmrMS (dsd_opts * opts, dsd_state * state) } - //Kirisun Check VC-F for Enc Identifiers -- has bad fec, unless its loaded differently - //SEE: https://patents.google.com/patent/CN102307075A/en?q=(kirisun)&q=(dmr)&oq=kirisun - // if (opts->dmr_le == 3 && vc == 6) - // { - // bool kokay = 0; - // // kokay = Golay_24_12_decode(syncdata); - // unsigned long long int kirisun = (unsigned long long int)ConvertBitIntoBytes(&syncdata[0], 48); - // fprintf (stderr, "Kiri: %012llX; Golay Okay: %d; \n", kirisun, kokay); - // } - for(i = 0; i < 8; i++) emb_pdu[i + 0] = syncdata[i]; for(i = 0; i < 8; i++) emb_pdu[i + 8] = syncdata[i + 40]; diff --git a/src/dmr_pi.c b/src/dmr_pi.c index 547af1b..db9537a 100644 --- a/src/dmr_pi.c +++ b/src/dmr_pi.c @@ -88,12 +88,7 @@ void dmr_pi (dsd_opts * opts, dsd_state * state, uint8_t PI_BYTE[], uint32_t CRC fprintf (stderr, "Encryption;"); fprintf (stderr, "%s", KNRM); - //disable late entry for DMRA, Flag 3 for future check of VC-F 48-bit region with Golay 24,12 Encoding - //SEE: https://patents.google.com/patent/CN102307075A/en?q=(kirisun)&q=(dmr)&oq=kirisun - //tested patent above with information provided, VC-F had a SB, but the 48-bit - //full value yielded bad Golay results, and user submitted info contradicts this patent for samples provided - //Late Entry MI does appear to work, however, and reports a good CRC for that as well, - //reverse engineered LFSR for Kirisun lines up with the late entry for 32-bit MI values. + //flag late entry SB for Kirisun opts->dmr_le = 3; }