diff --git a/library.json b/library.json index 90d5b6a..13961ca 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "LMICPP-Arduino", - "version": "2.3.0", + "version": "2.3.1", "keywords": "Lora", "description": "Modified Arduino port of the LMIC (LoraWAN-in-C, formerly LoraMAC-in-C) framework provided by IBM. Changed to C++ format.", "frameworks": ["arduino"], diff --git a/library.properties b/library.properties index 9881983..b5e1ad3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=LMICPP-Arduino -version=2.3.0 +version=2.3.1 author=IBM maintainer=Nicolas Graziano sentence=Modified Arduino port of the LMIC (LoraWAN-in-C, formerly LoraMAC-in-C) framework provided by IBM. Changed to C++ format. diff --git a/platformio.ini b/platformio.ini index 4c686fb..5735e96 100644 --- a/platformio.ini +++ b/platformio.ini @@ -19,7 +19,7 @@ upload_speed = 9600 #upload_speed = 57600 upload_port = COM3 # test_port= COM3 -# test_speed=57600 +test_speed=9600 monitor_port = COM3 monitor_speed = 9600 diff --git a/src/aes/limc_aes.cpp b/src/aes/limc_aes.cpp index 0b7adcf..b68b9ae 100644 --- a/src/aes/limc_aes.cpp +++ b/src/aes/limc_aes.cpp @@ -79,7 +79,8 @@ void Aes::appendMic(const uint32_t devaddr, const uint32_t seqno, * len : total length (MIC included) */ void Aes::appendMic0(uint8_t *const pdu, const uint8_t len) const { - AesBlock buf = {0}; + AesBlock buf; + buf.fill(0); const uint8_t lenWithoutMic = len - lengths::MIC; aes_cmac(pdu, lenWithoutMic, false, AESDevKey, buf); // Copy MIC0 at the end @@ -91,7 +92,8 @@ void Aes::appendMic0(uint8_t *const pdu, const uint8_t len) const { * len : total length (MIC included) */ bool Aes::verifyMic0(const uint8_t *const pdu, const uint8_t len) const { - AesBlock buf = {0}; + AesBlock buf; + buf.fill(0); const uint8_t lenWithoutMic = len - lengths::MIC; aes_cmac(pdu, lenWithoutMic, false, AESDevKey, buf); return std::equal(buf.begin(), buf.begin() + lengths::MIC, @@ -202,8 +204,9 @@ void Aes::aes_cmac(const uint8_t *buf, uint8_t len, const bool prepend_aux, // Final block, xor with K1 or K2. K1 and K2 are calculated // by encrypting the all-zeroes block and then applying some // shifts and xor on that. - AesBlock final_key = {0}; - // std::fill(final_key, final_key + AES_BLCK_SIZE, 0); + AesBlock final_key; + std::fill_n(final_key.begin(), final_key.size(), 0); + block_encrypt(final_key, key); // Calculate K1