Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: LoRaWAN-test-10secs
Fork of LMiC by
Revision 6:71f4de8e79e0, committed 2016-01-08
- Comitter:
- pnysten
- Date:
- Fri Jan 08 09:57:53 2016 +0000
- Parent:
- 5:74acff269a3d
- Child:
- 7:758e1719910c
- Commit message:
- No confirmation on uplink messages
Changed in this revision
| aes.cpp | Show annotated file Show diff for this revision Revisions of this file |
| lmic.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/aes.cpp Mon Dec 21 14:19:28 2015 +0000
+++ b/aes.cpp Fri Jan 08 09:57:53 2016 +0000
@@ -10,6 +10,7 @@
*******************************************************************************/
#include "oslmic.h"
+#include "debug.h"
#define AES_MICSUB 0x30 // internal use only
@@ -334,7 +335,10 @@
}
} else { // CIPHER
if( mode & AES_CTR ) { // xor block (partially)
+
t0 = (len > 16) ? 16: len;
+ debug_str("Payload before XOR:");
+ debug_buf(buf,len);
for(t1=0; t1<t0; t1++) {
buf[t1] ^= (a0>>24);
a0 <<= 8;
--- a/lmic.cpp Mon Dec 21 14:19:28 2015 +0000
+++ b/lmic.cpp Fri Jan 08 09:57:53 2016 +0000
@@ -180,6 +180,13 @@
static void aes_cipher (xref2cu1_t key, u4_t devaddr, u4_t seqno, int dndir, xref2u1_t payload, int len) {
+
+ debug_str("Frame Cnt: ");
+ debug_uint(seqno);
+ debug_char( '\r' );
+ debug_char( '\n' );
+ debug_str("Payload before AES treatment: ");
+ debug_buf(payload, len);
if( len <= 0 )
return;
os_clearMem(AESaux, 16);
@@ -188,7 +195,13 @@
os_wlsbf4(AESaux+ 6,devaddr);
os_wlsbf4(AESaux+10,seqno);
os_copyMem(AESkey,key,16);
+ debug_str("A:");
+ debug_buf(AESaux,16);
os_aes(AES_CTR, payload, len);
+ debug_str("A after AES treatment:");
+ debug_buf(AESaux,16);
+ debug_str("Payload after AES treatment: ");
+ debug_buf(payload, len);
}
@@ -1233,7 +1246,7 @@
if( port >= 0 && port != 1 && pend-poff > 0 )
{
- //debug_str("Payload decrypting...\r\n");
+ debug_str("Payload decrypting...\r\n");
aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
}
