Commit Graph
1788 Commits
Author SHA1 Message Date
Rainer Clasen ff0953dd05 Add progmem support for String messages (#875)
added variant of MyMessage::set and sendSketchInfo that accept a
string that's stored in PROGMEM.

This avoids the need to (temporarily) store strings in memory to get
them into a message.
2017-06-21 23:41:48 +02:00
Marcelo Aquino e5221689af Fix keywords.txt (#883)
Replace spaces with tabs.
2017-06-21 20:04:12 +02:00
Marcelo Aquino 95d7c003cb Fix UDP on Ethernet gateway (#858)
- Fix UDP send
- Add a default value for MY_IP_GATEWAY_ADDRESS and
  MY_IP_SUBNET_ADDRESS, making them optional when using MY_IP_ADDRESS
- Add support for MY_IP_GATEWAY_ADDRESS and MY_IP_SUBNET_ADDRESS to
  W5100
2017-06-13 22:59:01 +02:00
Olivier 4820475e5c NRF5: Enable critical section (#879) 2017-06-13 18:49:14 +02:00
Rainer Clasen 59337b19fe Memory optimizations in signing (#874)
* Sha256 driver cosmetics

cosmetic cleanups:
- use actual define that was used to allocate the array
- remove unused file globals

* Save memory by eliminating sha256_hash array

eliminated sha256_hash array to save memory. Instead pass the
Sha256Class result pointer.

There seems to be no use for the extra sha256_hash array as it was
zeroed exactly at the same time, the Sha256Class result was invalidated
(by calling signerSha256Init)

If the result needs to stay around while another sha is calculated,
it's better to have the user taking care of this.

* Moved hmac methods and buffers to separate class

This allows saving the buffer memory if no hmac is needed ... eg. with
the public Signing API.
2017-06-07 08:25:56 +02:00
Patrick Fallberg 29fd6d6345 Let signing backend validate personalization (#873)
For soft signing, let backend handle checksum verification of
personalization data. This ensures that the backends sha256 library is
used and avoids an unnecessary instanitation of the public library.
For atsha204 signing, no checksum verification is made, just chip
locking flags.

Fixes #872
2017-06-06 09:51:37 +02:00
d00616 e6925f69e8 Update more usage of hwGetentropy() (#869)
* Update more usage of hwGetentropy()

* Add hwGetentropy() to Teensy 3.5/3.6
2017-06-03 21:58:40 +02:00
Marcelo Aquino 28c4f3f19e Signing improvements package (#871)
* Signing support with MAX_PAYLOAD>32

Support in the signing backends to handle configurations
where MAX_PAYLOAD is more than 32 bytes.

Fixes #748

* Support big message signatures

Support for signing messages larger than 32 bytes.
This is not fully testable with the current version of
the library but the change would add theoretical support
for signing any sized messages.

Fixes #749

* Have gw properly indicate whitelisting preferences

If the gateway hold a signing whitelist, inform all
nodes of this requirement and not just nodes that hold
whitelists themselves.

Fixes #806

* Harden security

The flag MY_SIGNING_GW_REQUEST_SIGNATURES_FROM_ALL
has been removed. Gateway will now request signatures
from everyone by default.
In addition to this, no nodes in the network will allow
clearing of signing/whitelisting preferences by OTA
commands by default.
If the old behaviour is needed (suitable for gradual
signing roll out and development purposes) a new flag,
MY_SIGNING_WEAK_SECURITY can be set.

Fixes #807

* Signing debug messages rewritten

All signing related debug has been rewritten to
better match other core debug printouts.
Also, backends are updated to have a smaller
implementation delta.

* Simplified signing option implemented

Enable by MY_SIGNING_SIMPLE_PASSWD. Signing, and signing requirements
will be enabled, as will encryption. Whitelisting is optional.
The value provided to MY_SIGNING_SIMPLE_PASSWD is used as HMAC and AES
key. Whitelists use the first 8 bytes of the password and the ninth
byte from the node ID as serial.
Password is required to be at least 8 characters wide. It is zero
padded if it is not long enough to cover the AES (16 bytes) and HMAC
(32 bytes) keys. It is not recommended to have a password shorter than
32 bytes, and there is no need for a password longer than 32 bytes.

* Add documentation section for signing debug

* Add nRF5 encryption to simple signing option

* Restructure MySigning documentation

* Minor fixes for Linux
2017-05-31 17:13:29 +02:00
d00616 4c0661e410 Fix NRF5 radio encryption (#868) 2017-05-29 22:25:43 +02:00
Olivier 60aab1b87b Fix ext. EEPROM update() (#866) 2017-05-27 21:13:30 +02:00
Marcelo Aquino 53d485828c Linux: Fix hwRandomNumberInit() (#861)
Fix #860.
Makes hwRandomNumberInit() independent of hwInit().
2017-05-23 20:34:59 -03:00
d00616 aeceb0b683 Fix rasperry pi hwGetentropy() (#856) 2017-05-23 16:41:46 -03:00
Olivier 97ed21ef3b Teensy3.5/3.6: Use TRNG for random seed (#859) 2017-05-23 20:37:12 +02:00
Olivier b5595e870d Teensy3: Define default radio pins (#857) 2017-05-21 22:22:01 +02:00
Olivier b74805251e Fix RFM69 driver (#855) 2017-05-21 21:39:44 +02:00
Olivier 00a4deddd6 Teensy: Update hwCPUVoltage() (#853) 2017-05-21 16:12:36 +02:00
Marcelo Aquino fb3d936d4c Linux: Binds to MY_IP_ADDRESS in client mode (#849) 2017-05-21 14:27:22 +02:00
Olivier abba1ec377 Minor updates STM32F1 support (#851) 2017-05-21 14:20:07 +02:00
d00616 6c12dddf5a Enhance randomness (AVR, ESP8266, Linux, NRF5) (#845)
This commit changes the way random numbers are available
with MySensors.

The AVR platform uses a 32 Bit random seed build from a floating
analog pin. The way of the generation of this seed is FIPS 140-2
compliant.

For support MCU with a fast way to generate random data, the
hwGetentropy() command is now available to allow rapid generation
of random data.

The ESP8266 platform uses the internal random source for randomness
for hwGetentropy() and Arduino's random() function.

The NRF5 platform initializes the pseudo random number generator
from internal hardware number generator. The internal AES-ECB unit
generates random data after filling with HWRNG data by AES-CBC.

On Linux getrandom() is implemented via syscall().

signerAtsha204SoftGetNonce speed:
AVR = ~14000us (sha204Soft)
NRF51 = ~152us (AES-CBC), 1739us (old sha204Soft)
NRF52 = ~31us (AES-CBC), 183us (old sha204Soft)
ESP8266 = ~20us (RANDOM_REG32), 380us (old sha204Soft)

All Nonce results tested for FIPS 140-2 compliance successfully.
2017-05-21 14:12:09 +02:00
Olivier b479a0cf3f Support for Teensy3 boards (#850) 2017-05-21 08:43:26 +02:00
Olivier e041bf4d74 NRF5: Updates for Jenkins verifier (#852) 2017-05-21 08:41:11 +02:00
Marcelo Aquino 6e648f58da Linux: Fix compilation error for rfm69 (#848) 2017-05-16 08:00:47 +02:00
Marcelo Aquino 14766382d3 Linux: Default SPI driver set to SPIDEV (#847) 2017-05-16 08:00:24 +02:00
Marcelo Aquino 34444a48b3 Linux: Fix compilation error for rfm95 (#846)
Fix #843
2017-05-16 07:59:49 +02:00
Marcelo Aquino 582c653a19 Fix cppcheck includes.cfg (#842) 2017-05-15 07:30:15 +02:00
Marcelo Aquino 2a7145cc15 Linux: Add inclusion mode to gateway example (#841)
Fix #770
2017-05-15 07:29:28 +02:00
Marcelo Aquino 4c52c56605 Linux: Give an error if UDP is selected (#840)
UDP isn't implemented in Linux.
2017-05-15 07:28:49 +02:00
d00616 726a20dad9 Add nrf5 platform (#830)
* Add NVRAM support

This is an EEPROM replacement based on MCU's internal Flash memory.
The NVRAM class is designed to be stateless. Each operation is
written to flash immediately.

The last 16k(nRF51)/32k(nRF52) of Flash memory are managed by the
VirtualPage class.  This class allows writing a single emulated 4k
page up 40,000 times.

The NVRAM class is a log based byte-wise storage allowing up to
40,000,000 writes depending on the number of used addresses.  Each
four allocated addresses from the beginning of the NVRAM reduce the
write log by one.

When first 256 bytes of the emulated storage are used, there is an
average writing capacity of 145,000 cycles per byte.

When the write log is full, the NVRAM is compressed into a new flash
page. After a new page is ready, the old page is released. This
process can take up to 4500 ms and cannot be interrupted.

The NVRAM functionality can easily be ported to ESP8266 or SAMD by
providing a Flash interface.

* Add NRF5 platform support

This is the support of the Nordic Semiconductor NRF51 (nrf51822,
nrf51422) and NRF52 (nrf52832) platform. Based on arduino-nRF5
(https://github.com/sandeepmistry/arduino-nRF5).

The included radio driver is compatible with the NRF24 devices.
Using a SoftDevice (BLE)is not supported and must be removed before
flashing MySensors with a "mass_erase" operation.
2017-05-14 11:53:01 +02:00
Marcelo Aquino a4c7b249c1 Linux: Fix Ethernet client and server (#836)
- Fix documentation.
- Add function close() to client class.
- Function connected() now return true if the connection is in
  stablished state or there is still unread data.
- Update hasClient() to check if any client has disconnected.
- Fix _accept() to better handle the case of maximum clients reached.
- Fix peek() to return the next byte of the read queue.
- Simplifies write() of the server class.
- Implements flush().
- Updates read() to non-blocking type, the same way as in Arduino.
2017-05-13 09:49:16 +02:00
Marcelo Aquino 95f719b604 Linux: Fix interrupt handler (#835)
Minor fix to configure.
2017-05-11 15:20:57 +02:00
Marcelo Aquino fa673bdb3e Linux: Fix rfm69 power level build error (#829) 2017-04-28 19:11:41 +02:00
Marcelo Aquino 66ff5b2880 Linux: Add support for RFM69 (#823) 2017-04-19 22:40:21 +02:00
Marcelo Aquino 4c31e22d6f Restructure RPi files (#827)
- Restructure SPi files for linux and RPi
- Update RPi revision detection (#826)
2017-04-19 22:03:10 +02:00
Olivier 26c237adad Restructure HAL files (arch) (#820) 2017-04-17 20:33:08 +02:00
freynder b4b5eb52e8 Corrections for stm32f1 serial communication (#821)
- use MY_SERIALDEVICE in hwInit
- disable use of MY_SERIALDEVICE.flush() since the current STM32duino
  implementation performs a reset instead of an actual flush.
2017-04-10 23:11:21 +02:00
Embedded Innovation bffc87fe93 Fix clear pending ints for AVR (#816)
Support full AVR range
2017-04-03 21:08:10 +02:00
Dustin aac4562ab0 Clear interrupt flag based on the interrupt used (#815)
The previous code would clear the proper interrupt flag assuming
interrupt1 was INT0 and interrupt2 was INT1. If interrupt1 was INT1 or
interrupt2 was INT0, the sleep bug would be triggered.
2017-04-03 08:53:05 +02:00
Olivier 818f887926 Polishing code (#803) 2017-04-02 20:03:59 +02:00
Embedded Innovation f84960dc28 Fix watchdog sleep calculation (#814)
Round requested sleep time up to next multiple of 16ms, to sleep at
least requested time.
Sleep time of 0 will return immediately.
Fixed watchdog sleep time calculation. AVR libc watchdog time
implementation is inconsistent, and requires larger flash/ram usage.
2017-04-02 19:49:57 +02:00
Patrick Fallberg 7e6db413c7 Security personalizer rewritten (#794)
* Removed ability to lock data section
* Introduced "guided mode" to simplify process
* Refactored the sketch to be less monolithic
* Print details and instructions in tables
* Use device unique ID as serial when
* Calculate and store personalization checksum
* Print serial in a copy+paste friendly manner (fixes #804)
* Clarify meaning of UART confirmation (fixes #805)
2017-04-02 15:37:21 +02:00
Embedded Innovation 3350d79fe6 AVR sleep with external interrupts fixes (#813)
Fixing #812, #811, #809
2017-04-01 15:05:57 +02:00
Olivier b132a8a81e Transport update (#722)
* Major transport rework

* Adjust signal report calculations

* Minor driver optimizations

* Implement sanity check in legacy RFM69 driver

* Additional RFM69 rework

* RFM95 encryption

* Polishing
2017-03-28 20:31:08 +02:00
Olivier 63b8d935c8 Fix RFM95 driver (RPi) (#800) 2017-03-26 11:30:54 +02:00
Olivier cde5d8f7c3 Add STM32F1 HW support (#795) 2017-03-25 20:01:31 +01:00
Marcelo Aquino 72926527be Linux: Configure script update (#797)
Incorporates #756
- Documentation improvements.
- Fix bash warning.
2017-03-21 19:42:58 +01:00
Dustin ef42b3b534 MQTT Client Retain Feature (#793)
Optionally allow MQTT client to publish specific messages with
the retain flag set.

default/current behavior should not be impacted.
2017-03-21 14:47:07 +01:00
Olivier 61a415c422 Code cleanup (#787)
* Cleanup Core

* SAMD adjustments
2017-03-15 19:05:17 +01:00
Olivier 481bd367f3 Add function to retrieve unique ID (if present) (#780) 2017-03-14 18:54:32 +01:00
Soef e7ae5d144e UDP/TCP client mode repaired (#766) 2017-03-07 18:55:40 +01:00
Olivier 7824e12823 I2C eeprom write fix for SAMD (#786)
* I2C eeprom write fix for samd

* Implement extEEPROM library for SAMD
2017-03-06 16:45:58 +01:00