]> granicus.if.org Git - esp-idf/commitdiff
ble_mesh: fix output MIC with additional data
authorlly <lly@espressif.com>
Mon, 2 Sep 2019 06:06:15 +0000 (14:06 +0800)
committerlly <lly@espressif.com>
Mon, 9 Sep 2019 09:15:16 +0000 (17:15 +0800)
components/bt/esp_ble_mesh/mesh_core/crypto.c

index d2e650788235b7da87b6c7d4c3c60d2f4b5d9b38..7573e164fdb304f0891cd6f79ca194d33f7b5f79 100644 (file)
@@ -261,7 +261,7 @@ static int bt_mesh_ccm_decrypt(const u8_t key[16], u8_t nonce[13],
             }
         }
 
-        for (i = 0; i < aad_len; i++, j++) {
+        for (; i < aad_len; i++, j++) {
             pmsg[i] = Xn[i] ^ aad[j];
         }
 
@@ -425,7 +425,7 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
             }
         }
 
-        for (i = 0; i < aad_len; i++, j++) {
+        for (; i < aad_len; i++, j++) {
             pmsg[i] = Xn[i] ^ aad[j];
         }