bool transportInit() {

	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		hwReadConfigBlock((void*)_psk, (void*)EEPROM_RF_ENCRYPTION_AES_KEY_ADDRESS, 32);
		//set up AES-key
		_aes.set_key(_psk, 32);
		// Make sure it is purged from memory when set
		memset(_psk, 0, 32);
		//set up AES IV
		hwReadConfigBlock((void*)IVCl,(void*)EEPROM_RF_ENCRYPTION_AES_IV_ADDRESS,8);
		_aes.set_IV(IVCl);
	#endif

	return RF24_initialize();
}
예제 #2
0
bool transportInit(void)
{
#if defined(MY_RF24_ENABLE_ENCRYPTION)
	uint8_t RF24_psk[16];
#ifdef MY_ENCRYPTION_SIMPLE_PASSWD
	(void)memset(RF24_psk, 0, 16);
	(void)memcpy(RF24_psk, MY_ENCRYPTION_SIMPLE_PASSWD, strnlen(MY_ENCRYPTION_SIMPLE_PASSWD, 16));
#else
	hwReadConfigBlock((void *)RF24_psk, (void *)EEPROM_RF_ENCRYPTION_AES_KEY_ADDRESS, 16);
#endif
	//set up AES-key
	RF24_aes.set_key(RF24_psk, 16);
	// Make sure it is purged from memory when set
	(void)memset(RF24_psk, 0, 16);
#endif

#if defined(MY_RX_MESSAGE_BUFFER_FEATURE)
	RF24_registerReceiveCallback( transportRxCallback );
#endif
	return RF24_initialize();
}