Rename "Dummy" signing driver to "None"

This commit is contained in:
Henrik Ekblad
2015-02-25 23:18:26 +01:00
parent a4f70342a2
commit 23a8a48f8e
3 changed files with 28 additions and 28 deletions
+4 -4
View File
@@ -16,7 +16,7 @@
//#define MYSENSORS_RF_RF69 //#define MYSENSORS_RF_RF69
// Choose signing backend by enabling one of the following // Choose signing backend by enabling one of the following
#define MYSENSORS_SIGNING_DUMMY #define MYSENSORS_SIGNING_NONE
//#define MYSENSORS_SIGNING_ATSHA204 //#define MYSENSORS_SIGNING_ATSHA204
//#define MYSENSORS_SIGNING_ATSHA204SOFT //#define MYSENSORS_SIGNING_ATSHA204SOFT
@@ -40,10 +40,10 @@ typedef class MyRFDriverRF69 MyRFDriverClass;
typedef class MyParserSerial MyParserClass; typedef class MyParserSerial MyParserClass;
#endif #endif
#ifdef MYSENSORS_SIGNING_DUMMY #ifdef MYSENSORS_SIGNING_NONE
#include "MySigningDriverDummy.h" #include "MySigningDriverNone.h"
#define SIGNING_IDENTIFIER (0) // Reserved for dummy implementation, will not work with other backends #define SIGNING_IDENTIFIER (0) // Reserved for dummy implementation, will not work with other backends
typedef class MySigningDriverDummy MySigningDriverClass; typedef class MySigningDriverNone MySigningDriverClass;
#endif #endif
#ifdef MYSENSORS_SIGNING_ATSHA204 #ifdef MYSENSORS_SIGNING_ATSHA204
@@ -1,23 +1,23 @@
/* /*
Dummy signing backend. Does not provide any security measures. Disabled signing backend. Does not provide any security measures.
Created by Patrick "Anticimex" Fallberg <patrick@fallberg.net> Created by Patrick "Anticimex" Fallberg <patrick@fallberg.net>
*/ */
#include "MySigningDriver.h" #include "MySigningDriver.h"
#include "MySigningDriverDummy.h" #include "MySigningDriverNone.h"
#ifdef MYSENSORS_SIGNING_DUMMY #ifdef MYSENSORS_SIGNING_NONE
// Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected) // Uncomment this to get some useful serial debug info (Serial.print and Serial.println expected)
//#define DEBUG_DUMMY_SIGNING //#define DEBUG_NONE_SIGNING
#ifdef DEBUG_DUMMY_SIGNING #ifdef DEBUG_NONE_SIGNING
#define DEBUG_DUMMY_PRINTLN(args) Serial.println(args) #define DEBUG_NONE_PRINTLN(args) Serial.println(args)
#else #else
#define DEBUG_DUMMY_PRINTLN(args) #define DEBUG_NONE_PRINTLN(args)
#endif #endif
#ifdef DEBUG_DUMMY_SIGNING #ifdef DEBUG_NONE_SIGNING
static void DEBUG_DUMMY_PRINTBUF(char* str, uint8_t* buf, uint8_t sz) static void DEBUG_NONE_PRINTBUF(char* str, uint8_t* buf, uint8_t sz)
{ {
int i; int i;
Serial.println(str); Serial.println(str);
@@ -32,28 +32,28 @@ static void DEBUG_DUMMY_PRINTBUF(char* str, uint8_t* buf, uint8_t sz)
Serial.println(); Serial.println();
} }
#else #else
#define DEBUG_DUMMY_PRINTBUF(str, buf, sz) #define DEBUG_NONE_PRINTBUF(str, buf, sz)
#endif #endif
MySigningDriverDummy::MySigningDriverDummy() : MySigningDriver() { MySigningDriverNone::MySigningDriverNone() : MySigningDriver() {
} }
bool MySigningDriverDummy::getNonce(MyMessage &msg) { bool MySigningDriverNone::getNonce(MyMessage &msg) {
return true; return true;
} }
bool MySigningDriverDummy::checkTimer() { bool MySigningDriverNone::checkTimer() {
return true; return true;
} }
bool MySigningDriverDummy::putNonce(MyMessage &msg) { bool MySigningDriverNone::putNonce(MyMessage &msg) {
return true; return true;
} }
bool MySigningDriverDummy::signMsg(MyMessage &msg) { bool MySigningDriverNone::signMsg(MyMessage &msg) {
// If we cannot fit any signature in the message, refuse to sign it // If we cannot fit any signature in the message, refuse to sign it
if (mGetLength(msg) > MAX_PAYLOAD-2) { if (mGetLength(msg) > MAX_PAYLOAD-2) {
DEBUG_DUMMY_PRINTLN("Cannot fit any signature to this message"); DEBUG_NONE_PRINTLN("Cannot fit any signature to this message");
return false; return false;
} }
mSetSigned(msg, 1); // make sure signing flag is set before signature is calculated mSetSigned(msg, 1); // make sure signing flag is set before signature is calculated
@@ -61,7 +61,7 @@ bool MySigningDriverDummy::signMsg(MyMessage &msg) {
return true; return true;
} }
bool MySigningDriverDummy::verifyMsg(MyMessage &msg) { bool MySigningDriverNone::verifyMsg(MyMessage &msg) {
if (msg.data[mGetLength(msg)] != SIGNING_IDENTIFIER) if (msg.data[mGetLength(msg)] != SIGNING_IDENTIFIER)
return false; return false;
else else
@@ -1,24 +1,24 @@
/* /*
Dummy signing backend. Does not provide any security measures. Disabled signing backend. Does not provide any security measures.
Created by Patrick "Anticimex" Fallberg <patrick@fallberg.net> Created by Patrick "Anticimex" Fallberg <patrick@fallberg.net>
*/ */
#ifndef MySigningDriverDummy_h #ifndef MySigningDriverNone_h
#define MySigningDriverDummy_h #define MySigningDriverNone_h
#include "MyConfig.h" #include "MyConfig.h"
#include "MySigningDriver.h" #include "MySigningDriver.h"
#include <stdint.h> #include <stdint.h>
// The dummy signing driver that can be used for nodes // The "none" signing driver that can be used for nodes
// not requiring signing // not requiring signing
// It does check SIGNING_IDENTIFIER byte to avoid illegal mixing of signing back-ends in // It does check SIGNING_IDENTIFIER byte to avoid illegal mixing of signing back-ends in
// the network (as seen by this node) and it does verify proper execution order on the API. // the network (as seen by this node) and it does verify proper execution order on the API.
// The dummy driver rejects all other back-ends. // The "none" driver rejects all other back-ends.
class MySigningDriverDummy : public MySigningDriver class MySigningDriverNone : public MySigningDriver
{ {
public: public:
MySigningDriverDummy(); MySigningDriverNone();
bool getNonce(MyMessage &msg); bool getNonce(MyMessage &msg);
bool checkTimer(void); bool checkTimer(void);
bool putNonce(MyMessage &msg); bool putNonce(MyMessage &msg);