uint8_t transportReceive(void* data) {
	uint8_t len = _rf24.getDynamicPayloadSize();
	_rf24.read(data, len);
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		_aes.set_IV(0);//not sure if necessary
		_aes.cbc_decrypt((byte*)(data), (byte*)(data), len>16?2:1); // decrypt
	#endif
	return len;
}
uint8_t transportReceive(void* data) {
	uint8_t len = RF24_readMessage(data);
	#if defined(MY_RF24_ENABLE_ENCRYPTION)
		// has to be adjusted, WIP!
		_aes.set_IV(0);
		// decrypt data
		_aes.cbc_decrypt((byte*)(data), (byte*)(data), len>16?2:1);
	#endif
	return len;
}
Exemplo n.º 3
0
uint8_t transportReceive(void *data)
{
	uint8_t len = 0;
#if defined(MY_RX_MESSAGE_BUFFER_FEATURE)
	transportQueuedMessage* msg = transportRxQueue.getBack();
	if (msg) {
		len = msg->m_len;
		(void)memcpy(data, msg->m_data, len);
		(void)transportRxQueue.popBack();
	}
#else
	len = RF24_readMessage(data);
#endif
#if defined(MY_RF24_ENABLE_ENCRYPTION)
	// has to be adjusted, WIP!
	RF24_aes.set_IV(0);
	// decrypt data
	if (RF24_aes.cbc_decrypt((uint8_t *)data, (uint8_t *)data, len > 16 ? 2 : 1) != AES_SUCCESS) {
		len = 0;
	}
#endif
	return len;
}