fix beacon: init Ed25519 identity for valid advert signature
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -351,6 +351,21 @@ void setup() {
|
||||
|
||||
fast_rng.begin(radio_driver.getRngSeed());
|
||||
|
||||
{
|
||||
File f = InternalFS.open(IDENTITY_FILE, FILE_O_READ);
|
||||
if (f) {
|
||||
uint8_t buf[PUB_KEY_SIZE + PRV_KEY_SIZE];
|
||||
if (f.read(buf, sizeof(buf)) == sizeof(buf)) the_mesh.self_id.readFrom(buf, sizeof(buf));
|
||||
f.close();
|
||||
} else {
|
||||
the_mesh.self_id = mesh::LocalIdentity(&fast_rng);
|
||||
uint8_t buf[PUB_KEY_SIZE + PRV_KEY_SIZE];
|
||||
the_mesh.self_id.writeTo(buf, sizeof(buf));
|
||||
f = InternalFS.open(IDENTITY_FILE, FILE_O_WRITE);
|
||||
if (f) { f.write(buf, sizeof(buf)); f.close(); }
|
||||
}
|
||||
}
|
||||
|
||||
the_mesh.setup_channel();
|
||||
the_mesh.begin();
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
#define CONFIG_FILE "/security.cfg"
|
||||
#define CHANNEL_FILE "/channel.cfg"
|
||||
#define NAME_FILE "/name.cfg"
|
||||
#define IDENTITY_FILE "/identity.dat"
|
||||
#define WDT_TIMEOUT_MS 10000
|
||||
|
||||
#include <RadioLib.h>
|
||||
|
||||
Reference in New Issue
Block a user