mirror of https://github.com/arendst/Tasmota.git
Fix Lora ESP32S3 compile warning
This commit is contained in:
parent
bd3c7d8ddf
commit
0814acb8dc
|
@ -43,7 +43,8 @@ bool LoraSx126xBusy(void) {
|
||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void IRAM_ATTR LoraSx126xOnInterrupt(void) {
|
void IRAM_ATTR LoraSx126xOnInterrupt(void);
|
||||||
|
void LoraSx126xOnInterrupt(void) {
|
||||||
// This is called after EVERY type of enabled interrupt so chk for valid receivedFlag in LoraAvailableSx126x()
|
// This is called after EVERY type of enabled interrupt so chk for valid receivedFlag in LoraAvailableSx126x()
|
||||||
if (!Lora.sendFlag && !Lora.receivedFlag && !Lora.receive_time) {
|
if (!Lora.sendFlag && !Lora.receivedFlag && !Lora.receive_time) {
|
||||||
Lora.receive_time = millis();
|
Lora.receive_time = millis();
|
||||||
|
|
|
@ -26,6 +26,20 @@ uint32_t LoraWanGenerateMIC(uint8_t* msg, size_t len, uint8_t* key) {
|
||||||
return(((uint32_t)cmac[0]) | ((uint32_t)cmac[1] << 8) | ((uint32_t)cmac[2] << 16) | ((uint32_t)cmac[3]) << 24);
|
return(((uint32_t)cmac[0]) | ((uint32_t)cmac[1] << 8) | ((uint32_t)cmac[2] << 16) | ((uint32_t)cmac[3]) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************************/
|
||||||
|
|
||||||
|
// EncryptJoinAccept uses AES Decrypt to encrypt a join-accept message
|
||||||
|
// - The payload contains JoinNonce/AppNonce | NetID | DevAddr | DLSettings | RxDelay | (CFList | CFListType) | MIC
|
||||||
|
// - In LoRaWAN 1.0, the AppKey is used
|
||||||
|
// - In LoRaWAN 1.1, the NwkKey is used in reply to a JoinRequest
|
||||||
|
// - In LoRaWAN 1.1, the JSEncKey is used in reply to a RejoinRequest (type 0,1,2)
|
||||||
|
void LoraWanEncryptJoinAccept(uint8_t* key, uint8_t* payload, size_t len, uint8_t* encrypted) {
|
||||||
|
RadioLibAES128Instance.init(key);
|
||||||
|
RadioLibAES128Instance.decryptECB(payload, len, encrypted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************************************/
|
||||||
|
|
||||||
// deriveLegacySKey derives a session key
|
// deriveLegacySKey derives a session key
|
||||||
void _LoraWanDeriveLegacySKey(uint8_t* key, uint8_t t, uint32_t jn, uint32_t nid, uint16_t dn, uint8_t* derived) {
|
void _LoraWanDeriveLegacySKey(uint8_t* key, uint8_t t, uint32_t jn, uint32_t nid, uint16_t dn, uint8_t* derived) {
|
||||||
uint8_t buf[TAS_LORAWAN_AES128_KEY_SIZE] = { 0 };
|
uint8_t buf[TAS_LORAWAN_AES128_KEY_SIZE] = { 0 };
|
||||||
|
|
|
@ -297,8 +297,7 @@ bool LoraWanInput(uint8_t* data, uint32_t packet_size) {
|
||||||
join_data[16] = NewMIC >> 24;
|
join_data[16] = NewMIC >> 24;
|
||||||
uint8_t EncData[33];
|
uint8_t EncData[33];
|
||||||
EncData[0] = join_data[0];
|
EncData[0] = join_data[0];
|
||||||
RadioLibAES128Instance.init(LoraSettings.end_node[node].AppKey);
|
LoraWanEncryptJoinAccept(LoraSettings.end_node[node].AppKey, &join_data[1], 16, &EncData[1]);
|
||||||
RadioLibAES128Instance.decryptECB(&join_data[1], 16, &EncData[1]);
|
|
||||||
|
|
||||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Join %17_H"), join_data);
|
// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Join %17_H"), join_data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue