* verify() fix moved to Identity class

This commit is contained in:
Scott Powell
2025-03-19 17:30:35 +11:00
parent 4943b388c0
commit 089ac96f2b
2 changed files with 7 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include <string.h>
#define ED25519_NO_SEED 1
#include <ed_25519.h>
#include <Ed25519.h>
namespace mesh {
@@ -14,7 +15,12 @@ Identity::Identity(const char* pub_hex) {
}
bool Identity::verify(const uint8_t* sig, const uint8_t* message, int msg_len) const {
#if 0
// NOTE: memory corruption bug was found in this function!!
return ed25519_verify(sig, message, msg_len, pub_key);
#else
return Ed25519::verify(sig, this->pub_key, message, msg_len);
#endif
}
bool Identity::readFrom(Stream& s) {

View File

@@ -1,6 +1,5 @@
#include "Mesh.h"
//#include <Arduino.h>
#include <Ed25519.h>
namespace mesh {
@@ -235,8 +234,7 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
memcpy(&message[msg_len], &timestamp, 4); msg_len += 4;
memcpy(&message[msg_len], app_data, app_data_len); msg_len += app_data_len;
//is_ok = id.verify(signature, message, msg_len);
is_ok = Ed25519::verify(signature, id.pub_key, message, msg_len);
is_ok = id.verify(signature, message, msg_len);
}
if (is_ok) {
MESH_DEBUG_PRINTLN("%s Mesh::onRecvPacket(): valid advertisement received!", getLogDateTime());