Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22215

MSP430FR5994: AES encryption using DMA for ECB

$
0
0

Part Number:MSP430FR5994

I'm using DMA for doing ECB encryption.  I found an unusual problem when encrypting a static buffer:

uint8_t encryptthisBuffer[64] = 
{
    0xfc, 0x76, 0x00, 0x00, 0x01, 0x5b, 0x58, 0xa7,
    0x78, 0x30, 0x01, 0x00, 0x00, 0x01, 0x5b, 0x58,
    0xa7, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x40,
    0x66, 0x66, 0x66, 0x40, 0x43, 0x52, 0x82, 0x1e,
    0x52, 0xd1, 0x5e, 0xc0, 0x5e, 0x5a, 0x19, 0x29,
    0x31, 0x51, 0xb2, 0x3d, 0xcc, 0xcc, 0xcd, 0x43,
    0x03, 0x51, 0xec, 0x40, 0x16, 0x88, 0x04, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c
};

This buffer resides in RAM and I get a different encryption answer than if it resides in FRAM:
Encrypted RAM answer (wrong):
22 f1 fe d0 94 da c2 1f ab e6 03 4c d4 64 d7 ee
f7 14 f8 c3 20 2b af ad ae 8d 1a 4f b0 3c 79 76
bf 10 5a e6 57 8d d3 67 d5 90 45 32 3e b0 86 a4
25 57 ea 72 fb a7 26 b6 bf 06 a0 d1 3e a6 da d5

Encrypted FRAM answer (correct):
17 71 ff 8d f8 c1 50 d3 0d 4c c0 65 cb 27 5a 43
6a 2b df f7 44 ec b0 74 34 2c 6a b2 56 21 66 b0
f4 c8 c5 8e 86 7e ad 9b b3 ae 6d 46 da 30 74 be
bd 1e ed 68 9b f4 4a d7 0f d6 8f 9f 9b 54 2a 7f


The key is generic:
const uint8_t default_AESkey_buffer[32] = 
{
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
    0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
    0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};

If I make
encryptthisBuffer[] const, it works since the IAR compiler puts it into FRAM (code) memory.
But if it's a global statically allocated RAM buffer, I get the wrong data via the DMA encryption engine.


Here are some image snippets of the data in the IAR debugger (only the first 5-byes of encrypted data in images):

BAD:




GOOD:



Am I going nuts, something I'm doing incorrectly, or is there a problem?

Thanks,
-Jim Patten










Viewing all articles
Browse latest Browse all 22215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>