nrf-hal icon indicating copy to clipboard operation
nrf-hal copied to clipboard

Enable CCM demo to work on nrf51

Open therealprof opened this issue 3 years ago • 4 comments

Signed-off-by: Daniel Egger [email protected]

therealprof avatar Sep 16 '20 08:09 therealprof

nRF51 devices only support payloads of up to 27 bytes.

Maybe we should change the example to use smaller payloads, I remember that I used those sizes because I wanted to try some bench-marking. Since I already included the example as a "benchmark" (see stopwatch.rs) maybe we should use some cfgs also on the buffer size.

thalesfragoso avatar Sep 16 '20 22:09 thalesfragoso

Huh? Where does that quoted comment come from? 😅

therealprof avatar Sep 17 '20 07:09 therealprof

From the docs: https://github.com/nrf-rs/nrf-hal/blob/af83e6ed69c5ec03b1e0f6b4adae53258f57e83a/nrf-hal-common/src/ccm.rs#L40

And from the manual:

Encryption (Page 121):

The AES CCM is limited to read maximum 27 bytes of the unencrypted payload (PL) regardless of what is specified in the length field of the unencrypted packet.

Decryption (Page 122):

The AES CCM is limited to read maximum 27 bytes of the encrypted payload and four bytes of the MIC regardless of what is specified in the length field of the encrypted packet.

thalesfragoso avatar Sep 18 '20 00:09 thalesfragoso

I'll modify the example to use less payload on nrf51 when I find time (or someone beats me to it 😉 ).

therealprof avatar Sep 18 '20 07:09 therealprof