[security] Introducing signing support to MySensors



  • @Anticimex No, the GW I am using is Mega 2560 with W5100 not the sensebender GW.
    It has been working for many months after I resolved a power issue. However, signing is a different thing...


  • Contest Winner

    @alexsh1 seeing your latest log it appears you have rf issues. You have NACKs.



  • @Anticimex It seems that the legacy of nrf24l01+ RF communication is still chasing me ...
    :((((((

    Thank for your help



  • @Anticimex I did manage to make it after swapping a radio module:

    Node log:

    0 MCO:BGN:INIT NODE,CP=RNNNAA-,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSM:INIT:STATID=6
    16 TSF:SID:OK,ID=6
    18 TSM:FPAR
    18 Will not sign message for destination 255 as it does not require it
    61 TSF:MSG:SEND,6-6-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    245 TSF:MSG:READ,0-0-6,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    249 Skipping security for command 3 type 8
    256 TSF:MSG:FPAR OK,ID=0,D=1
    2070 TSM:FPAR:OK
    2070 TSM:ID
    2072 TSM:ID:OK
    2074 TSM:UPL
    2076 Skipping security for command 3 type 24
    2082 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2101 TSF:MSG:READ,0-0-6,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2107 Skipping security for command 3 type 25
    2111 TSF:MSG:PONG RECV,HP=1
    2115 TSM:UPL:OK
    2117 TSM:READY:ID=6,PAR=0,DIS=1
    2119 Signing required
    2123 Skipping security for command 3 type 15
    2129 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2138 Waiting for GW to send signing preferences...
    2166 TSF:MSG:READ,0-0-6,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2172 Skipping security for command 3 type 15
    2179 Mark node 0 as one that require signed messages
    2183 Mark node 0 as one that do not require whitelisting
    2189 Skipping security for command 3 type 16
    2195 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2203 Nonce requested from 0. Waiting...
    2207 Message to send could not be signed!
    2211 !TSF:MSG:SIGN FAIL
    2213 Skipping security for command 3 type 16
    2222 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    2228 Nonce requested from 0. Waiting...
    2232 Message to send could not be signed!
    2236 !TSF:MSG:SIGN FAIL
    2240 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=0:1BE362BF98C9E1F508502D7747DED1F8376FC361937F20CE6A
    2250 Skipping security for command 3 type 17
    2256 Nonce received from 0.
    2258 Proceeding with signing...
    Message to process: 06000E2306FF00
    Current nonce: 1BE362BF98C9E1F508502D7747DED1F8376FC361937F20CE6AAAAAAAAAAAAAAA
    HMAC: 3B9527A241A1BFB1A02E518D14912973BE3D259FC8A6CAFA402A677AEE279E20
    Signature in message: 019527A241A1BFB1A02E518D14912973BE3D259FC8A6CAFA
    2383 Message signed
    2392 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=0:44401CD36C03AD558AA6503466C5DA2F01E5704FDB694FEC79
    2402 Skipping security for command 3 type 17
    2406 Nonce received from 0.
    2410 Proceeding with signing...
    Message to process: 06000E2306FF00
    Current nonce: 44401CD36C03AD558AA6503466C5DA2F01E5704FDB694FEC79AAAAAAAAAAAAAA
    HMAC: D0AE81996EB21C95474594FDB94C39A7632D3742FB4D7C2E75E765037BEE3041
    Signature in message: 01AE81996EB21C95474594FDB94C39A7632D3742FB4D7C2E
    2533 Message signed
    4239 Skipping security for command 3 type 16
    4245 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=OK:
    4253 Nonce requested from 0. Waiting...
    4284 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:E2261FE7028EC3025346CDB70233DAEB1371B5230AAD518FC3
    4296 Skipping security for command 3 type 17
    4300 Nonce received from 0.
    4302 Proceeding with signing...
    4306 Failed to sign message!
    4308 Message to send could not be signed!
    4313 !TSF:MSG:SIGN FAIL
    4317 Skipping security for command 3 type 16
    4323 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    4329 Nonce requested from 0. Waiting...
    4362 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=0:A96C3564F5D0DFAF77FB11B256ED369DFBA6241F5089345413
    4372 Skipping security for command 3 type 17
    4376 Nonce received from 0.
    4380 Proceeding with signing...
    Message to process: 06001E030CFF312E31
    Current nonce: A96C3564F5D0DFAF77FB11B256ED369DFBA6241F5089345413AAAAAAAAAAAAAA
    HMAC: D39D3672372B7BD037D571D8D35F6F6322A7349F3148B40F286ACFA2805B82A2
    Signature in message: 019D3672372B7BD037D571D8D35F6F6322A7349F3148
    4505 Message signed
    4513 Message to send has been signed
    4519 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=12,pt=0,l=3,sg=1,ft=0,st=OK:1.1
    4528 Skipping security for command 3 type 16
    4534 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4542 Nonce requested from 0. Waiting...
    4663 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:F5DCC8A96132142030ACFDE7E7EFC75232D0F27E7CD5845D5D
    4675 Skipping security for command 3 type 17
    4679 Nonce received from 0.
    4681 Proceeding with signing...
    Message to process: 060006000800
    Current nonce: F5DCC8A96132142030ACFDE7E7EFC75232D0F27E7CD5845D5DAAAAAAAAAAAAAA
    HMAC: 9EB71F4EB9B6CF53A94E491367F3BD380C87FF26C413CFD4F2798C8F52BD7A3D
    Signature in message: 01B71F4EB9B6CF53A94E491367F3BD380C87FF26C413CFD4F2
    4806 Message signed
    4814 Message to send has been signed
    4820 TSF:MSG:SEND,6-6-0-0,s=0,c=0,t=8,pt=0,l=0,sg=1,ft=0,st=OK:
    4829 Skipping security for command 3 type 16
    4835 TSF:MSG:SEND,6-6-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4843 Nonce requested from 0. Waiting...
    4966 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:F310284FED0D6C8F5856B3CAD3460974122858DD71EDEFD8F8
    4976 Skipping security for command 3 type 17
    4980 Nonce received from 0.
    4984 Proceeding with signing...
    Message to process: 060006000601
    Current nonce: F310284FED0D6C8F5856B3CAD3460974122858DD71EDEFD8F8AAAAAAAAAAAAAA
    HMAC: 7C53D2D46131415C36657634AF69950186687C143509D199AD8DA3358CB0F636
    Signature in message: 0153D2D46131415C36657634AF69950186687C143509D199AD
    5107 Message signed
    5115 Message to send has been signed
    5122 TSF:MSG:SEND,6-6-0-0,s=1,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    5128 Skipping security for command 3 type 16
    5136 TSF:MSG:SEND,6-6-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5144 Nonce requested from 0. Waiting...
    5265 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:D8B7B2BAC0485BFF1AC6CFB2312B8ABD392E776AE29670ABF1
    5277 Skipping security for command 3 type 17
    5281 Nonce received from 0.
    5283 Proceeding with signing...
    Message to process: 060006000702
    Current nonce: D8B7B2BAC0485BFF1AC6CFB2312B8ABD392E776AE29670ABF1AAAAAAAAAAAAAA
    HMAC: FC0F44D95CCF58C065DFD54B4AD7A4222067560BB3957088E7FC1D4AF82E4FF8
    Signature in message: 010F44D95CCF58C065DFD54B4AD7A4222067560BB3957088E7
    5408 Message signed
    5416 Message to send has been signed
    5427 TSF:MSG:SEND,6-6-0-0,s=2,c=0,t=7,pt=0,l=0,sg=1,ft=0,st=OK:
    5433 Skipping security for command 3 type 16
    5441 TSF:MSG:SEND,6-6-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    5447 Nonce requested from 0. Waiting...
    5568 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:01075582171E1B52EF26C04A9F6CD20BF2A4B690F430131644
    5578 Skipping security for command 3 type 17
    5584 Nonce received from 0.
    5586 Proceeding with signing...
    Message to process: 060006000D03
    Current nonce: 01075582171E1B52EF26C04A9F6CD20BF2A4B690F430131644AAAAAAAAAAAAAA
    HMAC: 15723FF6A4D539DE67CD75B2D42D7743012DAADD2282DF2C54633BB2A0426467
    Signature in message: 01723FF6A4D539DE67CD75B2D42D7743012DAADD2282DF2C54
    5711 Message signed
    5720 Message to send has been signed
    5726 TSF:MSG:SEND,6-6-0-0,s=3,c=0,t=13,pt=0,l=0,sg=1,ft=0,st=OK:
    5732 MCO:REG:REQ
    5734 Skipping security for command 3 type 26
    5742 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=0,st=OK:2
    5851 TSF:MSG:READ,0-0-6,s=255,c=3,t=16,pt=0,l=0,sg=1:
    5857 Skipping security for command 3 type 16
    SHA256: 28366C70B76446E6C5DC055CC58108A110D2C824AB7F3F1B642845A9C0D087AE
    5937 Skipping security for command 3 type 17
    5949 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:28366C70B76446E6C5DC055CC58108A110D2C824AB7F3F1B64
    5961 Transmitted nonce
    6078 TSF:MSG:READ,0-0-6,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    Signature in message: 016CD1F0B409A5501C07F29F8D0CD5C1B7E39D86D679C9BB
    Message to process: 00060E231BFF01
    Current nonce: 28366C70B76446E6C5DC055CC58108A110D2C824AB7F3F1B64AAAAAAAAAAAAAA
    HMAC: 1F6CD1F0B409A5501C07F29F8D0CD5C1B7E39D86D679C9BB62AA56E3DA35E996
    6207 MCO:PIM:NODE REG=1
    6213 MCO:BGN:STP
    BME280 Pressure Sensor1.1isMetric: 1
    6535 Skipping security for command 3 type 16
    6543 TSF:MSG:SEND,6-6-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6549 Nonce requested from 0. Waiting...
    6580 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:F8B4C6C225F5F91BE58A32A2B45F8ACFA2D9BBC0C56DF1704E
    6592 Skipping security for command 3 type 17
    6596 Nonce received from 0.
    6598 Proceeding with signing...
    Message to process: 06002EE126033333534002
    Current nonce: F8B4C6C225F5F91BE58A32A2B45F8ACFA2D9BBC0C56DF1704EAAAAAAAAAAAAAA
    HMAC: 738C2FFDEAA1208BFA4FAA139FFEB6DD08D9A3DDE5575DC11A40A9CB7A892B49
    Signature in message: 018C2FFDEAA1208BFA4FAA139FFEB6DD08D9A3DD
    6721 Message signed
    6729 Message to send has been signed
    6735 TSF:MSG:SEND,6-6-0-0,s=3,c=1,t=38,pt=7,l=5,sg=1,ft=0,st=OK:3.30
    6744 Skipping security for command 3 type 16
    6754 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    6762 Nonce requested from 0. Waiting...
    6881 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:1EF21E9C248C620832C15B2B31BFA59494E58B0025A12105C7
    6891 Skipping security for command 3 type 17
    6897 Nonce received from 0.
    6899 Proceeding with signing...
    Message to process: 06000E2300FF6B
    Current nonce: 1EF21E9C248C620832C15B2B31BFA59494E58B0025A12105C7AAAAAAAAAAAAAA
    HMAC: 2EA40330191EBC1C034C9B5FE86F15BB200C897E39C01A6A001387F54A7AC87E
    Signature in message: 01A40330191EBC1C034C9B5FE86F15BB200C897E39C01A6A
    7026 Message signed
    7034 Message to send has been signed
    7041 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=0,pt=1,l=1,sg=1,ft=0,st=OK:107
    7049 MCO:BGN:INIT OK,TSP=1
    Temperature = 25.59 *C
    Humidity = 47.27 %
    Pressure = 993.82 hPa
    Forecast = unknown
    7061 Skipping security for command 3 type 16
    7071 TSF:MSG:SEND,6-6-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7079 Nonce requested from 0. Waiting...
    7084 Message to send could not be signed!
    7088 !TSF:MSG:SIGN FAIL
    7090 Skipping security for command 3 type 16
    7096 TSF:MSG:SEND,6-6-0-0,s=2,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    7104 Nonce requested from 0. Waiting...
    7186 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:A534CA40967C4BF2319ECB1E9F78A46DAE29876C512FA43068
    7196 Skipping security for command 3 type 17
    7202 Nonce received from 0.
    7204 Proceeding with signing...
    Message to process: 0600160407E307FD
    Current nonce: A534CA40967C4BF2319ECB1E9F78A46DAE29876C512FA43068AAAAAAAAAAAAAA
    HMAC: DF63A40176DC348626CCF63EF31FDF9B381922BBA1035A00F48475B533B1FFB8
    Signature in message: 0163A40176DC348626CCF63EF31FDF9B381922BBA1035A
    7331 Message signed
    7340 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=0:CDABB60B9D503D264DE301FC0E70DBB3F14A5682D1D519643A
    7352 Skipping security for command 3 type 17
    7356 Nonce received from 0.
    7358 Proceeding with signing...
    Message to process: 0600160407E30802
    Current nonce: CDABB60B9D503D264DE301FC0E70DBB3F14A5682D1D519643AAAAAAAAAAAAAAA
    HMAC: B9D87BB4381C95DE3F87DB59BF7F8A3B78596AB1779ABD8A9D7000539D0FC9B3
    Signature in message: 01D87BB4381C95DE3F87DB59BF7F8A3B78596AB1779ABD
    7483 Message signed
    7491 Message to send has been signed
    7497 TSF:MSG:SEND,6-6-0-0,s=227,c=4,t=7,pt=0,l=2,sg=1,ft=0,st=OK:
    7505 Skipping security for command 3 type 16
    7512 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    7520 Nonce requested from 0. Waiting...
    7524 Message to send could not be signed!
    7528 !TSF:MSG:SIGN FAIL
    7530 Skipping security for command 3 type 16
    7536 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
    7544 Nonce requested from 0. Waiting...
    7548 Message to send could not be signed!
    7553 !TSF:MSG:SIGN FAIL
    7606 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255
    7612 MCO:SLP:TPD
    

    But it still throws many SIGN FAIL.


  • Contest Winner

    @alexsh1 the log still looks like you sometimes don't get the nonce you requested so signing times out and fails. I am still quite sure that if you looked in the log on the other side, it would show NACKs on some nonce transmissions. Signing won't work when those fail.



  • @Anticimex This is what we discussed before, this is not a signing issue. Guess what? I did notice that RF is much better with non-amplified nrf24l01+. Given my experience in the past with nrf24l01+ pa+lna, I have just soldered out and replaced AMS1117-3.3V (Mega 2560 works on 5V so I need a stable 3.3V source, which I cannot take from Mega's 3.3V pin for a hungry nrf24l01+pa+lna) and signing started working!

    0 MCO:BGN:INIT NODE,CP=RNNNAS-,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSM:INIT:STATID=15
    16 TSF:SID:OK,ID=15
    18 TSM:FPAR
    20 Will not sign message for destination 255 as it does not require it
    63 TSF:MSG:SEND,15-15-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    1026 TSF:MSG:READ,0-0-15,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    1032 Skipping security for command 3 type 8
    1038 TSF:MSG:FPAR OK,ID=0,D=1
    2070 TSM:FPAR:OK
    2070 TSM:ID
    2072 TSM:ID:OK
    2074 TSM:UPL
    2076 Skipping security for command 3 type 24
    2082 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2111 TSF:MSG:READ,0-0-15,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2117 Skipping security for command 3 type 25
    2121 TSF:MSG:PONG RECV,HP=1
    2123 TSM:UPL:OK
    2125 TSM:READY:ID=15,PAR=0,DIS=1
    2129 Signing required
    2131 Skipping security for command 3 type 15
    2140 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2148 Waiting for GW to send signing preferences...
    2181 TSF:MSG:READ,0-0-15,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2187 Skipping security for command 3 type 15
    2191 Mark node 0 as one that require signed messages
    2197 Mark node 0 as one that do not require whitelisting
    2203 Skipping security for command 3 type 16
    2211 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2220 Nonce requested from 0. Waiting...
    2275 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=0:BC9F06296E185623C02C586CECB3CBA37A7AD097699C918CB1
    2287 Skipping security for command 3 type 17
    2291 Nonce received from 0.
    2295 Proceeding with signing...
    Message to process: 0F002E0011FF322E312E31
    Current nonce: BC9F06296E185623C02C586CECB3CBA37A7AD097699C918CB1AAAAAAAAAAAAAA
    HMAC: D96C3B9964666D36495BBAF4E6C4E414088A553065E8CCA764CD8DF65D6353CA
    Signature in message: 016C3B9964666D36495BBAF4E6C4E414088A5530
    2469 Message signed
    2478 Message to send has been signed
    2486 TSF:MSG:SEND,15-15-0-0,s=255,c=0,t=17,pt=0,l=5,sg=1,ft=0,st=OK:2.1.1
    2494 Skipping security for command 3 type 16
    2502 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    2510 Nonce requested from 0. Waiting...
    2643 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:556C16AFC48CBCC8758A6D0BA0CA9920BAAFB13290AC599CC1
    2656 Skipping security for command 3 type 17
    2660 Nonce received from 0.
    2662 Proceeding with signing...
    Message to process: 0F000E2306FF00
    Current nonce: 556C16AFC48CBCC8758A6D0BA0CA9920BAAFB13290AC599CC1AAAAAAAAAAAAAA
    HMAC: 598965B2F76BF9805E79A23C9CDBEA71A5F0B5749D4E2FA44C3DEDDAD21B3238
    Signature in message: 018965B2F76BF9805E79A23C9CDBEA71A5F0B5749D4E2FA4
    2838 Message signed
    2844 Message to send has been signed
    2854 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=6,pt=1,l=1,sg=1,ft=0,st=OK:0
    3801 TSF:MSG:READ,0-0-15,s=255,c=3,t=16,pt=0,l=0,sg=1:
    3807 Skipping security for command 3 type 16
    SHA256: 46DEE622257BDFA07B804BA9C02440CC083DC010C7A609123900000000000000
    3842 Skipping security for command 3 type 17
    3858 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:46DEE622257BDFA07B804BA9C02440CC083DC010C7A6091239
    3870 Transmitted nonce
    4012 TSF:MSG:READ,0-0-15,s=255,c=3,t=6,pt=0,l=1,sg=1:M
    Signature in message: 018AF802A7325E4D37B322FA8B0F4BA61CA5DF6548CEE589
    Message to process: 000F0E0306FF4D
    Current nonce: 46DEE622257BDFA07B804BA9C02440CC083DC010C7A6091239AAAAAAAAAAAAAA
    HMAC: DA8AF802A7325E4D37B322FA8B0F4BA61CA5DF6548CEE58953ADF17286D22669
    4190 Skipping security for command 3 type 16
    4202 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4208 Nonce requested from 0. Waiting...
    4255 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:90818AAA44B6AFD7880153E7AA7E981981744CC98028809A09
    4265 Skipping security for command 3 type 17
    4272 Nonce received from 0.
    4274 Proceeding with signing...
    Message to process: 0F00B6030BFF424D503238302050726573737572652053656E736F72
    Current nonce: 90818AAA44B6AFD7880153E7AA7E981981744CC98028809A09AAAAAAAAAAAAAA
    HMAC: 486FAFD76801F66D900E883F2C012B7104EE043ABC68E0AE894D0026E9D7A8AB
    Signature in message: 016FAF
    4448 Message signed
    4456 Message to send has been signed
    4466 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=11,pt=0,l=22,sg=1,ft=0,st=OK:BMP280 Pressure Sensor
    4476 Skipping security for command 3 type 16
    4483 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4491 Nonce requested from 0. Waiting...
    4642 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:A3B017C2562256E455C640C28667B9BB3D3062687A5C49160C
    4655 Skipping security for command 3 type 17
    4659 Nonce received from 0.
    4661 Proceeding with signing...
    Message to process: 0F001E030CFF312E31
    Current nonce: A3B017C2562256E455C640C28667B9BB3D3062687A5C49160CAAAAAAAAAAAAAA
    HMAC: F27274FF114AE80AE6217C1B2B80A322AB82697AF3BFBE59BC53069948AA234A
    Signature in message: 017274FF114AE80AE6217C1B2B80A322AB82697AF3BF
    4837 Message signed
    4843 Message to send has been signed
    4853 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=12,pt=0,l=3,sg=1,ft=0,st=OK:1.1
    4861 Skipping security for command 3 type 16
    4868 TSF:MSG:SEND,15-15-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    4876 Nonce requested from 0. Waiting...
    9881 Timeout waiting for nonce!
    9883 !TSF:MSG:SIGN FAIL
    9885 Skipping security for command 3 type 16
    9895 TSF:MSG:SEND,15-15-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=OK:
    9904 Nonce requested from 0. Waiting...
    9957 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:B91AB74E50528ACC3F64B480A47D6CEB269E2EA48004C57A7F
    9967 Skipping security for command 3 type 17
    9971 Nonce received from 0.
    9975 Proceeding with signing...
    Message to process: 0F0006000601
    Current nonce: B91AB74E50528ACC3F64B480A47D6CEB269E2EA48004C57A7FAAAAAAAAAAAAAA
    HMAC: A95DB25F392535043F3DEA960F6C2136115A29AF51F6B11D4E0BFFB7ABE9946E
    Signature in message: 015DB25F392535043F3DEA960F6C2136115A29AF51F6B11D4E
    10149 Message signed
    10158 Message to send has been signed
    10168 TSF:MSG:SEND,15-15-0-0,s=1,c=0,t=6,pt=0,l=0,sg=1,ft=0,st=OK:
    10174 Skipping security for command 3 type 16
    10182 TSF:MSG:SEND,15-15-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    10188 Nonce requested from 0. Waiting...
    15194 Message to send could not be signed!
    15198 !TSF:MSG:SIGN FAIL
    15200 MCO:REG:REQ
    15202 Skipping security for command 3 type 26
    15212 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=1,st=OK:2
    15230 TSF:MSG:READ,0-0-15,s=255,c=3,t=16,pt=0,l=0,sg=1:
    15237 Skipping security for command 3 type 16
    SHA256: 6F1E9148E2B8755A2B5019D803BBE9E531F1B5507406B58820AAAAAAAAAAAAAA
    15271 Skipping security for command 3 type 17
    15286 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:6F1E9148E2B8755A2B5019D803BBE9E531F1B5507406B58820
    15298 Transmitted nonce
    15429 TSF:MSG:READ,0-0-15,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    Signature in message: 01B4B105F62283F53943B57B3B2B034B44DA23B4D71C97A1
    Message to process: 000F0E231BFF01
    Current nonce: 6F1E9148E2B8755A2B5019D803BBE9E531F1B5507406B58820AAAAAAAAAAAAAA
    HMAC: B3B4B105F62283F53943B57B3B2B034B44DA23B4D71C97A14CE49895135B98FA
    15607 MCO:PIM:NODE REG=1
    15613 MCO:BGN:STP
    Pressure Sensor BMP280 1.1
    isMetric: 1
    15628 Skipping security for command 3 type 16
    15638 TSF:MSG:SEND,15-15-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    15646 Nonce requested from 0. Waiting...
    15683 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:4EDBAA807BB751EFD72E54A450E8B76C3B45D503270FF3C9C6
    15693 Skipping security for command 3 type 17
    15699 Nonce received from 0.
    15702 Proceeding with signing...
    Message to process: 0F002EE1260285EB514002
    Current nonce: 4EDBAA807BB751EFD72E54A450E8B76C3B45D503270FF3C9C6AAAAAAAAAAAAAA
    HMAC: 66D0E5314979BE6AC80387B12A6A8CF79AAB4C325F64A6762176D35C4E36C369
    Signature in message: 01D0E5314979BE6AC80387B12A6A8CF79AAB4C32
    15878 Message signed
    15884 Message to send has been signed
    15894 TSF:MSG:SEND,15-15-0-0,s=2,c=1,t=38,pt=7,l=5,sg=1,ft=0,st=OK:3.28
    15902 Skipping security for command 3 type 16
    15910 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    15919 Nonce requested from 0. Waiting...
    16048 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:7E290F0590861636DF52F69D21796856F958F03E7956953C8D
    16060 Skipping security for command 3 type 17
    16064 Nonce received from 0.
    16068 Proceeding with signing...
    Message to process: 0F000E2300FF69
    Current nonce: 7E290F0590861636DF52F69D21796856F958F03E7956953C8DAAAAAAAAAAAAAA
    HMAC: 164ABE25D777EE3EA65F536ADE147D60B404561D07A26CA156E25EBB234507E0
    Signature in message: 014ABE25D777EE3EA65F536ADE147D60B404561D07A26CA1
    16242 Message signed
    16250 Message to send has been signed
    16261 TSF:MSG:SEND,15-15-0-0,s=255,c=3,t=0,pt=1,l=1,sg=1,ft=0,st=OK:105
    16269 MCO:BGN:INIT OK,TSP=1
    Temperature = 24.96 *C
    Pressure = 997.80 mBar
    Forecast = unknown
    16277 Skipping security for command 3 type 16
    16287 TSF:MSG:SEND,15-15-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    16295 Nonce requested from 0. Waiting...
    16410 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:E4C3BDA88C3EFFD0A435849C1199E79C9D2B215FA1D05A7E76
    16422 Skipping security for command 3 type 17
    16427 Nonce received from 0.
    16431 Proceeding with signing...
    Message to process: 0F002EE1000114AEC74101
    Current nonce: E4C3BDA88C3EFFD0A435849C1199E79C9D2B215FA1D05A7E76AAAAAAAAAAAAAA
    HMAC: 144BFD3C6A7CBE0DC1CCEEC102FDA3E3A15C1A5A22BA604A5F5CAEE2F682BE37
    Signature in message: 014BFD3C6A7CBE0DC1CCEEC102FDA3E3A15C1A5A
    16605 Message signed
    16613 Message to send has been signed
    16623 TSF:MSG:SEND,15-15-0-0,s=1,c=1,t=0,pt=7,l=5,sg=1,ft=0,st=OK:25.0
    16631 Skipping security for command 3 type 16
    16637 TSF:MSG:SEND,15-15-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    16646 Nonce requested from 0. Waiting...
    16766 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:0E091DD4985125377E63651907B9830D4D7265831F17FD65FE
    16779 Skipping security for command 3 type 17
    16783 Nonce received from 0.
    16787 Proceeding with signing...
    Message to process: 0F002EE104002973794400
    Current nonce: 0E091DD4985125377E63651907B9830D4D7265831F17FD65FEAAAAAAAAAAAAAA
    HMAC: A157ECB56A03D70529E1F9A26D972AF3EB1332FB20E2A3CDD909D5A8B9F7A8C4
    Signature in message: 0157ECB56A03D70529E1F9A26D972AF3EB1332FB
    16961 Message signed
    16969 Message to send has been signed
    16975 TSF:MSG:SEND,15-15-0-0,s=0,c=1,t=4,pt=7,l=5,sg=1,ft=0,st=OK:998
    16984 Skipping security for command 3 type 16
    16992 TSF:MSG:SEND,15-15-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    16998 Nonce requested from 0. Waiting...
    17129 TSF:MSG:READ,0-0-15,s=255,c=3,t=17,pt=6,l=25,sg=1:E7504291BD4FE363A66BD9A571064AFEB381F5282651DB1040
    17141 Skipping security for command 3 type 17
    17145 Nonce received from 0.
    17149 Proceeding with signing...
    Message to process: 0F003E010500756E6B6E6F776E
    Current nonce: E7504291BD4FE363A66BD9A571064AFEB381F5282651DB1040AAAAAAAAAAAAAA
    HMAC: 9E56ED49FE4589E4F61D7A954CF433334527DB1D8BC515183834201570327BF5
    Signature in message: 0156ED49FE4589E4F61D7A954CF433334527
    17324 Message signed
    17332 Message to send has been signed
    17342 TSF:MSG:SEND,15-15-0-0,s=0,c=1,t=5,pt=0,l=7,sg=1,ft=0,st=OK:unknown
    17448 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255
    17455 MCO:SLP:TPD
    
    

    This is the second time I change AMS1117 in one year. Very odd
    Anyway, very much appreciate your help on signing! Very helpful


  • Contest Winner

    @alexsh1 glad you got it working again 🙂



  • @Anticimex Last time, I took me moths to resolve it. AMS1117 has not failed completely, but was working intermittently. This had a major impact on how nrf24l01+pa+lna was working. Unfortunately, range and signing were affected.
    My theory is that it is getting probably 45-50C in my GW - there are many wires and it is a very tight fit. This may contribute in such AMS1117 behavior. Or probably just a bad batch.


  • Contest Winner

    @alexsh1 sounds like it. I've always considered the AMS1117 to be a trustworthy part.



  • @Anticimex it seems that replacing AMS1117 has resolved the issue.

    I have a poor reception in one particular place and was thinking about a repeater node. Is signing working fine with the repeater node (both the node and the repeater are going to force signing by "MY_SIGNING_REQUEST_SIGNATURES"? Just curious


  • Contest Winner

    @alexsh1 repeaters support signing even if it isn't enabled on the repeater. It simply forwards the message and signature (and nonce).
    Glad you resolved the issue 👍



  • @Anticimex so no need to enable signing if this is just a repeater node? (No sleeping just waiting)

    Yeah, every time it takes me quicker and quicker to troubleshoot mysensors 😉
    Obviously, thanks to your excellent support


  • Contest Winner

    @alexsh1 it never hurts to enable signing. It is not the same as requiring signatures. But no, you should not have to. I am just glad to help 🙂



  • I have been playing with 2.2.0 beta
    Security personalisation went fine for sensebender GW (serial), but signing is not working. Any ideas please?

    0;255;3;0;9;4840 MCO:BGN:INIT GW,CP=RNNGSA--,VER=2.2.0-beta
    0;255;3;0;9;4964 Could not read ATSHA204A lock config, refusing to use backend```

  • Contest Winner

    @alexsh1 only that you have the atsha pin misconfigured in your gw sketch.



  • @Anticimex This is a standard GW sketch:
    atsha204 pin is A3 (17). Cannot understand whats wrong...

    /**
    * 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 <henrik.ekblad@mysensors.org>
    * 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.
    *
    *******************************
    *
    * DESCRIPTION
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on seral which will be sent out on radio network.
    *
    * The GW code is designed for Arduino Nano 328p / 16MHz
    *
    * Wire connections (OPTIONAL):
    * - Inclusion button should be connected between digital pin 3 and GND
    * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    *
    * LEDs (OPTIONAL):
    * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
    * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
    * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
    * - ERR (red) - fast blink on error during transmission error or recieve crc error
    *
    */
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_SIGNING
    #define MY_SPECIAL_DEBUG
    
    #define MY_SIGNING_ATSHA204
    #define MY_SIGNING_REQUEST_SIGNATURES
    #define MY_SIGNING_ATSHA204_PIN 17
    
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define MY_NODE_ID 18
    //#define MY_PARENT_NODE_ID 0
    //#define MY_RADIO_RFM69
    
    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors
    }
    
    void loop()
    {
    	// Send locally attached sensor data here
    }
    

  • Contest Winner

    @alexsh1 I don't think A3 is valid for samd targets.


  • Contest Winner

    @alexsh1 there is a special gw sketch for the SenseBender gw. Are you using that? SensebenderGatewaySerial.ino


  • Contest Winner

    @alexsh1 I think the SenseBender automatically assigns the appropriate atsha pin so if you run the SenseBender gw sketch you should not need to configure it.



  • @Anticimex No, I was using a standard GW Serial sketch. I cannot compile the sensebenderserial.ino under 2.2.0 dev:

    ........................
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:6:16: error: redefinition of 'uint8_t device_pin'
    
     static uint8_t device_pin;
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:6:16: error: 'uint8_t device_pin' previously declared here
    
     static uint8_t device_pin;
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void swi_set_signal_pin(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:23:13: error: redefinition of 'void swi_set_signal_pin(uint8_t)'
    
     static void swi_set_signal_pin(uint8_t is_high)
    
                 ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:23:13: error: 'void swi_set_signal_pin(uint8_t)' previously defined here
    
     static void swi_set_signal_pin(uint8_t is_high)
    
                 ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_send_bytes(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:34:16: error: redefinition of 'uint8_t swi_send_bytes(uint8_t, uint8_t*)'
    
     static uint8_t swi_send_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:34:16: error: 'uint8_t swi_send_bytes(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t swi_send_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_send_byte(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:73:16: error: redefinition of 'uint8_t swi_send_byte(uint8_t)'
    
     static uint8_t swi_send_byte(uint8_t value)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:73:16: error: 'uint8_t swi_send_byte(uint8_t)' previously defined here
    
     static uint8_t swi_send_byte(uint8_t value)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:78:16: error: redefinition of 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)'
    
     static uint8_t swi_receive_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:78:16: error: 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t swi_receive_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:177:16: error: redefinition of 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)'
    
     static uint8_t sha204p_receive_response(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:177:16: error: 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t sha204p_receive_response(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_resync(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:211:16: error: redefinition of 'uint8_t sha204c_resync(uint8_t, uint8_t*)'
    
     static uint8_t sha204c_resync(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:211:16: error: 'uint8_t sha204c_resync(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t sha204c_resync(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:233:16: error: redefinition of 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)'
    
     static uint8_t sha204c_send_and_receive(uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer,
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:233:16: error: 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)' previously defined here
    
     static uint8_t sha204c_send_and_receive(uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer,
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:377:13: error: redefinition of 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)'
    
     static void sha204c_calculate_crc(uint8_t length, uint8_t *data, uint8_t *crc)
    
                 ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:377:13: error: 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)' previously defined here
    
     static void sha204c_calculate_crc(uint8_t length, uint8_t *data, uint8_t *crc)
    
                 ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_check_crc(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:402:16: error: redefinition of 'uint8_t sha204c_check_crc(uint8_t*)'
    
     static uint8_t sha204c_check_crc(uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:402:16: error: 'uint8_t sha204c_check_crc(uint8_t*)' previously defined here
    
     static uint8_t sha204c_check_crc(uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_init(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:416:6: error: redefinition of 'void atsha204_init(uint8_t)'
    
     void atsha204_init(uint8_t pin)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:416:6: error: 'void atsha204_init(uint8_t)' previously defined here
    
     void atsha204_init(uint8_t pin)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_idle()':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:433:6: error: redefinition of 'void atsha204_idle()'
    
     void atsha204_idle(void)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:433:6: error: 'void atsha204_idle()' previously defined here
    
     void atsha204_idle(void)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_sleep()':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:438:6: error: redefinition of 'void atsha204_sleep()'
    
     void atsha204_sleep(void)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:438:6: error: 'void atsha204_sleep()' previously defined here
    
     void atsha204_sleep(void)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_wakeup(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:443:9: error: redefinition of 'uint8_t atsha204_wakeup(uint8_t*)'
    
     uint8_t atsha204_wakeup(uint8_t *response)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:443:9: error: 'uint8_t atsha204_wakeup(uint8_t*)' previously defined here
    
     uint8_t atsha204_wakeup(uint8_t *response)
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:473:9: error: redefinition of 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)'
    
     uint8_t atsha204_execute(uint8_t op_code, uint8_t param1, uint16_t param2,
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:473:9: error: 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)' previously defined here
    
     uint8_t atsha204_execute(uint8_t op_code, uint8_t param1, uint16_t param2,
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_getSerialNumber(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:549:9: error: redefinition of 'uint8_t atsha204_getSerialNumber(uint8_t*)'
    
     uint8_t atsha204_getSerialNumber(uint8_t * response)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:549:9: error: 'uint8_t atsha204_getSerialNumber(uint8_t*)' previously defined here
    
     uint8_t atsha204_getSerialNumber(uint8_t * response)
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:578:9: error: redefinition of 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)'
    
     uint8_t atsha204_read(uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t zone, uint16_t address)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_501069\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:578:9: error: 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)' previously defined here
    
     uint8_t atsha204_read(uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t zone, uint16_t address)
    
             ^
    
    Multiple libraries were found for "SD.h"
     Used: C:\Users\Alex\Documents\Arduino\libraries\SD
     Not used: C:\Program Files (x86)\Arduino\libraries\SD
    Using library MySensors at version 2.2.0-beta in folder: C:\Users\Alex\Documents\Arduino\libraries\MySensors 
    Using library Wire at version 1.0 in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\Wire 
    Using library SPI at version 1.0 in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\SPI 
    Using library SD at version 1.1.1 in folder: C:\Users\Alex\Documents\Arduino\libraries\SD 
    exit status 1
    Error compiling for board Sensebender Gateway.
    

  • Contest Winner

    @alexsh1 Well, you need to use the sensebenderserial.ino if you want to run a serial gw on the sensebender board.
    Why have you modified the sketch? You should not touch HW configurations for the sensebender sketch as it is a predefined board unless you have a customized sensebender board or made your own PCB.



  • @Anticimex All I modified was adding this for signing:

    #define MY_SIGNING_ATSHA204
    #define MY_SIGNING_REQUEST_SIGNATURES
    #define MY_SIGNING_ATSHA204_PIN 17
    

    Is signing working without these lines on SAMD?


  • Contest Winner

    @alexsh1 Yes but why? The sensebender is not a AVR board. How do you know that "pin 17" is valid pin for ATSHA in a sensebender board? I can almost guarantee that it is not, and if you have picked the board in the board manager as your target board, the appropriate ATSHA pin will be configured for you. You do not need to (and in fact you should not) define a pin for the ATSHA on a sensebender board, as it is natively supported by the board.
    So what you have done here is to actually override the default for the board to something that is wrong, so communication with the atsha will fail, as it uses the wrong pin.
    Edit: And no, signing will not work if you have not enabled it. You have to enable MY_SIGNING_ATSHA204 (or MY_SIGNING_SOFT) to support signing in all cases. Requesting signatures is depending on your personal preference. The pin should only be defined if you know what it is supposed to be for your target HW. Usually it is automatically assigned if the board is "known".



  • @Anticimex You are right - I am looking into the sensebender GW docs and I think it is PA11 pin where pin 3 of atsha204 is connected. Apologies - my experience with SAMD is still very limited. I deleted the three lines above with signing and the sketch does compile. However, as soon as I add:

    #define MY_SIGNING_ATSHA204
    

    Compiling breaks


  • Contest Winner

    @alexsh1 Can you please be a bit more elaborate on what "Compiling breaks" mean? @tbowmo a known issue?



  • @Anticimex @tbowmo OK, I take a default sensebenderserial.ino sketch and add one line for signing "#define MY_SIGNING_ATSHA204" and have the following errors (2.2.0-dev):

    Generating function prototypes...
    "C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions  -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10801 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x1209 -DUSB_PID=0x6949 -DUSBCON '-DUSB_MANUFACTURER="MySensors.org"' '-DUSB_PRODUCT="Sensebender GW"' "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0/CMSIS/Include/" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.1.0/CMSIS/Device/ATMEL/" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\cores\arduino" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\MySensors\hardware\samd\1.0.5\variants\mysensors_gw" "-IC:\Users\Alex\Documents\Arduino\libraries\MySensors" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\Wire" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\SPI" "-IC:\Users\Alex\Documents\Arduino\libraries\SD\src" "C:\Users\Alex\AppData\Local\Temp\arduino_build_980458\sketch\SensebenderGatewaySerial.ino.cpp" -o "C:\Users\Alex\AppData\Local\Temp\arduino_build_980458\preproc\ctags_target_for_gcc_minus_e.cpp"
    "C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Alex\AppData\Local\Temp\arduino_build_980458\preproc\ctags_target_for_gcc_minus_e.cpp"
    Compiling sketch...
    "C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10801 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD  -D__SAMD21G18A__ -DUSB_VID=0x1209 -DUSB_PID=0x6949 -DUSBCON '-DUSB_MANUFACTURER="MySensors.org"' '-DUSB_PRODUCT="Sensebender GW"' "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0/CMSIS/Include/" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.1.0/CMSIS/Device/ATMEL/" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\cores\arduino" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\MySensors\hardware\samd\1.0.5\variants\mysensors_gw" "-IC:\Users\Alex\Documents\Arduino\libraries\MySensors" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\Wire" "-IC:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\SPI" "-IC:\Users\Alex\Documents\Arduino\libraries\SD\src" "C:\Users\Alex\AppData\Local\Temp\arduino_build_980458\sketch\SensebenderGatewaySerial.ino.cpp" -o "C:\Users\Alex\AppData\Local\Temp\arduino_build_980458\sketch\SensebenderGatewaySerial.ino.cpp.o"
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:6:16: error: redefinition of 'uint8_t device_pin'
    
     static uint8_t device_pin;
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:6:16: error: 'uint8_t device_pin' previously declared here
    
     static uint8_t device_pin;
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void swi_set_signal_pin(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:23:13: error: redefinition of 'void swi_set_signal_pin(uint8_t)'
    
     static void swi_set_signal_pin(uint8_t is_high)
    
                 ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:23:13: error: 'void swi_set_signal_pin(uint8_t)' previously defined here
    
     static void swi_set_signal_pin(uint8_t is_high)
    
                 ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_send_bytes(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:34:16: error: redefinition of 'uint8_t swi_send_bytes(uint8_t, uint8_t*)'
    
     static uint8_t swi_send_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:34:16: error: 'uint8_t swi_send_bytes(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t swi_send_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_send_byte(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:73:16: error: redefinition of 'uint8_t swi_send_byte(uint8_t)'
    
     static uint8_t swi_send_byte(uint8_t value)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:73:16: error: 'uint8_t swi_send_byte(uint8_t)' previously defined here
    
     static uint8_t swi_send_byte(uint8_t value)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:78:16: error: redefinition of 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)'
    
     static uint8_t swi_receive_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:78:16: error: 'uint8_t swi_receive_bytes(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t swi_receive_bytes(uint8_t count, uint8_t *buffer)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:177:16: error: redefinition of 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)'
    
     static uint8_t sha204p_receive_response(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:177:16: error: 'uint8_t sha204p_receive_response(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t sha204p_receive_response(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_resync(uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:211:16: error: redefinition of 'uint8_t sha204c_resync(uint8_t, uint8_t*)'
    
     static uint8_t sha204c_resync(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:211:16: error: 'uint8_t sha204c_resync(uint8_t, uint8_t*)' previously defined here
    
     static uint8_t sha204c_resync(uint8_t size, uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:233:16: error: redefinition of 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)'
    
     static uint8_t sha204c_send_and_receive(uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer,
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:233:16: error: 'uint8_t sha204c_send_and_receive(uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t)' previously defined here
    
     static uint8_t sha204c_send_and_receive(uint8_t *tx_buffer, uint8_t rx_size, uint8_t *rx_buffer,
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:377:13: error: redefinition of 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)'
    
     static void sha204c_calculate_crc(uint8_t length, uint8_t *data, uint8_t *crc)
    
                 ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:377:13: error: 'void sha204c_calculate_crc(uint8_t, uint8_t*, uint8_t*)' previously defined here
    
     static void sha204c_calculate_crc(uint8_t length, uint8_t *data, uint8_t *crc)
    
                 ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t sha204c_check_crc(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:402:16: error: redefinition of 'uint8_t sha204c_check_crc(uint8_t*)'
    
     static uint8_t sha204c_check_crc(uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:402:16: error: 'uint8_t sha204c_check_crc(uint8_t*)' previously defined here
    
     static uint8_t sha204c_check_crc(uint8_t *response)
    
                    ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_init(uint8_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:416:6: error: redefinition of 'void atsha204_init(uint8_t)'
    
     void atsha204_init(uint8_t pin)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:416:6: error: 'void atsha204_init(uint8_t)' previously defined here
    
     void atsha204_init(uint8_t pin)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_idle()':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:433:6: error: redefinition of 'void atsha204_idle()'
    
     void atsha204_idle(void)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:433:6: error: 'void atsha204_idle()' previously defined here
    
     void atsha204_idle(void)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'void atsha204_sleep()':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:438:6: error: redefinition of 'void atsha204_sleep()'
    
     void atsha204_sleep(void)
    
          ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:438:6: error: 'void atsha204_sleep()' previously defined here
    
     void atsha204_sleep(void)
    
          ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_wakeup(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:443:9: error: redefinition of 'uint8_t atsha204_wakeup(uint8_t*)'
    
     uint8_t atsha204_wakeup(uint8_t *response)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:443:9: error: 'uint8_t atsha204_wakeup(uint8_t*)' previously defined here
    
     uint8_t atsha204_wakeup(uint8_t *response)
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:473:9: error: redefinition of 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)'
    
     uint8_t atsha204_execute(uint8_t op_code, uint8_t param1, uint16_t param2,
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:473:9: error: 'uint8_t atsha204_execute(uint8_t, uint8_t, uint16_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t, uint8_t*)' previously defined here
    
     uint8_t atsha204_execute(uint8_t op_code, uint8_t param1, uint16_t param2,
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_getSerialNumber(uint8_t*)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:549:9: error: redefinition of 'uint8_t atsha204_getSerialNumber(uint8_t*)'
    
     uint8_t atsha204_getSerialNumber(uint8_t * response)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:549:9: error: 'uint8_t atsha204_getSerialNumber(uint8_t*)' previously defined here
    
     uint8_t atsha204_getSerialNumber(uint8_t * response)
    
             ^
    
    In file included from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:96:0:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp: In function 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)':
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:578:9: error: redefinition of 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)'
    
     uint8_t atsha204_read(uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t zone, uint16_t address)
    
             ^
    
    In file included from C:\Users\Alex\Documents\Arduino\libraries\MySensors/MySensors.h:155:0,
    
                     from C:\Users\Alex\AppData\Local\Temp\arduino_modified_sketch_105629\SensebenderGatewaySerial.ino:94:
    
    C:\Users\Alex\Documents\Arduino\libraries\MySensors/drivers/ATSHA204/ATSHA204.cpp:578:9: error: 'uint8_t atsha204_read(uint8_t*, uint8_t*, uint8_t, uint16_t)' previously defined here
    
     uint8_t atsha204_read(uint8_t *tx_buffer, uint8_t *rx_buffer, uint8_t zone, uint16_t address)
    
             ^
    
    Multiple libraries were found for "SD.h"
     Used: C:\Users\Alex\Documents\Arduino\libraries\SD
     Not used: C:\Program Files (x86)\Arduino\libraries\SD
    Using library MySensors at version 2.2.0-beta in folder: C:\Users\Alex\Documents\Arduino\libraries\MySensors 
    Using library Wire at version 1.0 in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\Wire 
    Using library SPI at version 1.0 in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.6.12\libraries\SPI 
    Using library SD at version 1.1.1 in folder: C:\Users\Alex\Documents\Arduino\libraries\SD 
    exit status 1
    Error compiling for board Sensebender Gateway.
    

  • Contest Winner

    @alexsh1 Try to comment this line.
    If it still fails to compile, also comment out this block and this block.



  • @Anticimex Commenting #include <drivers/ATSHA204/ATSHA204.cpp> did help, I can compile the sketch.

    However, have a different issue now:

    0;255;3;0;9;28181 Signing backend: ATSHA204
    0;255;3;0;9;28234 SHA256: 19332EC2AF4F753F8D2ED9F9B3039897BDD3D5B847D7C3DB01907B97F80B064C
    0;255;3;0;9;28245 Will not sign message for destination 4 as it does not require it
    0;255;3;0;9;28303 !TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=NACK:19332EC2AF4F753F8D2ED9F9B3039897BDD3D5B847D7C3DB01
    0;255;3;0;9;28313 Failed to transmit nonce!
    0;255;3;0;9;29922 TSF:MSG:READ,4-4-0,s=2,c=1,t=1,pt=2,l=2,sg=1:46
    4;2;1;0;1;46
    

  • Contest Winner

    @alexsh1 That is a radio issue. You have NACK on !TSF:MSG:SEND.


  • Contest Winner

    @tbowmo We probably should conditionally include drivers/ATSHA204/ATSHA204.cpp based on the MY_SIGNING_ATSHA204 flag. Otherwise the ATSHA204.cpp file will be included in multiple places if ATSHA204 signing is enabled in the gw.



  • @Anticimex it says

    0;255;3;0;9;156987 TSF:MSG:READ,4-4-0,s=2,c=1,t=1,pt=2,l=2,sg=1:45
    4;2;1;0;1;45
    0;255;3;0;9;169466 Verification timeout
    

    Shall I try to increase timeout?


  • Contest Winner

    @alexsh1 First you have to resolve the NACKs. It will not help to increase the timeout if messages never arrive.



  • @Anticimex I think I have resolved it by changing this:

    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    

    to

    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    0;255;3;0;9;44594 Signing backend: ATSHA204
    0;255;3;0;9;44647 SHA256: CF003C2C5580A69303207910E37DA55E6A4B0C78B671218C3BEF40B895658B9D
    0;255;3;0;9;44658 Will not sign message for destination 6 as it does not require it
    0;255;3;0;9;44671 TSF:MSG:SEND,0-0-6-6,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:CF003C2C5580A69303207910E37DA55E6A4B0C78B671218C3B
    0;255;3;0;9;44681 Transmitted nonce
    0;255;3;0;9;44951 TSF:MSG:READ,6-6-0,s=2,c=1,t=1,pt=7,l=5,sg=1:55.2
    

    One node is still bad - I'll change the radio and test it again.


  • Contest Winner



  • @Anticimex

    Do you think that I may have verification timeout due to having a mixture 2.1.1 and 2.2.0?

    0;255;3;0;9;124541 Signing backend: ATSHA204
    0;255;3;0;9;124594 SHA256: 9CEF656D53F4C3722D72AE17346E310BD300161FAB992261DD5216C08D0D7950
    0;255;3;0;9;124605 Will not sign message for destination 16 as it does not require it
    0;255;3;0;9;124618 TSF:MSG:SEND,0-0-16-16,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:9CEF656D53F4C3722D72AE17346E310BD300161FAB992261DD
    0;255;3;0;9;124628 Transmitted nonce
    0;255;3;0;9;124799 TSF:MSG:READ,16-16-0,s=255,c=3,t=0,pt=1,l=1,sg=1:76
    16;255;3;0;0;76
    0;255;3;0;9;124809 TSF:MSG:READ,16-16-0,s=0,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;124819 Signing backend: ATSHA204
    0;255;3;0;9;124872 SHA256: 326EB7828E5F02AB2F9FCE645FC5B7D2628DDD70FED64C78275AC1FA0D1C1AF5
    0;255;3;0;9;124883 Will not sign message for destination 16 as it does not require it
    0;255;3;0;9;124896 TSF:MSG:SEND,0-0-16-16,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:326EB7828E5F02AB2F9FCE645FC5B7D2628DDD70FED64C7827
    0;255;3;0;9;124906 Transmitted nonce
    0;255;3;0;9;125176 TSF:MSG:READ,16-16-0,s=0,c=1,t=38,pt=7,l=5,sg=1:2.9
    16;0;1;0;38;2.9
    0;255;3;0;9;137796 Verification timeout
    

  • Contest Winner

    @alexsh1 Hm, it should not be a problem. Assuming your log snippet is from the GW, it basically says that it successfully transmit the nonce to your node as requested to, and then it expects the node to provide a signed message to the GW within a certain timeout. The node fails to do this within that time so the GW times out and will not accept the message if it arrives later on.
    So there are two options;

    1. The node takes too long to process the received nonce, sign the message and send it back (perhaps many repeater hops between node and gw, this can be resolved by increasing the signing timeout at the GW side).
    2. The node does transmit the signed message but fails with a NACK. The GW will never see this message and therefore assumes the node did not send it and correctly times out.


  • @Anticimex On the node, changing nrf24l01+ orientation (I have two nrf24l01+ sockets) 90 degrees changed signing from

    0;255;3;0;9;120620 Transmitted nonce
    0;255;3;0;9;120630 TSF:MSG:READ,4-4-0,s=1,c=1,t=0,pt=7,l=5,sg=1:24.0
    0;255;3;0;9;120644 Current nonce: 415DAB5FF6170E67F5B180ADC827C062D35CBF2DCE1B6B0264AAAAAAAAAAAAAA
    0;255;3;0;9;120745 HMAC: 759A77B66BAC8F0AEA542685F4EA12DEB66B27FE15F57788F1D1022508984896
    0;255;3;0;9;120756 Signature bad
    0;255;3;0;9;120766 Signature verification failed!
    0;255;3;0;9;120776 !TSF:MSG:SIGN VERIFY FAIL
    0;255;3;0;9;120981 TSF:MSG:READ,4-4-0,s=2,c=1,t=1,pt=2,l=2,sg=1:70
    0;255;3;0;9;120991 No active verification session
    0;255;3;0;9;121001 Signature verification failed!
    0;255;3;0;9;121011 !TSF:MSG:SIGN VERIFY FAIL
    
    0;255;3;0;9;165728 Transmitted nonce
    0;255;3;0;9;165944 TSF:MSG:READ,4-4-0,s=1,c=1,t=0,pt=7,l=5,sg=1:24.4
    0;255;3;0;9;165958 Current nonce: BAC8828FEAAFB3A0C65DE6F8D4993E4D3D93F190B58AA3C737AAAAAAAAAAAAAA
    0;255;3;0;9;166059 HMAC: 122222A7C324B3688BD98EC8EF9AD9557350B874CAB38F250A246EBB069805D3
    0;255;3;0;9;166070 Signature OK
    

  • Contest Winner

    @alexsh1 Looks like RF performance was significantly improved by that change.



  • @Anticimex It seems to me that 90% of all issues is actually RF.
    Very annoying!

    Thanks for your help!



  • I am using latest beta (2.2.0b). Does anyone know what this means in the log:

    !SGN:NCE:GEN
    

    I think this is related to signing


  • Contest Winner


  • Contest Winner

    @alexsh1 to be more specific; the backend failed to generate a nonce. If you use the soft backed, it did not initialize properly (and you should have a log entry for that failure as well).
    If using atsha204a, it either failed init like described above, or it failed to communicate properly (which should also be visible in other failures in the log)



  • @Anticimex Spot on -> there was a mistake :

    #define MY_SIGNING_ATSHA204_PIN 3
    

    and should have been

    #define MY_SIGNING_ATSHA204_PIN 17
    

    I was wondering why nonce was all zeros...


  • Contest Winner

    @alexsh1 excellent. Signing won't work well without proper communication with the chip 🙂
    I considered just hanging if that happened but decided it was a bit too harsh and might disguise the problem in case UART debug isn't enabled.



  • I cannot get my china USB to Serial device to work with the arduino boards, so I cannot program the board to run the personalization. As a work around a use a Arduino Uno board as the "USB to Serial" and now I can upload the sketch and the personalizer writes to serial output fine at 115200 baud.
    But, when it wants me to press SPACE, it responds with "Unexpected answer. Skipping lock."

    I tried an other sketch that does Serial.read() and echos back the result. It does not work at 115200 but works at 9600 baud. At 9600 I get char 32 back as SPACE, but 160 or 130 or 254 at 115200. Maybe the Uno board cannot handle 115200?

    So, question: Can the personalizer sketch be changed to use 9600 (or something slower than 115200)? I tried to change the Serial.begin(115200) to 9600, but it is still 115200.

    (of course, I can alter the code to bypass the press SPACE to press any key, but I want to get to the bottom with the problem)


  • Contest Winner

    @Magnus-Pernemark
    Question 1: so you run stable release or beta?
    Answer 1: yes you can change baud rate but it is handled differently between stable and beta.


  • Contest Winner

    @Magnus-Pernemark there is a configuration switch to disable UART verification you can use


  • Mod

    @Magnus-Pernemark which version are you using?
    The development version from github supports

    #define MY_BAUD_RATE 9600
    

    at the start of the sketch.

    The 2.1.1 version has

    Serial.begin(115200);
    

    in the sketch. Just change that.



  • @Anticimex I am so not familiar with the arduino/mysensors development yet, but I guess I use 2.1.1, since i used "Sketch / Include Library / Manage Library" and it had 2.1.1

    @mfalkvidd Since I have the line Serial.begin(115200) I assume it is 2.1.1, but changing it to 9600 and uploading the sketch does nothing. I still need to open serial window with 115200, else I just see garbage as output from the mini pro.

    I will try the development version and see if that helps.


  • Contest Winner

    @Magnus-Pernemark or you can just disable the confirmation altogether. Just define SKIP_UART_CONFIRMATION



  • @Anticimex hehe, true... but I am a developer by trade, and bypassing something just because it would be easier, feels so wrong. I might end up doing so, but I'll give it some more tries first. Problems are a very good way to learn, and in arduino development I am a total noobie, more used to C# and the .NET world.


  • Contest Winner

    @Magnus-Pernemark as a developer by trade, you should be bold enough to use the beta releases and live on the bleeding edge then 😉



  • @Anticimex I'll start living on the edge immediately. It's the way to go!
    I switched to develop and could change the band rate, however develop version skips UART confirmation by default so I never had the problem there. Never needed to send any keys. Got the chip configured atleast.
    I kind of started in the wrong end - designed my own pcbs, then start to know the development environment.
    But I'll figure it out... just takes time.. thanks for the help!!


  • Contest Winner

    @Magnus-Pernemark that's correct. Or, it is correct if you follow the "guided mode". If you wanna be hardcore, you drop the guided defines and set the individual flags according to your specific needs, and then you get to enable (or more precisely, not disable) UART confirmation (in case you want to test it).



  • Hi!
    Starting to learn signing. I use a parallell system (with another channel) where I could test signing before I went on my live system. For now I just use soft signing, it works perfect!

    Now, I just want to test a node (motionsensor) that include:

    #define MY_SIGNING_REQUEST_SIGNATURES
    

    The gateway has no signing feature (it has not gone thru personalition process) In my head, the node shall reject to connect to this gateway, but after the signing fails, it start to send data to the gateway. Did I miss something here?

    Debug text on node:

    0 MCO:BGN:INIT NODE,CP=RNNNAS--,VER=2.2.0-beta
    49 SGN:PER:OK
    83 SGN:INI:BND OK
    83 TSM:INIT
    86 TSF:WUR:MS=0
    94 TSM:INIT:TSP OK
    96 TSM:INIT:STATID=101
    98 TSF:SID:OK,ID=101
    100 TSM:FPAR
    102 SGN:SGN:NREQ=255
    139 TSF:MSG:SEND,101-101-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    684 TSF:MSG:READ,0-0-101,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    690 SGN:SKP:MSG CMD=3,TYPE=8
    692 TSF:MSG:FPAR OK,ID=0,D=1
    2148 TSM:FPAR:OK
    2148 TSM:ID
    2150 TSM:ID:OK
    2152 TSM:UPL
    2154 SGN:SGN:NREQ=0
    2158 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2168 TSF:MSG:READ,0-0-101,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2174 SGN:SKP:MSG CMD=3,TYPE=25
    2177 TSF:MSG:PONG RECV,HP=1
    2181 TSM:UPL:OK
    2183 TSM:READY:ID=101,PAR=0,DIS=1
    2187 SGN:PRE:SGN REQ
    2189 SGN:PRE:WHI NREQ
    2191 SGN:SGN:NREQ=0
    2195 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2203 SGN:PRE:XMT,TO=0
    2205 SGN:PRE:WAIT GW
    2207 TSF:MSG:READ,0-0-101,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2213 SGN:SKP:MSG CMD=3,TYPE=15
    2217 SGN:SGN:NREQ=0
    2222 TSF:MSG:SEND,101-101-0-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=0,st=OK:2.2.0-beta
    2232 SGN:SGN:NREQ=0
    2234 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2248 TSF:MSG:READ,0-0-101,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2254 !SGN:VER:NSG
    2256 !TSF:MSG:SIGN VERIFY FAIL
    2258 SGN:SGN:NREQ=0
    2263 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=11,pt=0,l=13,sg=0,ft=0,st=OK:Motion Sensor
    2273 SGN:SGN:NREQ=0
    2277 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    2285 SGN:SGN:NREQ=0
    2289 TSF:MSG:SEND,101-101-0-0,s=1,c=0,t=1,pt=0,l=0,sg=0,ft=0,st=OK:
    2295 MCO:REG:REQ
    2297 SGN:SGN:NREQ=0
    2301 TSF:MSG:SEND,101-101-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2310 TSF:MSG:READ,0-0-101,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2316 !SGN:VER:NSG
    2318 !TSF:MSG:SIGN VERIFY FAIL
    2322 MCO:BGN:STP
    2324 MCO:BGN:INIT OK,TSP=1
    1
    2326 SGN:SGN:NREQ=0
    2330 TSF:MSG:SEND,101-101-0-0,s=1,c=1,t=16,pt=0,l=1,sg=0,ft=0,st=OK:1
    2338 MCO:SLP:MS=120000,SMS=0,I1=1,M1=1,I2=255,M2=255
    2344 TSF:TDI:TSL
    2347 MCO:SLP:WUP=1
    2349 TSF:TRI:TSB
    0
    2351 SGN:SGN:NREQ=0
    2355 TSF:MSG:SEND,101-101-0-0,s=1,c=1,t=16,pt=0,l=1,sg=0,ft=0,st=OK:0
    2363 MCO:SLP:MS=120000,SMS=0,I1=1,M1=1,I2=255,M2=255
    2367 TSF:TDI:TSL
    
    

  • Contest Winner

    @gus what is it that you think is not working? Just because your node require signatures does not prevent the node from sending data to your gateway which does not require signatures.
    And as you can see in the log you get errors about missing signatures (and hence failed verifications) so it looks as expected to me.
    You could try to paste your log into the log parser to get a easier to read output.



  • @Anticimex Ok, just thought when signing failed, the node was halted 😕
    So that control mechanism need to be implemented in my sketch then?
    Great, I will use the log parser!


  • Contest Winner

    @gus no, when signing verification fail, the message is just discarded



  • @Anticimex Ahh, now I get it!! Thanks for helping me out here!

    Cheers


  • Contest Winner

    @gus always 🙂 nice to hear that you have a fully functional signing rig. Happy signing!



  • Hello @Anticimex

    Sometimes it happens that the Serial printing is not correct and it is okay when the baud rate is lower to 57600. I guess the default is 115200 when this error happens.

    +------------------------------------------------------------------------------------+
    ⸮ M⸮Se⸮so⸮s security p⸮r⸮o⸮alizer ⸮
    +------------------------------------------------------------------------------------+

    +------------------------------------------------------------------------------------+
    ⸮ C⸮n⸮igur⸮t⸮on set⸮i⸮g⸮ ⸮
    +------------------------------------------------------------------------------------+
    | * G⸮i⸮e⸮ ⸮e⸮s⸮nali⸮ation/⸮t⸮ra⸮e of key⸮ ⸮n AT⸮H⸮204A |
    | * ⸮T⸮HA204A based ⸮e⸮s⸮n⸮l⸮z⸮t⸮o⸮ ⸮
    ⸮ * Will l⸮ck ATSH⸮204⸮ c⸮n⸮i⸮u⸮atio⸮ |
    ⸮ * W⸮ll no⸮ req⸮i⸮e any UA⸮T co⸮fi⸮m⸮ti⸮ns ⸮
    | * ⸮i⸮l ⸮to⸮e ⸮MA⸮ key to A⸮SH⸮204A |
    | * Will store ⸮ES ke⸮ to ⸮E⸮R⸮M ⸮
    +------------------------------------------------------------------------------------+


  • Contest Winner

    @ahmedadelhosni yes, this can happen on some targets. It depend on the quality and precision of the oscillator. If output looks garbled, reducing the baud rate is a good place to start.



  • @Anticimex so this has nothing to do with the quality of my overall node ? I mean as a reference that this node will be stable or not during operation.

    I ordered my atmega smd from mouser and all passive componets too. Only pcbs are from dirtypcbs. I thought getting high quality from mouser would be better.

    Thanks.


  • Contest Winner

    @ahmedadelhosni
    That is hard to say. There are many reports of atmega not being really good at handling 115200 at certain oscillator frequencies. So no, I don't think it directly hints at something being wrong with your hardware. But I cannot be sure of course 🙂



  • @ahmedadelhosni I had the same problem with serial speed on a few PCBs that I designed myself, design was based on existing mysensors PCBs. I could only run on 38k baud.
    In my case it turned out to be a problem with the with of signal lines and power lines on the PCB. They where to small, and probably caused noise and bad through put, because when I widened the lines on the PCB, reordered them from fab house, then 115k baud worked again.



  • @Magnus-Pernemark I have also a modified version of Mysensebender node and the issue happened with some of the pcbs, not all of them. In your case I understood that it was a problem in all your pcbs. So maybe pcb quality from dirtypcbs was not that good with some of mine due to small width of lines.
    Thanks.



  • Hello @Anticimex

    I was testing HW signing using latest dev and I got the following 👍

    My setup > GW : 8 Mhz internal clock
    My node > : 8 Mhz internal clock ( with MySysBootloader OTA)

    From Gateway debug:

    0;255;3;0;9;53 MCO:BGN:INIT GW,CP=RNNGAA--,VER=2.2.0-beta
    0;255;3;0;9;129 !SGN:PER:TAMPERED
    0;255;3;0;9;161 SGN:INI:BND OK
    0;255;3;0;9;169 TSM:INIT
    0;255;3;0;9;178 TSF:WUR:MS=0
    0;255;3;0;9;190 TSM:INIT:TSP OK
    0;255;3;0;9;198 TSM:INIT:GW MODE
    0;255;3;0;9;208 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;221 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.2.0-beta
    0;255;3;0;9;231 MCO:BGN:STP
    0;255;3;0;9;253 MCO:BGN:INIT OK,TSP=1
    

    When I try to add node 4 : This happens

    0;255;3;0;9;180430 TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=1,l=0,sg=0:0
    0;255;3;0;9;180449 TSF:MSG:BC
    0;255;3;0;9;180457 TSF:MSG:FPAR REQ,ID=4
    0;255;3;0;9;180469 TSF:PNG:SEND,TO=0
    0;255;3;0;9;180480 TSF:CKU:OK
    0;255;3;0;9;180488 TSF:MSG:GWL OK
    0;255;3;0;9;180768 SGN:SKP:MSG CMD=3,TYPE=8
    0;255;3;0;9;180783 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;187224 TSF:MSG:READ,4-4-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    0;255;3;0;9;187244 !SGN:PRE:SGN NREQ,FROM=4 REJ
    0;255;3;0;9;187256 SGN:PRE:SGN NREQ,TO=4
    0;255;3;0;9;187269 SGN:PRE:WHI NREQ,TO=4
    0;255;3;0;9;187279 SGN:SKP:MSG CMD=3,TYPE=15
    0;255;3;0;9;187293 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    0;255;3;0;9;187316 SGN:PRE:XMT,TO=4
    0;255;3;0;9;187576 TSF:MSG:READ,4-4-0,s=255,c=4,t=0,pt=6,l=10,sg=0:1E000100B0031E310102
    4;255;4;0;0;1E000100B0031E310102
    0;255;3;0;9;194334 TSF:MSG:READ,4-4-0,s=255,c=4,t=0,pt=6,l=10,sg=0:1E000100B0031E310102
    4;255;4;0;0;1E000100B0031E310102
    0;255;3;0;9;201091 TSF:MSG:READ,4-4-0,s=255,c=4,t=0,pt=6,l=10,sg=0:1E000100B0031E310102
    4;255;4;0;0;1E000100B0031E310102
    0;255;3;0;9;208238 TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;208257 TSF:MSG:BC
    0;255;3;0;9;208265 TSF:MSG:FPAR REQ,ID=4
    0;255;3;0;9;208275 TSF:PNG:SEND,TO=0
    0;255;3;0;9;208285 TSF:CKU:OK
    0;255;3;0;9;208293 TSF:MSG:GWL OK
    0;255;3;0;9;208736 SGN:SKP:MSG CMD=3,TYPE=8
    0;255;3;0;9;208750 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;210298 TSF:MSG:READ,4-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;210317 TSF:MSG:PINGED,ID=4,HP=1
    0;255;3;0;9;210329 SGN:SKP:MSG CMD=3,TYPE=25
    0;255;3;0;9;210343 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;210364 TSF:MSG:READ,4-4-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    0;255;3;0;9;210384 SGN:PRE:SGN REQ,FROM=4
    0;255;3;0;9;210397 SGN:PRE:SGN NREQ,TO=4
    0;255;3;0;9;210407 SGN:PRE:WHI NREQ,TO=4
    0;255;3;0;9;210417 SGN:SKP:MSG CMD=3,TYPE=15
    0;255;3;0;9;210432 TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    0;255;3;0;9;210454 SGN:PRE:XMT,TO=4
    0;255;3;0;9;210464 TSF:MSG:READ,4-4-0,s=255,c=0,t=18,pt=0,l=10,sg=0:2.2.0-beta
    4;255;0;0;18;2.2.0-beta
    0;255;3;0;9;210487 TSF:MSG:READ,4-4-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    4;255;3;0;6;0
    0;255;3;0;9;212459 TSF:MSG:READ,4-4-0,s=255,c=3,t=11,pt=0,l=13,sg=0:Relay Signing
    4;255;3;0;11;Relay Signing
    0;255;3;0;9;212484 TSF:MSG:READ,4-4-0,s=255,c=3,t=12,pt=0,l=5,sg=0:1.2.1
    4;255;3;0;12;1.2.1
    0;255;3;0;9;212510 TSF:MSG:READ,4-4-0,s=3,c=0,t=3,pt=0,l=0,sg=0:
    4;3;0;0;3;
    0;255;3;0;9;212531 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;212551 !SGN:SGN:STATE
    0;255;3;0;9;212561 !TSF:MSG:SIGN FAIL
    0;255;3;0;9;214489 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;214507 !SGN:SGN:STATE
    0;255;3;0;9;214517 !TSF:MSG:SIGN FAIL
    0;255;3;0;9;216510 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;216528 !SGN:SGN:STATE
    0;255;3;0;9;216539 !TSF:MSG:SIGN FAIL
    0;255;3;0;9;218533 TSF:MSG:READ,4-4-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    0;255;3;0;9;218552 !SGN:SGN:STATE
    0;255;3;0;9;218560 !TSF:MSG:SIGN FAIL
    

    My gateway sketch ::

    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_SIGNING
    
    
    #define MY_RADIO_NRF24
    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    #define MY_SIGNING_ATSHA204
    
    // SETTINGS FOR MY_SIGNING_ATSHA204
    #ifndef MY_SIGNING_ATSHA204_PIN
    #define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached
    #endif
    
    #include <MySensors.h>
    
    void setup()
    {
    	// Setup locally attached sensors
    }
    
    void presentation()
    {
    	// Present locally attached sensors
    }
    
    void loop()
    {
    	// Send locally attached sensor data here
    }
    

    Node code :

    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    
    
    #define MY_SIGNING_ATSHA204
    #define MY_SIGNING_REQUEST_SIGNATURES
    
    // SETTINGS FOR MY_SIGNING_ATSHA204
    #ifndef MY_SIGNING_ATSHA204_PIN
    #define MY_SIGNING_ATSHA204_PIN 17 //!< A3 - pin where ATSHA204 is attached
    #endif
    
    #include <MySensors.h>
    
    // normal function call is here
    

    I do personalized my nodes with the same HMAC as described in the docs.
    I got this and I run the same sketch on all node including the gateway :

    | This device has now been personalized. Run this sketch with its current settings   |
    | on all the devices in your network that have security enabled.
    

    First question :
    I have searched for similar issues for 0;255;3;0;9;129 !SGN:PER:TAMPERED but I couldn't find.

    Second one : Was signing tested recently with the latest dev branch ? because I guess I read in one of the posts that it has not been tested since a while.

    THanks for the help.


  • Contest Winner

    @ahmedadelhosni
    First answer: TAMPERED suggest that either you have had your personalized data altered between the time of personalization and usage. Or, you personalized your device using the personalizer from the official release or a early development version. The integrity check is a relatively new addition on the development branch.
    Second answer: to my knowledge, signing works fine on the development branch.



  • @Anticimex Okay I managed to get it working .. I guess 💃

    After I posted here I decided to go through the code to see when this TAMPERED is printed, so I thought from debugging that this is related to hwReadConfigBlock so I decided to clear the EEPROM, re personilize the gateway and reflash the GW sketch ... Now I get SGN:PER:OK

    I then reflashed my sensor node again and I guess it is working now .. I tried sending 1;1;1;1;2;1 through serial and this is the result

    0;255;3;0;9;429250 SGN:SKP:MSG CMD=3,TYPE=16
    0;255;3;0;9;429266 TSF:MSG:SEND,0-0-1-1,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    0;255;3;0;9;429287 SGN:SGN:NCE REQ,TO=1
    0;255;3;0;9;429391 TSF:MSG:READ,1-1-0,s=255,c=3,t=17,pt=6,l=25,sg=0:<NONCE>
    0;255;3;0;9;429412 SGN:NCE:FROM=1
    0;255;3;0;9;429422 SGN:BND:NONCE=882805C056A850AF00469170FEB702EB5B09EC1FEE51D2F22DAAAAAAAAAAAAAA
    0;255;3;0;9;429557 SGN:BND:HMAC=6DB4F3CF2F17E42A5508B4A411CA1478582D052A249A278689D26A7A0B96FBA2
    0;255;3;0;9;429584 SGN:SGN:SGN
    0;255;3;0;9;429594 TSF:MSG:SEND,0-0-1-1,s=1,c=1,t=2,pt=0,l=1,sg=1,ft=0,st=OK:1
    0;255;3;0;9;429740 TSF:MSG:READ,1-1-0,s=1,c=1,t=2,pt=0,l=1,sg=0:1
    0;255;3;0;9;429758 TSF:MSG:ACK
    1;1;1;1;2;1
    

    I guess this means that signing is working .. I did try also to add another gateway with no signing and it only discovered my node (1) but I got NACK when trying to send to it.

    Am I correct in my analysis ?

    Thanks for the help.


  • Contest Winner

    @ahmedadelhosni that looks good to me. You can use the log parser on the homepage to get a more readable interpretation of the debug log.



  • @Anticimex thanks a lot.

    I have another question please. I use atsha hw, do this setup save anything in the eeprom ?



  • @Anticimex sorry for lots of questions but can u explain in more details what you meant by " that either you have had your personalized data altered between the time of personalization and usage" ?


  • Contest Winner

    @ahmedadelhosni if you use atsha204a then only AES key for encryption is stored in eeprom by the personalizer. It is not used unless you activate encryption.


  • Contest Winner

    @ahmedadelhosni the integrity check that could emit a TAMPERED message is intended to ensure that signing backend does not use corrupted data.
    This is done by having the personalizer calculate a checksum of the data it wrote. Then the signing backend validates the data read against the checksum and of there is a mismatch then it reports that personalization has been tampered.
    This is to ensure that users don't get confused by signing not working if they have accidentally erased or manipulated the personalization data.



  • Hello! I'm new to this and I've been using MySensors to communicate a few nodes in my house with a gateway ... Everything I've done without problems until now that I want to sign the data ...

    I have done the following:

    1. Ah my sketch (node) simply added the following statement:

    #define MY_SIGNING_SOFT
    #define MY_SIGNING_REQUEST_SIGNATURES
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN A3
    (It's a mini pro 3.3 v)

    1. My GW added this:
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN A7
      (Nano 5v)

    and already ... everything else I left it still, as I was working.

    Now ... This is what the log of my node shows me:

    0 MCO:BGN:INIT NODE,CP=RNNNAS-,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSM:INIT:STATID=110
    16 TSF:SID:OK,ID=110
    18 TSM:FPAR
    55 TSF:MSG:SEND,110-110-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    698 TSF:MSG:READ,0-0-110,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    704 TSF:MSG:FPAR OK,ID=0,D=1
    2064 TSM:FPAR:OK
    2064 TSM:ID
    2066 TSM:ID:OK
    2068 TSM:UPL
    2074 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2084 TSF:MSG:READ,0-0-110,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2091 TSF:MSG:PONG RECV,HP=1
    2093 TSM:UPL:OK
    2095 TSM:READY:ID=110,PAR=0,DIS=1
    2119 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    2129 TSF:MSG:READ,0-0-110,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    2154 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
    2177 TSF:MSG:READ,0-0-110,s=255,c=3,t=17,pt=6,l=25,sg=0:543E0871819CBE4290536346F5231CBEF4C8F70A344B289CEA
    2394 !TSF:MSG:SEND,110-110-0-0,s=255,c=0,t=17,pt=0,l=5,sg=1,ft=0,st=NACK:2.1.1
    2451 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=NACK:
    2459 !TSF:MSG:SIGN FAIL
    4509 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=3,st=NACK:
    4517 !TSF:MSG:SIGN FAIL
    4569 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=5,st=NACK:
    4577 !TSF:MSG:SIGN FAIL
    4612 TSF:MSG:SEND,110-110-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=7,st=OK:
    4632 TSF:MSG:READ,0-0-110,s=255,c=3,t=17,pt=6,l=25,sg=1:5D4997715396BEFB979106A93EF22C9E1DBAE516012E040FAE
    4851 !TSF:MSG:SEND,110-110-0-0,s=2,c=0,t=3,pt=0,l=11,sg=1,ft=0,st=NACK:Water Valve
    4909 !TSF:MSG:SEND,110-110-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=NACK:
    4915 !TSF:MSG:SIGN FAIL
    4966 !TSF:MSG:SEND,110-110-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=3,st=NACK:
    4974 !TSF:MSG:SIGN FAIL
    5025 !TSF:MSG:SEND,110-110-0-0,s=4,c=3,t=16,pt=0,l=0,sg=1,ft=5,st=NACK:
    5033 !TSF:MSG:SIGN FAIL
    5083 !TSF:MSG:SEND,110-110-0-0,s=5,c=3,t=16,pt=0,l=0,sg=1,ft=7,st=NACK:
    5091 !TSF:MSG:SIGN FAIL
    5142 !TSF:MSG:SEND,110-110-0-0,s=6,c=3,t=16,pt=0,l=0,sg=1,ft=9,st=NACK:
    5150 !TSF:MSG:SIGN FAIL
    5199 !TSF:MSG:SEND,110-110-0-0,s=7,c=3,t=16,pt=0,l=0,sg=1,ft=11,st=NACK:
    5208 !TSF:MSG:SIGN FAIL
    5212 MCO:REG:REQ
    5261 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=13,st=NACK:2
    5269 !TSM:READY:UPL FAIL,SNP
    5273 TSM:FPAR
    5308 TSF:MSG:SEND,110-110-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=14,st=OK:
    7270 !TSF:SND:TNR
    7319 !TSM:FPAR:NO REPLY
    7321 TSM:FPAR
    7358 TSF:MSG:SEND,110-110-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8204 TSF:MSG:READ,0-0-110,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    8210 TSF:MSG:FPAR OK,ID=0,D=1
    9271 !TSF:SND:TNR
    9367 TSM:FPAR:OK
    9367 TSM:ID
    9369 TSM:ID:OK
    9371 TSM:UPL
    9375 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    9385 TSF:MSG:READ,0-0-110,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    9392 TSF:MSG:PONG RECV,HP=1
    9394 TSM:UPL:OK
    9396 TSM:READY:ID=110,PAR=0,DIS=1
    9412 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    9420 TSF:MSG:READ,0-0-110,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    9457 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
    9480 TSF:MSG:READ,0-0-110,s=255,c=3,t=17,pt=6,l=25,sg=1:20169962FD569DAE7F6D69702C2AD69B8492264A3FC2450E50
    9697 !TSF:MSG:SEND,110-110-0-0,s=255,c=0,t=17,pt=0,l=5,sg=1,ft=0,st=NACK:2.1.1
    9754 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=NACK:
    9762 !TSF:MSG:SIGN FAIL
    11812 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=3,st=NACK:
    11821 !TSF:MSG:SIGN FAIL
    11872 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=5,st=NACK:
    11880 !TSF:MSG:SIGN FAIL
    11931 !TSF:MSG:SEND,110-110-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=7,st=NACK:
    11939 !TSF:MSG:SIGN FAIL
    11988 !TSF:MSG:SEND,110-110-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=9,st=NACK:
    11997 !TSF:MSG:SIGN FAIL
    12048 !TSF:MSG:SEND,110-110-0-0,s=3,c=3,t=16,pt=0,l=0,sg=1,ft=11,st=NACK:
    12056 !TSF:MSG:SIGN FAIL
    12107 !TSF:MSG:SEND,110-110-0-0,s=4,c=3,t=16,pt=0,l=0,sg=1,ft=13,st=NACK:
    12115 !TSF:MSG:SIGN FAIL
    12167 !TSF:MSG:SEND,110-110-0-0,s=5,c=3,t=16,pt=0,l=0,sg=1,ft=15,st=NACK:
    12175 !TSF:MSG:SIGN FAIL
    12224 !TSF:MSG:SEND,110-110-0-0,s=6,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=NACK:
    12232 !TSF:MSG:SIGN FAIL
    12283 !TSF:MSG:SEND,110-110-0-0,s=7,c=3,t=16,pt=0,l=0,sg=1,ft=3,st=NACK:
    12292 !TSF:MSG:SIGN FAIL
    12294 MCO:REG:REQ
    12343 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=5,st=OK:2
    12351 TSF:MSG:READ,0-0-110,s=255,c=3,t=16,pt=0,l=0,sg=0:
    12435 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=NACK:EC4D4496E138DD8C83E9837D130B8AD51D0B5BE66E9CC103EB14399 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=1,st=NACK:2
    16427 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=2,st=OK:2
    16437 TSF:MSG:READ,0-0-110,s=255,c=3,t=16,pt=0,l=0,sg=0:
    16519 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:CE22C6ECF337A5713AD0677785547E59FB49FB964B79EFAB88
    16609 TSF:MSG:READ,0-0-110,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    16773 !TSF:MSG:SIGN VERIFY FAIL
    16777 TSF:MSG:READ,0-0-110,s=255,c=3,t=27,pt=1,l=1,sg=1:1
    16783 !TSF:MSG:SIGN VERIFY FAIL
    16787 MCO:BGN:STP
    16836 !TSF:MSG:SEND,110-110-0-0,s=1,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    16844 !TSF:MSG:SIGN FAIL
    16896 !TSF:MSG:SEND,110-110-0-0,s=2,c=3,t=16,pt=0,l=0,sg=1,ft=2,st=NACK:
    16904 !TSF:MSG:SIGN FAIL
    16906 MCO:BGN:INIT OK,TSP=1
    Valve Change Detected ,
    Reporting battery
    Main Battery reported: 1076
    16959 !TSF:MSG:SEND,110-110-0-0,s=6,c=3,t=16,pt=0,l=0,sg=1,ft=4,st=NACK:
    16967 !TSF:MSG:SIGN FAIL
    Bridge Battery reported: 0
    17018 !TSF:MSG:SEND,110-110-0-0,s=7,c=3,t=16,pt=0,l=0,sg=1,ft=6,st=NACK:
    17027 !TSF:MSG:SIGN FAIL
    next BATT report TIME selected
    17037 TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=8,st=OK:
    17059 TSF:MSG:READ,0-0-110,s=255,c=3,t=17,pt=6,l=25,sg=1:A49B044E02033467D7D7220BA28FBFEA6C9ED2EFA7C4DE16CD
    17276 !TSF:MSG:SEND,110-110-0-0,s=255,c=3,t=0,pt=1,l=1,sg=1,ft=0,st=NACK:100
    Both to Low in Bridge .....
    

    And this is what the log of the GW shows me:

    0;255;3;0;9;TSF:MSG:READ,110-110-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=110
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSF:MSG:PINGED,ID=110,HP=1
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    0;255;3;0;9;!TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0101
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=0,ft=0,st=OK:E36F33C7F0FAB62159035EE11FBC031CE96304C15907FCA866
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:9CB25AA3C9DDAA7EB1D4EC4FEE49B3ADDA743FB87AC1844809
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=6,pt=1,l=1,sg=1:0
    0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:A2FFF069812565DE86C4BE5517F7F497141208817C51412562
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:F2503A2DF3D42714F93FF7386FC7E4087E6FFC31B86D0449BF
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=12,pt=0,l=3,sg=1:2.3
    0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=2,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:3DB72D0ECA0E7C5546CB68782E93D66A0BA86F7DBD05714798
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=2,c=0,t=3,pt=0,l=11,sg=1:Water Valve
    0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:272DE6ED5FDDDB14B704CF36D32DA37D3A3C32D4F7F30E4D86
    0;255;3;0;9;TSF:MSG:READ,110-110-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=110
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    0;255;3;0;9;TSF:MSG:PINGED,ID=110,HP=1
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0101
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:05E7E841D621BB9E5F323082CBF40509B1B9D100C6EF955156
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:89A2A933A3310EE14AF048E3A786FD1432608BBD361B366DC0
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=2,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:554A491A49FA49B278B8269CEF0748346A9980A395161F3356
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:6220CC178F89ADD1F7AC819695C344770835A96CBAFB2D6848
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=6,c=3,t=16,pt=0,l=0,sg=1:
    0;255;3;0;9;TSF:MSG:SEND,0-0-110-110,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:DA701B4D253E0FC19BB7FA0D2699D1C9CE7F7E7B89586ED8A2
    0;255;3;0;9;TSF:MSG:READ,110-110-0,s=6,c=0,t=30,pt=0,l=15,sg=1:Main Batt Volts
    0;255;3;0;9;!TSF:MSG:SIGN VERIFY FAIL
    

    Can you help me please!?
    I read everything about the signed but the truth I am somewhat confused ... If you could provide me a sketch of a node and a gateway that work for me to guide me I would appreciate it.

    Thank you very much in advance!


  • Contest Winner

    @Proyectos-Integrasoft Hi, as mentioned several places, signing makes messages be a lot bigger and that puts strain on the radio link. You can see many NACKs in the log which means messages don't get through. That's way signing fail. You need to make sure you have properly decoupled radio modules and a solid power supply.


  • Contest Winner

    @Proyectos-Integrasoft another thing you did not mention is if you have personalized your nodes? Signing require personalization to store certain data. Please read the documentation (linked on the top of this thread).



  • @Anticimex Thnks!

    As you can see in the sketch, I'm using a Nrf24L01 module for the node and for the gateway. They are connected to their designed boards (Node and Gateway) respectively. The power, for now, I am doing through the Ftdi232 that I use to connect it to the PC to do debugging. Before adding the signature to the sketch, they were working perfect. What do you suggest doing then?

    Also, I have read about the customization of the nodes, but I feel honest I have not managed to understand how to do it ... Could you explain me easily how to personalize it? Truthfully, I have not been able to use the guide.

    Thanks for answering me! : D


  • Contest Winner

    @Proyectos-Integrasoft then please let me know what parts are unclear. I try to make it as easy to follow as possible. You can also read the beta documentation but be aware that personalization has been rewritten on the beta track. I have provided a step by step instruction for personalization in the signing module in the documentation. It should give you all information needed.
    Regarding powering, have you followed the guides available here in the forum for powering the radio? NACKs is not a signing problem. It is a radio problem.



  • @Anticimex What I understand is the following:

    1. I must choose the backend that I am going to use. (In my case, I'll use the software firm)
    2. Then I must choose a free pin to establish a random seed for the pseudorandom generator. (In my case I chose pin A3 that is completely free on the plate).
    3. Then I request that all the messages that enter the node will be signed. (I do this using MY_SIGNING_REQUEST_SIGNATURES on the gateway and on the node)
    4. finally says that if I am not going to use MY_SIGNING_SIMPLE_PASSWD, I need to customize the node. This is where I get confused ...

    First of all, ask me to enable GENERATE_KEYS_SOFT, saying that this will provide random keys for HMAC and AES, and that I should copy and replace them in the corresponding definitions in "User-defined key data". What do you mean by "user-defined key data"? When I enable this, in the LOG of my node nothing strange comes out, the same thing I posted previously.

    Second, you tell me to disable the key generator by software and enable the PERSONALIZE_SOFT ... And that this will keep the keys in the EEPROM ... When you talk about enabling and disabling you mean that I must burn the sketch first with Generate_Keys_Soft and then burn again but now with the hmac and aes keys that were generated, while enabling the Personalize_Soft?

    This is what I do not understand. I do not get the keys with the GENERATE_KEYS_SOFT ... And I do not clearly understand what I should do next.

    You apologize for my lack of knowledge or understanding. And I thank you for your help.



  • @Anticimex And as for the radio. I followed the connection guide that comes out at https://www.mysensors.org/build/serial_gateway, even watching the video. I do not know if you mean another guide? If so, could you give me the link? Thank you for your collaboration.


  • Contest Winner

    @Proyectos-Integrasoft I assume you use an official release first of all. That personalization is more complicated than the one used on beta/development branch.
    Then you are first expected to generate the keys (like you say). These keys are printed on the serial console. You then copy those into the personalizer sketch and reconfigure the personalizer to store the keys you have set. And then you run the personalizer to use those keys.
    You can of course skip the generation step and set the hmac key manually using the personalizer. The only requirement is the size of the key (32 bytes) and that it is identical on all nodes.



  • @Anticimex
    Could you please give me the link of the last official release? to verify that is the one that I have. When you say "copy" the keys in the sketch personalizer, are you referring to PERSONALIZE_SOFT? And what do you mean by configuring the sketch personalizer? Could you additionally tell me how it would be done manually? (example of sketch)


  • Contest Winner

    @Proyectos-Integrasoft I am not sure where to start. I assume you are familiar with c code? The signing solution available in the latest official release (which you find on github, I believe is 2.1.1) require at least fundamental understanding of how to adjust sketch code.
    The documentation gives the exact lines to change.
    There is, like I said, a step by step guide, and if you follow it you should end up with a properly personalized device. In this case, that is of less importance since you currently do not have a stable enough radio link to use security since you get NACKs for full size payloads (so neither signing nor encryption will work).
    So you will have to make that work and get rid of the NACKs, before we should start worrying about personalization.
    And like I said before, that is not a signing related issue. You will get the same problem if you try to send full size payloads of any kind. Just try to disable signing and send full size payloads.



  • @Anticimex
    Okay, so I'll start by tackling things step by step ... How can I avoid getting NACKs in my log?


  • Contest Winner

    @Proyectos-Integrasoft as I said; ensuring good decoupling, a stable power supply (measure that to confirm). Also, counterfeit RF24 chips are all over the place that perform under par. There are quite a few threads here on this topic. So please post such questions in those, it is somewhat off topic here 🙂
    Also, setting proper power levels can have a huge impact on the performance.



  • Hi @Anticimex Actually there is something that I can not understand regarding cryptograhpy. I want to know how other products like Fibaro, Smartthings, etc handles the security ?

    Here in our library the SW is not a good idea, why ? I thought beacuse someone can dump the memory .. but is it that easy ? Can't we lock the code and memory ? Also in the hardware ATSHA solution, someone can easily take the chip and intercept our network and sniff it or even send commands as it is explained in the documentation and that's why we don't use security for public nodes as it usualy reports states. But can't we lock the chip ? and by some way only the atmega can communicate with it to get the key by some way ?

    I read online that some people are using private and public keys .. if this is the case, then the private key is offcourse saved in the memory. How do they handle this problem ?

    Do they use AES , SHA ? which encyption way ?

    Also the nRF52, I tried to read a lot and they use private and public keys i guess.

    lots of questions and I am confused but I want to know how do they handle protection for public nodes.

    Can you please explain this to me ?

    Thanks.


  • Contest Winner

    @ahmedadelhosni some devices, like the atmega, doss not support locking the memory, so the software based signing is inherently insecure in terms of hw theft.
    Atsha204a based signing protection specifically against this because the personalizer locks the chip from readout. It is not possible to extract the hmac key from the atsha204a memory and the key is never transmitted OTA (unless you deploy the personalizer OTA).


  • Contest Winner

    @ahmedadelhosni and regarding reusing a node/atsha204a for attack purpose, we have whitelisting to protect against that. The serials used for whitelisting are also never send OTA (again, unless you send the personalizer OTA).



  • @Anticimex

    1- So if we have a microcontroller that supports locking the memory then the problem is solved ? I know that SAM is being introduced now, Does it support this ?

    2- what is then the purpose of locking the ATSHA if we can't extract the HMAC which we depend on it ?

    Thanks.


  • Contest Winner

    @ahmedadelhosni
    We lock the atsha to make sure it can't be readable.
    It does not matter that samd supports locking or not. The atmega328p does not. For now, we have a security scheme that supports any target, so we have to have a system that works for all.
    For MySensors v3, an entirely new security scheme is under consideration. But it will mean dropping support for the atmga328p as it is not powerful enough.
    As for what others do, I suggest you ask them 🙂
    Security can be implemented in many ways. Each with drawbacks and benefits. The one currently in use is a scheme that can work on basically any target with reasonable security and performance. It has drawbacks, yes, but at the time of implementation, these were considered acceptable.
    For the future, more sophisticated schemes can be used which are easier to use, arguably more secure but more complex in terms of computational power and protocol. The core team is investigating various solutions.



  • @Anticimex Sorry but I didn't understand the benefit of locking the ATSHA to be unreadable ? 😑
    I know we do not lock it so that we can read the HMAC and use it during verification, but what is the usage of a locked ATSHA ?


  • Contest Winner

    @ahmedadelhosni what do you mean? All cryptography is performed inside the chip. The hmac key never leaves the chip after it has been programmed and locked. Thats the whole point with the atsha204a.



  • @Anticimex aha okay I understand a bit now. So we put s special hmac that does all cryptography jobs then it gives us something that is used for transmision?

    Looks like i have to read the datasheet also 😄


  • Contest Winner

    @ahmedadelhosni I'd suggest you start by reading the documentation on signing linked at the very top of this post. It explains in detail how the signing security is implemented.



  • @Anticimex yeah I read it several times before but maybe didnt pay attention to tge technical stuff 😂


  • Contest Winner

    @ahmedadelhosni 🙂 not really needed to be able to use it, but it hopefully helps in understanding it 😉



  • @Anticimex yeah I know. I have already managed to use Siging in my network and it works.

    I just wanted to understand more about how the code works and the technical stuff.

    Thanks.


  • Contest Winner

    @ahmedadelhosni You mean this? 🙂



  • @Anticimex Yeah actually I have read this post like 20 times before but I guess I begun to really understand the "technical" stuff today.

    So basically what I understood is that we have a HMAC Key, which is generated and is saved in all devices, this is when we do step 1 'generate key' and step 2 'personalize'. Thus when the gateway needs to send to node X, it send to node X asking for a nonce from the ATSHA on Node 2 board. Then node 2 sends the nonce over the air. THe gateway then uses this nonce to produce signed message by first applying SHA then use the HMAC key to produce the signed data. Then the signed data is transmitted over the air to the node X again which does the same operations again and verify that the nonce produces the same signed message in small period of time ( to avoid replay block attacks)

    Is my understanding correct 😄 ?


 

240
Online

8.3k
Users

9.2k
Topics

97.2k
Posts