mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	save work
This commit is contained in:
		
							parent
							
								
									df1449f2e5
								
							
						
					
					
						commit
						4b52f241ec
					
				@ -803,6 +803,7 @@ void ApplicationLayer::individualIndication(HopCountType hopType, Priority prior
 | 
				
			|||||||
            _bau.deviceDescriptorReadAppLayerConfirm(priority, hopType, tsap, secCtrl, *data & 0x3f, data + 1);
 | 
					            _bau.deviceDescriptorReadAppLayerConfirm(priority, hopType, tsap, secCtrl, *data & 0x3f, data + 1);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case Restart:
 | 
					        case Restart:
 | 
				
			||||||
 | 
					            // TODO: handle erase code for factory reset (setting FDSK again as toolkey, etc.)
 | 
				
			||||||
            if ((*data & 0x3f) == 0)
 | 
					            if ((*data & 0x3f) == 0)
 | 
				
			||||||
                _bau.restartRequestIndication(priority, hopType, tsap, secCtrl);
 | 
					                _bau.restartRequestIndication(priority, hopType, tsap, secCtrl);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
				
			|||||||
@ -186,6 +186,10 @@ void BauSystemB::memoryReadIndication(Priority priority, HopCountType hopType, u
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void BauSystemB::restartRequestIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl)
 | 
					void BauSystemB::restartRequestIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl &secCtrl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					#ifdef USE_DATASECURE
 | 
				
			||||||
 | 
					    // If erase code is FactoryReset, set FDSK as toolkey again
 | 
				
			||||||
 | 
					    //_secIfObj.factoryReset();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
    // Flush the EEPROM before resetting
 | 
					    // Flush the EEPROM before resetting
 | 
				
			||||||
    _memory.writeMemory();
 | 
					    _memory.writeMemory();
 | 
				
			||||||
    _platform.restart();
 | 
					    _platform.restart();
 | 
				
			||||||
 | 
				
			|||||||
@ -9,8 +9,8 @@
 | 
				
			|||||||
#include "callback_property.h"
 | 
					#include "callback_property.h"
 | 
				
			||||||
#include "function_property.h"
 | 
					#include "function_property.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Our FDSK
 | 
					// Our FDSK. It is never changed from ETS. This is permanent default tool key restarted on every factory reset of the device.
 | 
				
			||||||
uint8_t SecurityInterfaceObject::_fdsk[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
 | 
					const uint8_t SecurityInterfaceObject::_fdsk[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
 | 
				
			||||||
uint8_t SecurityInterfaceObject::_secReport[] = { 0x00, 0x00, 0x00 };
 | 
					uint8_t SecurityInterfaceObject::_secReport[] = { 0x00, 0x00, 0x00 };
 | 
				
			||||||
uint8_t SecurityInterfaceObject::_secReportCtrl[] = { 0x00, 0x00, 0x00 };
 | 
					uint8_t SecurityInterfaceObject::_secReportCtrl[] = { 0x00, 0x00, 0x00 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -149,7 +149,7 @@ SecurityInterfaceObject::SecurityInterfaceObject()
 | 
				
			|||||||
                resultData[0] = ReturnCodes::GenericError;
 | 
					                resultData[0] = ReturnCodes::GenericError;
 | 
				
			||||||
                resultLength = 1;
 | 
					                resultLength = 1;
 | 
				
			||||||
            }),
 | 
					            }),
 | 
				
			||||||
        new DataProperty( PID_TOOL_KEY, true, PDT_GENERIC_16, 1, ReadLv3 | WriteLv0, (uint8_t*) _fdsk ), // default is FDSK
 | 
					        new DataProperty( PID_TOOL_KEY, true, PDT_GENERIC_16, 1, ReadLv3 | WriteLv0, (uint8_t*) _fdsk ), // default is FDSK // TODO: do not overwrite on every device startup!!!!!!!!! ETS changes this property during programming from FDSK to some random key!
 | 
				
			||||||
        new DataProperty( PID_SECURITY_REPORT, true, PDT_BITSET8, 1, ReadLv3 | WriteLv0, _secReport ), // Not implemented
 | 
					        new DataProperty( PID_SECURITY_REPORT, true, PDT_BITSET8, 1, ReadLv3 | WriteLv0, _secReport ), // Not implemented
 | 
				
			||||||
        new DataProperty( PID_SECURITY_REPORT_CONTROL, true, PDT_BINARY_INFORMATION, 1, ReadLv3 | WriteLv0, _secReportCtrl ), // Not implemented
 | 
					        new DataProperty( PID_SECURITY_REPORT_CONTROL, true, PDT_BINARY_INFORMATION, 1, ReadLv3 | WriteLv0, _secReportCtrl ), // Not implemented
 | 
				
			||||||
        new DataProperty( PID_SEQUENCE_NUMBER_SENDING, true, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 ), // Updated by our device accordingly
 | 
					        new DataProperty( PID_SEQUENCE_NUMBER_SENDING, true, PDT_GENERIC_06, 1, ReadLv3 | WriteLv0 ), // Updated by our device accordingly
 | 
				
			||||||
@ -186,5 +186,10 @@ bool SecurityInterfaceObject::isLoaded()
 | 
				
			|||||||
    return _state == LS_LOADED;
 | 
					    return _state == LS_LOADED;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SecurityInterfaceObject::factoryReset()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    property(PID_TOOL_KEY)->write(1, 1, _fdsk);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,8 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  void secureApplicationLayer(SecureApplicationLayer& secAppLayer);
 | 
					  void secureApplicationLayer(SecureApplicationLayer& secAppLayer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void factoryReset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t* save(uint8_t* buffer) override;
 | 
					  uint8_t* save(uint8_t* buffer) override;
 | 
				
			||||||
  const uint8_t* restore(const uint8_t* buffer) override;
 | 
					  const uint8_t* restore(const uint8_t* buffer) override;
 | 
				
			||||||
  uint16_t saveSize() override;
 | 
					  uint16_t saveSize() override;
 | 
				
			||||||
@ -26,7 +28,7 @@ private:
 | 
				
			|||||||
  LoadState _state = LS_UNLOADED;
 | 
					  LoadState _state = LS_UNLOADED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Our FDSK
 | 
					  // Our FDSK
 | 
				
			||||||
  static uint8_t _fdsk[];
 | 
					  static const uint8_t _fdsk[];
 | 
				
			||||||
  static uint8_t _secReport[];
 | 
					  static uint8_t _secReport[];
 | 
				
			||||||
  static uint8_t _secReportCtrl[];
 | 
					  static uint8_t _secReportCtrl[];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user