Skip to content

Not possible to send 255 bytes of data by loraWAN #1013

Open
@Maddocrus

Description

@Maddocrus

Describe the bug

The data is not fully AES encrypted.

https://github.com/mcci-catena/arduino-lmic/blob/master/src/aes/lmic.c

Line: 248

u4_t os_aes (u1_t mode, xref2u1_t buf, u2_t len) {

        aesroundkeys();

        if( mode & AES_MICNOAUX ) {
            AESAUX[0] = AESAUX[1] = AESAUX[2] = AESAUX[3] = 0;
        } else {
            AESAUX[0] = swapmsbf(AESAUX[0]);
            AESAUX[1] = swapmsbf(AESAUX[1]);
            AESAUX[2] = swapmsbf(AESAUX[2]);
            AESAUX[3] = swapmsbf(AESAUX[3]);
        }

        while( (signed char)len > 0 ) {  <------- Problem is here
...

It turns out of range "len" is larger "(signed char)" then we get a value with a minus sign and encryption is ignored.
If i set len = 250 it turns to -6 and i have no encryption.

Environment

  • Version of LMIC being used - 5.+
  • Version of Arduino IDE being used - 2+
  • Network provider - ChirpStack
  • Region - EU868
  • Board - Heltec
  • CPU - ESP32
  • Radio - SX1262

To Reproduce

Send a data packet larger than 127 bytes.

Expected behavior

It is expected that the 255 byte will be encrypted.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions