Ejemplo n.º 1
0
bool transportSend(const uint8_t to, const void *data, const uint8_t len, const bool noACK)
{
#if defined(MY_RF24_ENABLE_ENCRYPTION)
	// copy input data because it is read-only
	(void)memcpy(RF24_dataenc,data,len);
	// has to be adjusted, WIP!
	RF24_aes.set_IV(0);
	const uint8_t finalLength = len > 16 ? 32 : 16;
	//encrypt data
	RF24_aes.cbc_encrypt(RF24_dataenc, RF24_dataenc, finalLength / 16);
	return RF24_sendMessage(to, RF24_dataenc, finalLength, noACK);
#else
	return RF24_sendMessage(to, data, len, noACK);
#endif
}
Ejemplo n.º 2
0
bool transportSend(uint8_t recipient, const void* data, uint8_t len) {
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		// copy input data because it is read-only
		memcpy(_dataenc,data,len);
		len = len > 16 ? 32 : 16;
		#if defined(MY_GATEWAY_FEATURE)
			SdReadNodeData(RF24_getNodeID(), nd);
			_aes.set_key(nd.AES_256,32);
			_aes.set_IV(nd.IV);
		#else
		#endif
		//encrypt data
		_aes.set_IV(IVCl);
		_aes.cbc_encrypt(_dataenc, _dataenc, len/16);
		bool status = RF24_sendMessage( recipient, _dataenc, len );
	#else
		bool status = RF24_sendMessage( recipient, data, len );
	#endif

	return status;
}