mirror of
https://github.com/kamilsss655/uv-k5-firmware-custom
synced 2024-11-21 17:57:59 +00:00
fix enc key initialization after boot
This commit is contained in:
parent
fd03292669
commit
229806da0f
10
app/app.c
10
app/app.c
@ -65,6 +65,9 @@
|
||||
#ifdef ENABLE_MESSENGER
|
||||
#include "app/messenger.h"
|
||||
#endif
|
||||
#ifdef ENABLE_ENCRYPTION
|
||||
#include "helper/crypto.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MESSENGER_NOTIFICATION
|
||||
bool gPlayMSGRing = false;
|
||||
@ -1309,6 +1312,13 @@ void APP_TimeSlice500ms(void)
|
||||
} else if (hasNewMessage == 2) {
|
||||
hasNewMessage = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_ENCRYPTION
|
||||
if(gRecalculateEncKey){
|
||||
CRYPTO_Generate256BitKey(gEeprom.ENC_KEY, gEncryptionKey, sizeof(gEeprom.ENC_KEY));
|
||||
gRecalculateEncKey = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -682,6 +682,9 @@ void MSG_Init() {
|
||||
prevKey = 0;
|
||||
prevLetter = 0;
|
||||
cIndex = 0;
|
||||
#ifdef ENABLE_ENCRYPTION
|
||||
gRecalculateEncKey = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void MSG_SendAck() {
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "driver/bk4819.h"
|
||||
#include "driver/systick.h"
|
||||
|
||||
bool gRecalculateEncKey;
|
||||
|
||||
u_int8_t gEncryptionKey[32];
|
||||
|
||||
// salt used for hashing encryption key from eeprom used for sending packets
|
||||
|
@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint8_t gEncryptionKey[32];
|
||||
extern bool gRecalculateEncKey;
|
||||
extern uint8_t gEncryptionKey[32];
|
||||
static const uint8_t encryptionSalt[4][8];
|
||||
static const uint8_t displaySalt[32];
|
||||
|
||||
|
@ -277,8 +277,7 @@ void SETTINGS_SaveEncryptionKey()
|
||||
{
|
||||
EEPROM_WriteBuffer(0x0F30, gEeprom.ENC_KEY, true);
|
||||
EEPROM_WriteBuffer(0x0F38, gEeprom.ENC_KEY + 8, true);
|
||||
|
||||
CRYPTO_Generate256BitKey(gEeprom.ENC_KEY, gEncryptionKey, sizeof(gEeprom.ENC_KEY));
|
||||
gRecalculateEncKey = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user