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
This commit is contained in:
Marcelo Aquino
2017-05-31 17:13:29 +02:00
committed by Patrick Fallberg
parent 4c0661e410
commit 28c4f3f19e
28 changed files with 1083 additions and 737 deletions
Vendored
+17 -8
View File
@@ -91,15 +91,16 @@ MySensors options:
--my-leds-rx-pin=<PIN> Receive LED pin.
--my-leds-tx-pin=<PIN> Transmit LED pin.
--my-leds-blinking-inverse Inverse the blinking feature.
--my-signing=[none|software]
--my-signing=[none|software|password]
Message signing. [none]
--my-signing-debug Enable signing related debug.
--my-signing-request-signatures
Enable signature request from nodes that in turn requested
gateway signature.
--my-signing-request-gw-signatures-from-all
Require all nodes in the network to sign messages sent to the
gateway.
--my-signing-weak_security Enable this to permit downgrade of security preferences and
relaxed gateway signing requirements.
--my-signing-password=<PASSWORD>
If you are using password as the signature type, set your password here.
EOF
}
@@ -459,9 +460,11 @@ for opt do
--my-signing-request-signatures*)
signing_request_signatures=true
;;
--my-signing-request-gw-signatures-from-all*)
signing_request_signatures=true
CPPFLAGS="-DMY_SIGNING_GW_REQUEST_SIGNATURES_FROM_ALL $CPPFLAGS"
--my-signing-weak_security*)
CPPFLAGS="-DMY_SIGNING_WEAK_SECURITY $CPPFLAGS"
;;
--my-signing-password=*)
signing_password=${optarg}
;;
*)
echo "[WARNING] Unknown option detected:$opt, ignored"
@@ -571,8 +574,14 @@ elif [[ ${signing} == "software" ]]; then
if [[ ${signing_request_signatures} == true ]]; then
CPPFLAGS="-DMY_SIGNING_REQUEST_SIGNATURES $CPPFLAGS"
fi
elif [[ ${signing} == "password" ]]; then
if [ -z "${signing_password}" ]; then
die "You need to set the password for signing with --my-signing-password= option" 6
fi
echo "Simplified signing using password"
CPPFLAGS="-DMY_SIGNING_SIMPLE_PASSWD=\\\"${signing_password}\\\" $CPPFLAGS"
else
die "Invalid message signing option." 4
die "Invalid signing type." 7
fi
LDFLAGS="-pthread $LDFLAGS"