DMR TYT BP16 Encryption Mode WIP; #302

Code is not working as-is, committed for anonymous submitter to have access to certain items in code;
This commit is contained in:
lwvmobile
2025-08-15 12:21:27 -04:00
parent c888dfc1d6
commit 8f092e293f
6 changed files with 240 additions and 106 deletions

View File

@@ -9,6 +9,8 @@
#include "dsd.h"
#include "dmr_const.h"
// #define PRINT_AMBE72 //enable to view 72-bit AMBE codewords
//A subroutine for processing MS voice
void dmrMS (dsd_opts * opts, dsd_state * state)
{
@@ -21,6 +23,8 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
char ambe_fr3[4][24];
char ambe_fr4[4][24];
int ks_idx = 0;
//memcpy of ambe_fr for late entry
uint8_t m1[4][24];
uint8_t m2[4][24];
@@ -244,6 +248,20 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
memcpy (m2, ambe_fr2, sizeof(m2));
memcpy (m3, ambe_fr3, sizeof(m3));
if (state->tyt_bp == 1)
{
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr, ks_idx, 0);
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr2, ks_idx, 1);
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr3, ks_idx, 0);
// ks_idx = 0; //needed?
}
#ifdef PRINT_AMBE72
ambe2_codeword_print_b(opts, ambe_fr);
ambe2_codeword_print_b(opts, ambe_fr2);
ambe2_codeword_print_b(opts, ambe_fr3);
#endif
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l));
@@ -366,6 +384,8 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state)
memset (ambe_fr2, 0, sizeof(ambe_fr2));
memset (ambe_fr3, 0, sizeof(ambe_fr3));
int ks_idx = 0;
//memcpy of ambe_fr for late entry
uint8_t m1[4][24];
uint8_t m2[4][24];
@@ -536,6 +556,20 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state)
memcpy (m2, ambe_fr2, sizeof(m2));
memcpy (m3, ambe_fr3, sizeof(m3));
if (state->tyt_bp == 1)
{
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr, ks_idx, 0);
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr2, ks_idx, 1);
ks_idx = tyt16_ambe2_codeword_keystream(state, ambe_fr3, ks_idx, 0);
// ks_idx = 0; //needed?
}
#ifdef PRINT_AMBE72
ambe2_codeword_print_b(opts, ambe_fr);
ambe2_codeword_print_b(opts, ambe_fr2);
ambe2_codeword_print_b(opts, ambe_fr3);
#endif
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l));