From b18aeb5f9d58d74d49fab325ac6836f59bdb7285 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 6 Dec 2023 15:36:50 +0000 Subject: [PATCH] Initialise the M17 LSF correctly when not initialised. Use a private LSF for testing the encryption. --- M17Control.cpp | 7 +++++-- M17LSF.cpp | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/M17Control.cpp b/M17Control.cpp index f461e01c..5bca746d 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020,2021 Jonathan Naylor, G4KLX + * Copyright (C) 2020,2021,2023 Jonathan Naylor, G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -553,7 +553,10 @@ void CM17Control::writeNetwork() m_networkWatchdog.start(); if (!m_allowEncryption) { - unsigned char type = m_netLSF.getEncryptionType(); + CM17LSF lsf; + lsf.setNetwork(netData); + + unsigned char type = lsf.getEncryptionType(); if (type != M17_ENCRYPTION_TYPE_NONE) { LogMessage("M17 encryption rejection"); m_network->reset(); diff --git a/M17LSF.cpp b/M17LSF.cpp index 3034e268..843bae21 100644 --- a/M17LSF.cpp +++ b/M17LSF.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020,2021 by Jonathan Naylor G4KLX + * Copyright (C) 2020,2021,2023 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,8 @@ m_lsf(NULL), m_valid(false) { m_lsf = new unsigned char[M17_LSF_LENGTH_BYTES]; + + ::memset(m_lsf, 0x00U, M17_LSF_LENGTH_BYTES); } CM17LSF::~CM17LSF()