[LoRaWAN] Cppcheck fixes
This commit is contained in:
parent
1324b53f7b
commit
64f0f5028b
3 changed files with 5 additions and 4 deletions
|
@ -2417,7 +2417,8 @@ void LoRaWANNode::postprocessMacLinkAdr(uint8_t* ack, uint8_t cLen) {
|
||||||
int16_t LoRaWANNode::getMacCommand(uint8_t cid, LoRaWANMacCommand_t* cmd) {
|
int16_t LoRaWANNode::getMacCommand(uint8_t cid, LoRaWANMacCommand_t* cmd) {
|
||||||
for(size_t i = 0; i < RADIOLIB_LORAWAN_NUM_MAC_COMMANDS; i++) {
|
for(size_t i = 0; i < RADIOLIB_LORAWAN_NUM_MAC_COMMANDS; i++) {
|
||||||
if(MacTable[i].cid == cid) {
|
if(MacTable[i].cid == cid) {
|
||||||
memcpy(reinterpret_cast<void*>(cmd), (void*)&MacTable[i], sizeof(LoRaWANMacCommand_t));
|
LoRaWANMacCommand_t* cmdPtr = const_cast<LoRaWANMacCommand_t*>(&MacTable[i]);
|
||||||
|
memcpy(reinterpret_cast<void*>(cmd), reinterpret_cast<void*>(cmdPtr), sizeof(LoRaWANMacCommand_t));
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void RadioLibAES128::generateCMAC(const uint8_t* in, size_t len, uint8_t* cmac)
|
||||||
delete[] buff;
|
delete[] buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadioLibAES128::verifyCMAC(uint8_t* in, size_t len, const uint8_t* cmac) {
|
bool RadioLibAES128::verifyCMAC(const uint8_t* in, size_t len, const uint8_t* cmac) {
|
||||||
uint8_t cmacReal[RADIOLIB_AES128_BLOCK_SIZE];
|
uint8_t cmacReal[RADIOLIB_AES128_BLOCK_SIZE];
|
||||||
this->generateCMAC(in, len, cmacReal);
|
this->generateCMAC(in, len, cmacReal);
|
||||||
for(size_t i = 0; i < RADIOLIB_AES128_BLOCK_SIZE; i++) {
|
for(size_t i = 0; i < RADIOLIB_AES128_BLOCK_SIZE; i++) {
|
||||||
|
@ -192,7 +192,7 @@ void RadioLibAES128::blockLeftshift(uint8_t* dst, const uint8_t* src) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioLibAES128::generateSubkeys(uint8_t* key1, uint8_t* key2) {
|
void RadioLibAES128::generateSubkeys(uint8_t* key1, uint8_t* key2) {
|
||||||
uint8_t const_Zero[] = {
|
const uint8_t const_Zero[] = {
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
|
|
@ -142,7 +142,7 @@ class RadioLibAES128 {
|
||||||
\param cmac CMAC to verify.
|
\param cmac CMAC to verify.
|
||||||
\returns True if valid, false otherwise.
|
\returns True if valid, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool verifyCMAC(uint8_t* in, size_t len, const uint8_t* cmac);
|
bool verifyCMAC(const uint8_t* in, size_t len, const uint8_t* cmac);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t* keyPtr = nullptr;
|
uint8_t* keyPtr = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue