From 8fd9c64c0c51abda927870ffa928b9d1611098f1 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sun, 6 Apr 2025 18:53:16 -0400 Subject: [PATCH] DMR: Change PDU MI to ulli to match and prevent possible issues related to int to ulli change in mi storage; PI Header Display Nit; --- src/dmr_block.c | 12 ++++++------ src/dmr_pi.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dmr_block.c b/src/dmr_block.c index a920305..93bbc8b 100644 --- a/src/dmr_block.c +++ b/src/dmr_block.c @@ -389,8 +389,8 @@ void dmr_dheader (dsd_opts * opts, dsd_state * state, uint8_t dheader[], uint8_t if ((uint8_t)ConvertBitIntoBytes(&dheader_bits[17], 3) == 5) fprintf (stderr, " AES256;"); if (state->currentslot == 0) - state->payload_mi = (uint32_t)ConvertBitIntoBytes(&dheader_bits[48], 32); - else state->payload_miR = (uint32_t)ConvertBitIntoBytes(&dheader_bits[48], 32); + state->payload_mi = (unsigned long long int)ConvertBitIntoBytes(&dheader_bits[48], 32); + else state->payload_miR = (unsigned long long int)ConvertBitIntoBytes(&dheader_bits[48], 32); //print MI only if this is not Moto BP (no MI on those) if ((uint32_t)ConvertBitIntoBytes(&dheader_bits[48], 32) != 0) @@ -889,11 +889,11 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte //start keystream creation uint8_t ob[129*24]; uint8_t kiv[9]; - uint32_t mi = 0; + unsigned long long int mi = 0; unsigned long long int R = 0; if (state->currentslot == 0) - mi = (uint32_t)state->payload_mi; - else mi = (uint32_t)state->payload_miR; + mi = (unsigned long long int)state->payload_mi; + else mi = (unsigned long long int)state->payload_miR; //key loader if (state->currentslot == 0) @@ -931,7 +931,7 @@ void dmr_block_assembler (dsd_opts * opts, dsd_state * state, uint8_t block_byte //print alg/key and value if loaded fprintf (stderr, "\n PDU ALG: %02X; Key ID: %02X;", alg, kid); - if (alg != 0) fprintf (stderr, " MI(32): %08X;", mi); + if (alg != 0) fprintf (stderr, " MI(32): %08llX;", mi); if (alg == 0) fprintf (stderr, " Moto BP;"); if (alg == 1) fprintf (stderr, " RC4;"); if (alg == 2) fprintf (stderr, " DES1;"); diff --git a/src/dmr_pi.c b/src/dmr_pi.c index b7b67e5..3d98e9c 100644 --- a/src/dmr_pi.c +++ b/src/dmr_pi.c @@ -161,7 +161,7 @@ void dmr_pi (dsd_opts * opts, dsd_state * state, uint8_t PI_BYTE[], uint32_t CRC { fprintf (stderr, "%s ", KYEL); fprintf (stderr, "\n Slot 2"); - fprintf (stderr, " DMR PI H- ALG ID: %02X; KEY ID: %02X; MI(32): %08llX", state->payload_algidR, state->payload_keyidR, state->payload_miR); + fprintf (stderr, " DMR PI H- ALG ID: %02X; KEY ID: %02X; MI(32): %08llX;", state->payload_algidR, state->payload_keyidR, state->payload_miR); //check for any values that aren't 0x2X but just 0x0X //going to be very generic here to avoid any particular vendors using 0x2X and not 0x0X