[security] Introducing signing support to MySensors
-
@Anticimex
sorry sorry for so many questions, i have read the how to use already some times, but maybe its my bad english or the fear to do something wrong or to destroy the chip. I get a little bit unsure.Now i get both keys. If i understood correctly, the keys are now stored, i have now to put the shown keys to the sketch as HMAC and AES Key, and run this sketch on the sensor nodes.
On the gateway on which i generated the keys i dont need to do anything more as to upload the gateway sketch ?
Thank you very much for your support! -
@meddie Sorry, missed that post.
You have SKIP_KEY_STORAGE defined so no keys will be stored. This is the default and intentional, to avoid people just executing the sketch and accidentally overwrite existing keys.
Furthermore, you have selected to personalize a ATSHA device, and have it generate the keys. That means that you have to define LOCK_CONFIGURATION or the ATSHA random number generator will not work.@Anticimex said in 💬 Sensebender Gateway:
@meddie Sorry, missed that post.
You have SKIP_KEY_STORAGE defined so no keys will be stored. This is the default and intentional, to avoid people just executing the sketch and accidentally overwrite existing keys.
Furthermore, you have selected to personalize a ATSHA device, and have it generate the keys. That means that you have to define LOCK_CONFIGURATION or the ATSHA random number generator will not work.@Anticimex
sorry i have one more question, because i didnt fully understand this. In the gettings started how to you wrote:Pick a “master” device with serial debug port. Set the following sketch configuration of the personalizer: ... Enable SKIP_KEY_STORAGE ... Execute the sketch on the “master” device to obtain a randomized key. Save this key to a secure location and keep it confidential so that you can retrieve it if you need to personalize more devices later on. Now reconfigure the sketch with these settings: ... Disable SKIP_KEY_STORAGE ... Put the saved key in the user_key_data variable. Now execute the sketch on all devices you want to personalize with this secret key.on the first run i have to enable SKIP_KEY_STORAGE so i removed the comments.
But here in forum you write i have to disable this. After i has disabled it wroked fine for me.But now i have to run the sketch on my node, and i think i have to disable the SKIP function too, because i need that the keys will be stored in the node.
So if i am right, the on both runs the SKIP function has to be commented out? Or i am wrong?
Thank you. -
@Anticimex said in 💬 Sensebender Gateway:
@meddie Sorry, missed that post.
You have SKIP_KEY_STORAGE defined so no keys will be stored. This is the default and intentional, to avoid people just executing the sketch and accidentally overwrite existing keys.
Furthermore, you have selected to personalize a ATSHA device, and have it generate the keys. That means that you have to define LOCK_CONFIGURATION or the ATSHA random number generator will not work.@Anticimex
sorry i have one more question, because i didnt fully understand this. In the gettings started how to you wrote:Pick a “master” device with serial debug port. Set the following sketch configuration of the personalizer: ... Enable SKIP_KEY_STORAGE ... Execute the sketch on the “master” device to obtain a randomized key. Save this key to a secure location and keep it confidential so that you can retrieve it if you need to personalize more devices later on. Now reconfigure the sketch with these settings: ... Disable SKIP_KEY_STORAGE ... Put the saved key in the user_key_data variable. Now execute the sketch on all devices you want to personalize with this secret key.on the first run i have to enable SKIP_KEY_STORAGE so i removed the comments.
But here in forum you write i have to disable this. After i has disabled it wroked fine for me.But now i have to run the sketch on my node, and i think i have to disable the SKIP function too, because i need that the keys will be stored in the node.
So if i am right, the on both runs the SKIP function has to be commented out? Or i am wrong?
Thank you.@meddie If your read the text carefully it says:
Set the following sketch configuration of the personalizer:
...
Execute the sketch on the “master” device to obtain a randomized key. Save this key to a secure location and keep it confidential so that you can retrieve it if you need to personalize more devices later on.
Now reconfigure the sketch with these settings:
...
Now execute the sketch on all devices you want to personalize with this secret key.So in other words; you first use the settings described in the first setting, execute that once. Follow the instructions carefully. Write down the key you got. Then you reconfigure the sketch and execute it on all devices you want to personalize. That is, you execute it twice on the first device.
I wrote that you need to undefine SKIP_KEY_STORAGE if you want to store a key. But the first set of instructions in the documentation is not saying that you are supposed to store a key. It says "Execute the sketch on the “master” device to obtain a randomized key."So the documentation is correct, and describe a flow where you personalize nodes and gateways with the minimum amount of changes needed. First you generate a key, and this step can actually be skipped altogether if you just make your own random key or password to use for HMAC/AES.
Then you reconfigure the personalizer to use your generated (or selected) key and write it to all your devices. -
@Anticimex
but as i runned the sketch with SKIP_KEY_STORAGE defined, so no keys were generated.i did not like to say that the documentation is incorrect, i like your documentation and your work very well! i just didnt understand it!
Thank you very much!
Greets Eddie -
@Anticimex
but as i runned the sketch with SKIP_KEY_STORAGE defined, so no keys were generated.i did not like to say that the documentation is incorrect, i like your documentation and your work very well! i just didnt understand it!
Thank you very much!
Greets Eddie@meddie are you sure you ran with the exact settings described for generating the keys? The SKIP_KEY_STORAGE flag does not prevent the keys from being generated. They are still printed in the serial log. It prevents the keys from being stored to the atsha204a device.
-
i fear to write again, but my fail story goes on :-(
i have uploaded on the gateway this sketch:/** * 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik EKblad * Contribution by a-lurker and Anticimex, * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de> * Contribution by Tomas Hozza <thozza@gmail.com> * * * DESCRIPTION * The EthernetGateway sends data received from sensors to the ethernet link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * This GW code is designed for Sensebender GateWay / (Arduino Zero variant) * * Wire connections (OPTIONAL): * - Inclusion button should be connected to SW2 * * LEDs on board (default assignments): * - Orange: USB RX/TX - Blink when receiving / transmitting on USB CDC device * - Yellow: RX - Blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - Green : TX - Blink fast on radio message transmitted. In inclusion mode will blink slowly * - Red : ERR - Fast blink on error during transmission error or recieve crc error * - Blue : free - (use with LED_BLUE macro) * */ #include <stdint.h> #include <pins_arduino.h> #define SKETCH_VERSION "0.2" // Enable debug prints to serial monitor #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // 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_HIGH #define MY_SIGNING_ATSHA204 //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} //#define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION // Enable gateway ethernet module type #define MY_GATEWAY_W5100 // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 // Enable Soft SPI for NRF radio (note different radio wiring is required) // The W5100 ethernet module seems to have a hard time co-operate with // radio on the same spi bus. #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD) #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 14 #define MY_SOFT_SPI_MISO_PIN 16 #define MY_SOFT_SPI_MOSI_PIN 15 #endif // When W5100 is connected we have to move CE/CSN pins for NRF radio #ifndef MY_RF24_CE_PIN #define MY_RF24_CE_PIN 5 #endif #ifndef MY_RF24_CS_PIN #define MY_RF24_CS_PIN 6 #endif // Enable to UDP //#define MY_USE_UDP #define MY_IP_ADDRESS 10,0,0,253 // If this is disabled, DHCP is used to retrieve address // Renewal period if using DHCP //#define MY_IP_RENEWAL_INTERVAL 60000 // The port to keep open on node server mode / or port to contact in client mode #define MY_PORT 5003 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254 // The MAC address can be anything you want but should be unique on your network. // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use. // Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address. #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED // 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 #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif #include <Ethernet.h> #include <MySensors.h> #include <SD.h> //#include <drivers/ATSHA204/ATSHA204.cpp> Sd2Card card; #define EEPROM_VERIFICATION_ADDRESS 0x01 static uint8_t num_of_leds = 5; static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE}; void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors } void loop() { // Send locally attached sensor data here } void preHwInit() { pinMode(MY_SWC1, INPUT_PULLUP); pinMode(MY_SWC2, INPUT_PULLUP); if (digitalRead(MY_SWC1) && digitalRead(MY_SWC2)) { return; } uint8_t tests = 0; for (int i=0; i< num_of_leds; i++) { pinMode(leds[i], OUTPUT); } uint8_t led_state = 0; if (digitalRead(MY_SWC1)) { while (!Serial) { digitalWrite(LED_BLUE, led_state); led_state ^= 0x01; delay(500); } // Wait for USB to be connected, before spewing out data. } digitalWrite(LED_BLUE, LOW); if (Serial) { Serial.println("Sensebender GateWay test routine"); Serial.print("Mysensors core version : "); Serial.println(MYSENSORS_LIBRARY_VERSION); Serial.print("GateWay sketch version : "); Serial.println(SKETCH_VERSION); Serial.println("----------------------------------"); Serial.println(); } if (testSha204()) { digitalWrite(LED_GREEN, HIGH); tests++; } if (testSDCard()) { digitalWrite(LED_YELLOW, HIGH); tests++; } if (testEEProm()) { digitalWrite(LED_ORANGE, HIGH); tests++; } if (testAnalog()) { digitalWrite(LED_BLUE, HIGH); tests++; } if (tests == 4) { while(1) { for (int i=0; i<num_of_leds; i++) { digitalWrite(leds[i], HIGH); delay(200); digitalWrite(leds[i], LOW); } } } else { while (1) { digitalWrite(LED_RED, HIGH); delay(200); digitalWrite(LED_RED, LOW); delay(200); } } } bool testSha204() { uint8_t rx_buffer[SHA204_RSP_SIZE_MAX]; uint8_t ret_code; if (Serial) { Serial.print("- > SHA204 "); } atsha204_init(MY_SIGNING_ATSHA204_PIN); ret_code = atsha204_wakeup(rx_buffer); if (ret_code == SHA204_SUCCESS) { ret_code = atsha204_getSerialNumber(rx_buffer); if (ret_code != SHA204_SUCCESS) { if (Serial) { Serial.println(F("Failed to obtain device serial number. Response: ")); } Serial.println(ret_code, HEX); } else { if (Serial) { Serial.print(F("Ok (serial : ")); for (int i=0; i<9; i++) { if (rx_buffer[i] < 0x10) { Serial.print('0'); // Because Serial.print does not 0-pad HEX } Serial.print(rx_buffer[i], HEX); } Serial.println(")"); } return true; } } else { if (Serial) { Serial.println(F("Failed to wakeup SHA204")); } } return false; } bool testSDCard() { if (Serial) { Serial.print("- > SD CARD "); } if (!card.init(SPI_HALF_SPEED, MY_SDCARD_CS)) { if (Serial) { Serial.println("SD CARD did not initialize!"); } } else { if (Serial) { Serial.print("SD Card initialized correct! - "); Serial.print("type detected : "); switch(card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("Unknown"); } } return true; } return false; } bool testEEProm() { uint8_t eeprom_d1, eeprom_d2; SerialUSB.print(" -> EEPROM "); Wire.begin(); eeprom_d1 = i2c_eeprom_read_byte(EEPROM_VERIFICATION_ADDRESS); delay(500); eeprom_d1 = ~eeprom_d1; // invert the bits i2c_eeprom_write_byte(EEPROM_VERIFICATION_ADDRESS, eeprom_d1); delay(500); eeprom_d2 = i2c_eeprom_read_byte(EEPROM_VERIFICATION_ADDRESS); if (eeprom_d1 == eeprom_d2) { SerialUSB.println("PASSED"); i2c_eeprom_write_byte(EEPROM_VERIFICATION_ADDRESS, ~eeprom_d1); return true; } SerialUSB.println("FAILED!"); return false; } bool testAnalog() { int bat_detect = analogRead(MY_BAT_DETECT); Serial.print("-> analog : "); Serial.print(bat_detect); if (bat_detect < 400 || bat_detect > 650) { Serial.println(" Failed"); return false; } Serial.println(" Passed"); return true; } -
and on the node this sketch:
/* * 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. * ******************************* */ #include <stdint.h> #include <pins_arduino.h> #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_RADIO_NRF24 //#define MY_SIGNING_SOFT #define MY_SIGNING_ATSHA204 //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION #include <MySensors.h>But the node does not connect and i get this on the serial monitor:
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 TSF:SID:OK,ID=100 16 TSM:FPAR 18 Will not sign message for destination 255 as it does not require it 67 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2076 !TSM:FPAR:NO REPLY 2078 TSM:FPAR 2080 Will not sign message for destination 255 as it does not require it 2127 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4139 !TSM:FPAR:NO REPLY 4141 TSM:FPAR 4143 Will not sign message for destination 255 as it does not require it 4190 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6199 !TSM:FPAR:NO REPLY 6201 TSM:FPAR 6203 Will not sign message for destination 255 as it does not require it 6250 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 8259 !TSM:FPAR:FAIL 8261 TSM:FAIL:CNT=1 8263 TSM:FAIL:PDT 18266 TSM:FAIL:RE-INIT 18268 TSM:INIT 18276 TSM:INIT:TSP OK 18278 TSF:SID:OK,ID=100 18280 TSM:FPAR 18282 Will not sign message for destination 255 as it does not require it 18331 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20340 !TSM:FPAR:NO REPLY 20342 TSM:FPAR 20344 Will not sign message for destination 255 as it does not require it 20393 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22403 !TSM:FPAR:NO REPLY 22405 TSM:FPAR 22407 Will not sign message for destination 255 as it does not require it 22456 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24465 !TSM:FPAR:NO REPLY 24467 TSM:FPAR 24469 Will not sign message for destination 255 as it does not require it 24518 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26527 !TSM:FPAR:FAIL 26529 TSM:FAIL:CNT=2 26531 TSM:FAIL:PDT 36534 TSM:FAIL:RE-INIT 36536 TSM:INIT 36544 TSM:INIT:TSP OK 36546 TSF:SID:OK,ID=100 36548 TSM:FPAR 36550 Will not sign message for destination 255 as it does not require it 36599 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38610 !TSM:FPAR:NO REPLY 38612 TSM:FPAR 38615 Will not sign message for destination 255 as it does not require it 38664 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 40673 !TSM:FPAR:NO REPLY 40675 TSM:FPAR 40677 Will not sign message for destination 255 as it does not require it 40726 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 42735 !TSM:FPAR:NO REPLY 42737 TSM:FPAR 42739 Will not sign message for destination 255 as it does not require it 42788 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 44800 !TSM:FPAR:FAIL 44802 TSM:FAIL:CNT=3 44804 TSM:FAIL:PDT 54808 TSM:FAIL:RE-INIT 54810 TSM:INIT 54818 TSM:INIT:TSP OK 54820 TSF:SID:OK,ID=100 54822 TSM:FPAR 54824 Will not sign message for destination 255 as it does not require it 54874 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56883 !TSM:FPAR:NO REPLY 56885 TSM:FPAR 56887 Will not sign message for destination 255 as it does not require it 56936 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:please help me once again
Thank you -
and on the node this sketch:
/* * 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. * ******************************* */ #include <stdint.h> #include <pins_arduino.h> #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_RADIO_NRF24 //#define MY_SIGNING_SOFT #define MY_SIGNING_ATSHA204 //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION #include <MySensors.h>But the node does not connect and i get this on the serial monitor:
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 TSF:SID:OK,ID=100 16 TSM:FPAR 18 Will not sign message for destination 255 as it does not require it 67 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2076 !TSM:FPAR:NO REPLY 2078 TSM:FPAR 2080 Will not sign message for destination 255 as it does not require it 2127 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4139 !TSM:FPAR:NO REPLY 4141 TSM:FPAR 4143 Will not sign message for destination 255 as it does not require it 4190 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6199 !TSM:FPAR:NO REPLY 6201 TSM:FPAR 6203 Will not sign message for destination 255 as it does not require it 6250 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 8259 !TSM:FPAR:FAIL 8261 TSM:FAIL:CNT=1 8263 TSM:FAIL:PDT 18266 TSM:FAIL:RE-INIT 18268 TSM:INIT 18276 TSM:INIT:TSP OK 18278 TSF:SID:OK,ID=100 18280 TSM:FPAR 18282 Will not sign message for destination 255 as it does not require it 18331 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20340 !TSM:FPAR:NO REPLY 20342 TSM:FPAR 20344 Will not sign message for destination 255 as it does not require it 20393 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22403 !TSM:FPAR:NO REPLY 22405 TSM:FPAR 22407 Will not sign message for destination 255 as it does not require it 22456 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24465 !TSM:FPAR:NO REPLY 24467 TSM:FPAR 24469 Will not sign message for destination 255 as it does not require it 24518 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26527 !TSM:FPAR:FAIL 26529 TSM:FAIL:CNT=2 26531 TSM:FAIL:PDT 36534 TSM:FAIL:RE-INIT 36536 TSM:INIT 36544 TSM:INIT:TSP OK 36546 TSF:SID:OK,ID=100 36548 TSM:FPAR 36550 Will not sign message for destination 255 as it does not require it 36599 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38610 !TSM:FPAR:NO REPLY 38612 TSM:FPAR 38615 Will not sign message for destination 255 as it does not require it 38664 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 40673 !TSM:FPAR:NO REPLY 40675 TSM:FPAR 40677 Will not sign message for destination 255 as it does not require it 40726 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 42735 !TSM:FPAR:NO REPLY 42737 TSM:FPAR 42739 Will not sign message for destination 255 as it does not require it 42788 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 44800 !TSM:FPAR:FAIL 44802 TSM:FAIL:CNT=3 44804 TSM:FAIL:PDT 54808 TSM:FAIL:RE-INIT 54810 TSM:INIT 54818 TSM:INIT:TSP OK 54820 TSF:SID:OK,ID=100 54822 TSM:FPAR 54824 Will not sign message for destination 255 as it does not require it 54874 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56883 !TSM:FPAR:NO REPLY 56885 TSM:FPAR 56887 Will not sign message for destination 255 as it does not require it 56936 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:please help me once again
Thank you@meddie if you want your node to sign messages to the gateway you have to tell the gateway to require it. The log says that it does not require it and it is clear from your gateway sketch that you have disabled the requirement.
Is that your problem?
EDIT: I see that the messages are broadcasts, those will never be signed. So the "will not sign messages" are perfectly normal no matter how you configure your gateway in this case.
The problem, at least based on the node log is that your node cannot find a parent to communicate with for some reason. -
and on the node this sketch:
/* * 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. * ******************************* */ #include <stdint.h> #include <pins_arduino.h> #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_RADIO_NRF24 //#define MY_SIGNING_SOFT #define MY_SIGNING_ATSHA204 //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION #include <MySensors.h>But the node does not connect and i get this on the serial monitor:
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 TSF:SID:OK,ID=100 16 TSM:FPAR 18 Will not sign message for destination 255 as it does not require it 67 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2076 !TSM:FPAR:NO REPLY 2078 TSM:FPAR 2080 Will not sign message for destination 255 as it does not require it 2127 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4139 !TSM:FPAR:NO REPLY 4141 TSM:FPAR 4143 Will not sign message for destination 255 as it does not require it 4190 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6199 !TSM:FPAR:NO REPLY 6201 TSM:FPAR 6203 Will not sign message for destination 255 as it does not require it 6250 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 8259 !TSM:FPAR:FAIL 8261 TSM:FAIL:CNT=1 8263 TSM:FAIL:PDT 18266 TSM:FAIL:RE-INIT 18268 TSM:INIT 18276 TSM:INIT:TSP OK 18278 TSF:SID:OK,ID=100 18280 TSM:FPAR 18282 Will not sign message for destination 255 as it does not require it 18331 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20340 !TSM:FPAR:NO REPLY 20342 TSM:FPAR 20344 Will not sign message for destination 255 as it does not require it 20393 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22403 !TSM:FPAR:NO REPLY 22405 TSM:FPAR 22407 Will not sign message for destination 255 as it does not require it 22456 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24465 !TSM:FPAR:NO REPLY 24467 TSM:FPAR 24469 Will not sign message for destination 255 as it does not require it 24518 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26527 !TSM:FPAR:FAIL 26529 TSM:FAIL:CNT=2 26531 TSM:FAIL:PDT 36534 TSM:FAIL:RE-INIT 36536 TSM:INIT 36544 TSM:INIT:TSP OK 36546 TSF:SID:OK,ID=100 36548 TSM:FPAR 36550 Will not sign message for destination 255 as it does not require it 36599 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38610 !TSM:FPAR:NO REPLY 38612 TSM:FPAR 38615 Will not sign message for destination 255 as it does not require it 38664 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 40673 !TSM:FPAR:NO REPLY 40675 TSM:FPAR 40677 Will not sign message for destination 255 as it does not require it 40726 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 42735 !TSM:FPAR:NO REPLY 42737 TSM:FPAR 42739 Will not sign message for destination 255 as it does not require it 42788 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 44800 !TSM:FPAR:FAIL 44802 TSM:FAIL:CNT=3 44804 TSM:FAIL:PDT 54808 TSM:FAIL:RE-INIT 54810 TSM:INIT 54818 TSM:INIT:TSP OK 54820 TSF:SID:OK,ID=100 54822 TSM:FPAR 54824 Will not sign message for destination 255 as it does not require it 54874 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56883 !TSM:FPAR:NO REPLY 56885 TSM:FPAR 56887 Will not sign message for destination 255 as it does not require it 56936 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:please help me once again
Thank you -
and on the node this sketch:
/* * 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. * ******************************* */ #include <stdint.h> #include <pins_arduino.h> #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_RADIO_NRF24 //#define MY_SIGNING_SOFT #define MY_SIGNING_ATSHA204 //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION #include <MySensors.h>But the node does not connect and i get this on the serial monitor:
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 TSF:SID:OK,ID=100 16 TSM:FPAR 18 Will not sign message for destination 255 as it does not require it 67 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2076 !TSM:FPAR:NO REPLY 2078 TSM:FPAR 2080 Will not sign message for destination 255 as it does not require it 2127 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4139 !TSM:FPAR:NO REPLY 4141 TSM:FPAR 4143 Will not sign message for destination 255 as it does not require it 4190 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6199 !TSM:FPAR:NO REPLY 6201 TSM:FPAR 6203 Will not sign message for destination 255 as it does not require it 6250 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 8259 !TSM:FPAR:FAIL 8261 TSM:FAIL:CNT=1 8263 TSM:FAIL:PDT 18266 TSM:FAIL:RE-INIT 18268 TSM:INIT 18276 TSM:INIT:TSP OK 18278 TSF:SID:OK,ID=100 18280 TSM:FPAR 18282 Will not sign message for destination 255 as it does not require it 18331 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20340 !TSM:FPAR:NO REPLY 20342 TSM:FPAR 20344 Will not sign message for destination 255 as it does not require it 20393 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22403 !TSM:FPAR:NO REPLY 22405 TSM:FPAR 22407 Will not sign message for destination 255 as it does not require it 22456 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24465 !TSM:FPAR:NO REPLY 24467 TSM:FPAR 24469 Will not sign message for destination 255 as it does not require it 24518 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26527 !TSM:FPAR:FAIL 26529 TSM:FAIL:CNT=2 26531 TSM:FAIL:PDT 36534 TSM:FAIL:RE-INIT 36536 TSM:INIT 36544 TSM:INIT:TSP OK 36546 TSF:SID:OK,ID=100 36548 TSM:FPAR 36550 Will not sign message for destination 255 as it does not require it 36599 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38610 !TSM:FPAR:NO REPLY 38612 TSM:FPAR 38615 Will not sign message for destination 255 as it does not require it 38664 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 40673 !TSM:FPAR:NO REPLY 40675 TSM:FPAR 40677 Will not sign message for destination 255 as it does not require it 40726 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 42735 !TSM:FPAR:NO REPLY 42737 TSM:FPAR 42739 Will not sign message for destination 255 as it does not require it 42788 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 44800 !TSM:FPAR:FAIL 44802 TSM:FAIL:CNT=3 44804 TSM:FAIL:PDT 54808 TSM:FAIL:RE-INIT 54810 TSM:INIT 54818 TSM:INIT:TSP OK 54820 TSF:SID:OK,ID=100 54822 TSM:FPAR 54824 Will not sign message for destination 255 as it does not require it 54874 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56883 !TSM:FPAR:NO REPLY 56885 TSM:FPAR 56887 Will not sign message for destination 255 as it does not require it 56936 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:please help me once again
Thank you -
@Anticimex
Hi, i have just uploaded the GatewayW5100 Sketch to the Gateway and the HumidtyTemp Sketch to the Node and it works fine, but without signing and encryption. -
@Anticimex
Hi, i have just uploaded the GatewayW5100 Sketch to the Gateway and the HumidtyTemp Sketch to the Node and it works fine, but without signing and encryption. -
@meddie You had encryption enabled when it failed? That could explain the failure of the broadcast if you did not have a matching setting between the nodes/gateway.
@Anticimex
yes the encryption was enabled. Should i upload the personalized sketch again with my keys? -
@Anticimex
yes the encryption was enabled. Should i upload the personalized sketch again with my keys?@meddie You can just run an unmodified personalizer to have it read the EEPROM contents. That way you can verify that all devices share the exact same AES key. Assuming a mismatch in the AES key was the reason for the problem.
But I strongly encourage you to just enable one security feature at a time if you are not sure what you are doing or it will be hard to debug what is going wrong. -
@meddie You can just run an unmodified personalizer to have it read the EEPROM contents. That way you can verify that all devices share the exact same AES key. Assuming a mismatch in the AES key was the reason for the problem.
But I strongly encourage you to just enable one security feature at a time if you are not sure what you are doing or it will be hard to debug what is going wrong.@Anticimex
yes, i try to activate one feature and when it works the next. So i decided to activate the encryption and then when it works then i try to activate the signing. But first i would to check the keys like you said and when i now upload the securitypersonalization sketch unmodified i dont get any output on the serial monitor.
:disappointed: -
@Anticimex
yes, i try to activate one feature and when it works the next. So i decided to activate the encryption and then when it works then i try to activate the signing. But first i would to check the keys like you said and when i now upload the securitypersonalization sketch unmodified i dont get any output on the serial monitor.
:disappointed: -
@meddie Well, you have to make the patch to the baud rate and the changes we discussed earlier. I presume you did something necessary since you got output previously.
@Anticimex
when i run the personalizer sketch i see in all keys FFFFFF....... What does it mean that no keys are stored? -
@Anticimex
when i run the personalizer sketch i see in all keys FFFFFF....... What does it mean that no keys are stored? -
@meddie yes, that mean eeprom is in default state. The node has not been properly personalized.
@Anticimex
ok, i think i know what went wrong! But i dont know how to fix it. On the first run when i tried came the prompt to sens space to lock configuration i did it.
Now when i upload the modified personalization sketch with my keys i get this output on serial monitor:
of course i removed my keys with xx!Device serial: {0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX} xxxxxxxxxxxxxxxxxxxxx Skipping configuration write and lock (configuration already locked). Chip configuration: EEPROM DATA: SOFT_HMAC_KEY | FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SOFT_SERIAL | FFFFFFFFFFFFFFFFFF AES_KEY | XXFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ATSHA204A DATA: SN[0:1] | SN[2:3] | XX XX | XX XX Revnum | 00 09 04 00 SN[4:7] | XX XX XX XX SN[8] | Reserved13 | I2CEnable | Reserved15 | EE | 10 | 00 | 00 I2CAddress | TempOffset | OTPmode | SelectorMode | C8 | 00 | 55 | 00 SlotConfig00 | SlotConfig01 | 8F 80 | 80 A1 SlotConfig02 | SlotConfig03 | 82 E0 | A3 60 SlotConfig04 | SlotConfig05 | 94 40 | A0 85 SlotConfig06 | SlotConfig07 | 86 40 | 87 07 SlotConfig08 | SlotConfig09 | 0F 00 | 89 F2 SlotConfig0A | SlotConfig0B | 8A 7A | 0B 8B SlotConfig0C | SlotConfig0D | 0C 4C | DD 4D SlotConfig0E | SlotConfig0F | C2 42 | AF 8F UseFlag00 | UpdateCount00 | UseFlag01 | UpdateCount01 | FF | 00 | FF | 00 UseFlag02 | UpdateCount02 | UseFlag03 | UpdateCount03 | FF | 00 | FF | 00 UseFlag04 | UpdateCount04 | UseFlag05 | UpdateCount05 | FF | 00 | FF | 00 UseFlag06 | UpdateCount06 | UseFlag07 | UpdateCount07 | FF | 00 | FF | 00 LastKeyUse[0:3] | FF FF FF FF LastKeyUse[4:7] | FF FF FF FF LastKeyUse[8:B] | FF FF FF FF LastKeyUse[C:F] | FF FF FF FF UserExtra | Selector | LockValue | LockConfig | 00 | 00 | 55 | 00 Using this user supplied HMAC key: #define MY_HMAC_KEY 0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,\ 0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx Writing key to slot 0... Data not locked. Define LOCK_DATA to lock for real. -------------------------------- Personalization is now complete. Configuration is LOCKED Data is UNLOCKEDi thin this is the reason:
Skipping configuration write and lock (configuration already locked).and what i find very interestin that the first two signs of AES Key are correct the rest of them are FFFFF
AES_KEY | XXFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFis it possible to unlock the configuration or did i kill the chip?
Thank you
Greets Eddie -
@Anticimex
ok, i think i know what went wrong! But i dont know how to fix it. On the first run when i tried came the prompt to sens space to lock configuration i did it.
Now when i upload the modified personalization sketch with my keys i get this output on serial monitor:
of course i removed my keys with xx!Device serial: {0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX,0xXX} xxxxxxxxxxxxxxxxxxxxx Skipping configuration write and lock (configuration already locked). Chip configuration: EEPROM DATA: SOFT_HMAC_KEY | FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SOFT_SERIAL | FFFFFFFFFFFFFFFFFF AES_KEY | XXFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ATSHA204A DATA: SN[0:1] | SN[2:3] | XX XX | XX XX Revnum | 00 09 04 00 SN[4:7] | XX XX XX XX SN[8] | Reserved13 | I2CEnable | Reserved15 | EE | 10 | 00 | 00 I2CAddress | TempOffset | OTPmode | SelectorMode | C8 | 00 | 55 | 00 SlotConfig00 | SlotConfig01 | 8F 80 | 80 A1 SlotConfig02 | SlotConfig03 | 82 E0 | A3 60 SlotConfig04 | SlotConfig05 | 94 40 | A0 85 SlotConfig06 | SlotConfig07 | 86 40 | 87 07 SlotConfig08 | SlotConfig09 | 0F 00 | 89 F2 SlotConfig0A | SlotConfig0B | 8A 7A | 0B 8B SlotConfig0C | SlotConfig0D | 0C 4C | DD 4D SlotConfig0E | SlotConfig0F | C2 42 | AF 8F UseFlag00 | UpdateCount00 | UseFlag01 | UpdateCount01 | FF | 00 | FF | 00 UseFlag02 | UpdateCount02 | UseFlag03 | UpdateCount03 | FF | 00 | FF | 00 UseFlag04 | UpdateCount04 | UseFlag05 | UpdateCount05 | FF | 00 | FF | 00 UseFlag06 | UpdateCount06 | UseFlag07 | UpdateCount07 | FF | 00 | FF | 00 LastKeyUse[0:3] | FF FF FF FF LastKeyUse[4:7] | FF FF FF FF LastKeyUse[8:B] | FF FF FF FF LastKeyUse[C:F] | FF FF FF FF UserExtra | Selector | LockValue | LockConfig | 00 | 00 | 55 | 00 Using this user supplied HMAC key: #define MY_HMAC_KEY 0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,\ 0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx,0xxx Writing key to slot 0... Data not locked. Define LOCK_DATA to lock for real. -------------------------------- Personalization is now complete. Configuration is LOCKED Data is UNLOCKEDi thin this is the reason:
Skipping configuration write and lock (configuration already locked).and what i find very interestin that the first two signs of AES Key are correct the rest of them are FFFFF
AES_KEY | XXFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFis it possible to unlock the configuration or did i kill the chip?
Thank you
Greets Eddie@meddie you cannot undo a lock, and you have to lock the chip in order to use it. And it is not an error that it reports chip is already locked since you have locked it already.
Furthermore, AES key and eeprom has nothing to do with the atsha204a chip so the lock state of the chip is irrelevant.
Now, why your AES key is only partially stored, I am not sure. But my bet would be that you have an error in the line where you define it in the sketch. A space or something like that.
Finally, as long as you don't lock the data zone, and you don't tamper with the configuration bits for the atsha204a device, you cannot destroy the chip. You can always replace the hmac key, which is the only thing you program to the atsha using the personalizer. Except for the chip configuration bits, and those the sketch handles for you and once config is locked they are fixed in place.