LMiC LoRa Semtech + Nucleo

Dependents:   LoRaWAN-lmic-app

Fork of LMiC by Semtech

Files at this revision

API Documentation at this revision

Comitter:
pnysten
Date:
Mon Nov 23 09:53:54 2015 +0000
Parent:
2:bebd6b2e3d18
Commit message:
Encryption bypassed when port is >0

Changed in this revision

lmic.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r bebd6b2e3d18 -r 1079dc4b4c59 lmic.cpp
--- a/lmic.cpp	Fri Nov 20 12:30:06 2015 +0000
+++ b/lmic.cpp	Mon Nov 23 09:53:54 2015 +0000
@@ -1227,9 +1227,16 @@
     if( !replayConf ) {
         // Handle payload only if not a replay
         // Decrypt payload - if any
-        if( port >= 0  &&  pend-poff > 0 )
+        
+        //if( port >= 0  &&  pend-poff > 0 )
+            //aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
+
+        if( port == 0  &&  pend-poff > 0 )
+        {
+            debug_str("Payload decrypting...\r\n");
             aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
-
+        }
+        
         EV(dfinfo, DEBUG, (e_.deveui  = MAIN::CDEV->getEui(),
                            e_.devaddr = LMIC.devaddr,
                            e_.seqno   = seqno,