From 842d575fc5bf0b864ac82af3f6f09bd430aef33d Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 20 Jan 2016 20:51:58 +0100 Subject: [PATCH 1/4] Implemented signing test sketches These will automatically be built for every PR by Jenkins. The test sketches in this commit evaluates signing (hard/soft) and whitelisting (on/off). Full verbose signing debug is enabled. RF24 radio is also enabled. --- ...ard_signing_no_whitelisting_full_debug.ino | 32 +++++++++++++++++++ .../hard_signing_whitelisting_full_debug.ino | 32 +++++++++++++++++++ ...oft_signing_no_whitelisting_full_debug.ino | 32 +++++++++++++++++++ .../soft_signing_whitelisting_full_debug.ino | 32 +++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino create mode 100644 libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino create mode 100644 libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino create mode 100644 libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino diff --git a/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino new file mode 100644 index 0000000..7cf33bc --- /dev/null +++ b/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino @@ -0,0 +1,32 @@ +/* + * The MySensors Arduino library handles the wireless radio link and protocol + * between your home built sensors/actuators and HA controller of choice. + * The sensors forms a self healing radio network with optional repeaters. Each + * repeater and gateway builds a routing tables in EEPROM which keeps track of the + * network topology allowing messages to be routed to nodes. + * + * Created by Henrik Ekblad + * Copyright (C) 2013-2015 Sensnology AB + * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors + * + * Documentation: http://www.mysensors.org + * Support Forum: http://forum.mysensors.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + ******************************* + */ +#define MY_DEBUG +#define MY_DEBUG_VERBOSE_SIGNING +#define MY_RADIO_NRF24 //!< NRF24L01 radio driver +//#define MY_SIGNING_SOFT //!< Software signing +#define MY_SIGNING_ATSHA204 //!< Hardware signing using ATSHA204A +//#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} +#define MY_SIGNING_REQUEST_SIGNATURES +#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed +#define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached + +#include +#include diff --git a/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino new file mode 100644 index 0000000..03835a6 --- /dev/null +++ b/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino @@ -0,0 +1,32 @@ +/* + * The MySensors Arduino library handles the wireless radio link and protocol + * between your home built sensors/actuators and HA controller of choice. + * The sensors forms a self healing radio network with optional repeaters. Each + * repeater and gateway builds a routing tables in EEPROM which keeps track of the + * network topology allowing messages to be routed to nodes. + * + * Created by Henrik Ekblad + * Copyright (C) 2013-2015 Sensnology AB + * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors + * + * Documentation: http://www.mysensors.org + * Support Forum: http://forum.mysensors.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + ******************************* + */ +#define MY_DEBUG +#define MY_DEBUG_VERBOSE_SIGNING +#define MY_RADIO_NRF24 //!< NRF24L01 radio driver +//#define MY_SIGNING_SOFT //!< Software signing +#define MY_SIGNING_ATSHA204 //!< Hardware signing using ATSHA204A +#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} +#define MY_SIGNING_REQUEST_SIGNATURES +#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed +#define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached + +#include +#include diff --git a/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino new file mode 100644 index 0000000..96f6565 --- /dev/null +++ b/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino @@ -0,0 +1,32 @@ +/* + * The MySensors Arduino library handles the wireless radio link and protocol + * between your home built sensors/actuators and HA controller of choice. + * The sensors forms a self healing radio network with optional repeaters. Each + * repeater and gateway builds a routing tables in EEPROM which keeps track of the + * network topology allowing messages to be routed to nodes. + * + * Created by Henrik Ekblad + * Copyright (C) 2013-2015 Sensnology AB + * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors + * + * Documentation: http://www.mysensors.org + * Support Forum: http://forum.mysensors.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + ******************************* + */ +#define MY_DEBUG +#define MY_DEBUG_VERBOSE_SIGNING +#define MY_RADIO_NRF24 //!< NRF24L01 radio driver +#define MY_SIGNING_SOFT //!< Software signing +//#define MY_SIGNING_ATSHA204 //!< Hardware signing using ATSHA204A +//#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} +#define MY_SIGNING_REQUEST_SIGNATURES +#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed +#define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached + +#include +#include diff --git a/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino new file mode 100644 index 0000000..7c44f04 --- /dev/null +++ b/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino @@ -0,0 +1,32 @@ +/* + * The MySensors Arduino library handles the wireless radio link and protocol + * between your home built sensors/actuators and HA controller of choice. + * The sensors forms a self healing radio network with optional repeaters. Each + * repeater and gateway builds a routing tables in EEPROM which keeps track of the + * network topology allowing messages to be routed to nodes. + * + * Created by Henrik Ekblad + * Copyright (C) 2013-2015 Sensnology AB + * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors + * + * Documentation: http://www.mysensors.org + * Support Forum: http://forum.mysensors.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + ******************************* + */ +#define MY_DEBUG +#define MY_DEBUG_VERBOSE_SIGNING +#define MY_RADIO_NRF24 //!< NRF24L01 radio driver +#define MY_SIGNING_SOFT //!< Software signing +//#define MY_SIGNING_ATSHA204 //!< Hardware signing using ATSHA204A +#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} +#define MY_SIGNING_REQUEST_SIGNATURES +#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //!< Unconnected analog pin for random seed +#define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached + +#include +#include From 94c7f4451e8eadafe8a67455e99d993c82e7b4b2 Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 20 Jan 2016 22:04:19 +0100 Subject: [PATCH 2/4] Resolved Doxygen warnings relating to signing --- libraries/MySensors/MyConfig.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/MySensors/MyConfig.h b/libraries/MySensors/MyConfig.h index f0b52e9..37b3cab 100644 --- a/libraries/MySensors/MyConfig.h +++ b/libraries/MySensors/MyConfig.h @@ -542,6 +542,7 @@ #if DOXYGEN #define MY_SIGNING_ATSHA204 #define MY_SIGNING_SOFT +#define MY_SIGNING_REQUEST_SIGNATURES #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_IS_RFM69HW #endif From 4a5c0f93141ba37c16d31bc36553a0f7416b8bc4 Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 20 Jan 2016 22:07:45 +0100 Subject: [PATCH 3/4] Make ESP8266 sketches explicitly declare GW In order to build core tests, there cannot be any hard coded GATEWAY flags (like MY_GATEWAY_ESP8266). These needs to be set in the sketch that implements the gateway. --- libraries/MySensors/MySensor.h | 4 ---- .../MySensors/examples/GatewayESP8266/GatewayESP8266.ino | 1 - .../GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino | 1 + 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/MySensors/MySensor.h b/libraries/MySensors/MySensor.h index 90ef395..36b8bea 100644 --- a/libraries/MySensors/MySensor.h +++ b/libraries/MySensors/MySensor.h @@ -65,10 +65,6 @@ //#undef F //#define F(x) (x) #include "core/MyHwESP8266.cpp" - // Enable gateway feature - #if !defined(MY_CORE_ONLY) - #define MY_GATEWAY_ESP8266 - #endif #elif defined(ARDUINO_ARCH_AVR) #include "core/MyHwATMega328.cpp" #elif defined(ARDUINO_ARCH_SAMD) diff --git a/libraries/MySensors/examples/GatewayESP8266/GatewayESP8266.ino b/libraries/MySensors/examples/GatewayESP8266/GatewayESP8266.ino index d85bd79..803eb7d 100644 --- a/libraries/MySensors/examples/GatewayESP8266/GatewayESP8266.ino +++ b/libraries/MySensors/examples/GatewayESP8266/GatewayESP8266.ino @@ -78,7 +78,6 @@ #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 -// Gateway mode always enabled for ESP8266. But we add this anyway ;) #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "MySSID" diff --git a/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino b/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino index 4aeb228..60d052e 100644 --- a/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino +++ b/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino @@ -71,6 +71,7 @@ //#define MY_RADIO_RFM69 #define MY_GATEWAY_MQTT_CLIENT +#define MY_GATEWAY_ESP8266 // Set this nodes subscripe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out" From 15167d69e87fd58a9288d837b0df4bc0511b511c Mon Sep 17 00:00:00 2001 From: Patrick Fallberg Date: Wed, 20 Jan 2016 22:18:34 +0100 Subject: [PATCH 4/4] Support building test sketches for ESP8266 --- libraries/MySensors/MySensor.h | 4 ++-- .../hard_signing_no_whitelisting_full_debug.ino | 12 ++++++++++++ .../hard_signing_whitelisting_full_debug.ino | 12 ++++++++++++ .../soft_signing_no_whitelisting_full_debug.ino | 12 ++++++++++++ .../soft_signing_whitelisting_full_debug.ino | 12 ++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/libraries/MySensors/MySensor.h b/libraries/MySensors/MySensor.h index 36b8bea..9b34525 100644 --- a/libraries/MySensors/MySensor.h +++ b/libraries/MySensors/MySensor.h @@ -40,7 +40,7 @@ * @def MY_NODE_TYPE * @brief Contain a string describing the class of sketch/node (gateway/repeater/sensor). */ -#if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(ARDUINO_ARCH_ESP8266) || defined(MY_GATEWAY_MQTT_CLIENT) +#if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_MQTT_CLIENT) #define MY_GATEWAY_FEATURE #define MY_IS_GATEWAY (true) #define MY_NODE_TYPE "gateway" @@ -292,7 +292,7 @@ #include #if !defined(MY_CORE_ONLY) - #if defined(MY_GATEWAY_ESP8266) + #if defined(ARDUINO_ARCH_ESP8266) #include "core/MyMainESP8266.cpp" #else #include "core/MyMainDefault.cpp" diff --git a/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino index 7cf33bc..a25d379 100644 --- a/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino +++ b/libraries/MySensors/tests/Arduino/sketches/hard_signing_no_whitelisting_full_debug/hard_signing_no_whitelisting_full_debug.ino @@ -30,3 +30,15 @@ #include #include + +void setup() { +} + +void presentation() { + // Present locally attached sensors here +} + + +void loop() { + // Send locally attached sensors data here +} diff --git a/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino index 03835a6..7d0b9af 100644 --- a/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino +++ b/libraries/MySensors/tests/Arduino/sketches/hard_signing_whitelisting_full_debug/hard_signing_whitelisting_full_debug.ino @@ -30,3 +30,15 @@ #include #include + +void setup() { +} + +void presentation() { + // Present locally attached sensors here +} + + +void loop() { + // Send locally attached sensors data here +} diff --git a/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino index 96f6565..9205ff6 100644 --- a/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino +++ b/libraries/MySensors/tests/Arduino/sketches/soft_signing_no_whitelisting_full_debug/soft_signing_no_whitelisting_full_debug.ino @@ -30,3 +30,15 @@ #include #include + +void setup() { +} + +void presentation() { + // Present locally attached sensors here +} + + +void loop() { + // Send locally attached sensors data here +} diff --git a/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino b/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino index 7c44f04..27588fe 100644 --- a/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino +++ b/libraries/MySensors/tests/Arduino/sketches/soft_signing_whitelisting_full_debug/soft_signing_whitelisting_full_debug.ino @@ -30,3 +30,15 @@ #include #include + +void setup() { +} + +void presentation() { + // Present locally attached sensors here +} + + +void loop() { + // Send locally attached sensors data here +}