2021-11-14 10:25 AM
Hello,
I'm currently working with the BlueNRG-2 SoC. I would like to add AES-128 encryption at application-level while leveraging hardware acceleration.
The only function I've found that seems to do the job is hci_le_encrypt(). Based on the documentation, it looks like a straightforward function to encrypt a single 128bits block using AES. However, I'm puzzled by the output I get from this function.
I did a fairly simple test:
With hci_le_encrypt(), I always get the following encrypted block: `{ 0xd0, 0xbf, 0xe1, 0xc7, 0x9a, 0x57, 0xa7, 0xe7, 0x4b, 0x27, 0x6e, 0x90, 0xcc, 0xa5, 0xa7, 0x29 }`.
Whereas with all other AES implementations I've tried, I get the following encrypted block: `{ 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a }`.
I did try with Pycryptodome (x86), TI AES software implementation (on the BlueNRG2 SoC itself), and another implementation found on Github (on the BlueNRG2 SoC). When relevant, I used ECB mode + no IV. All of them returned the same consistent result.
I have no idea why hci_le_encrypt() returns something else. Did I miss something ?
Best regards,
2021-11-17 02:11 AM
hello,
try to invert your key and data, encrypt and invert output.
2021-11-18 10:12 AM
OK, that does work ! Thanks :)