mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 17:05:52 +00:00
* verify() fix moved to Identity class
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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], ×tamp, 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());
|
||||
|
||||
Reference in New Issue
Block a user