Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AES-CCM (Counter with CBC-MAC) #52

Open
ahpohl opened this issue Apr 8, 2020 · 0 comments
Open

Support for AES-CCM (Counter with CBC-MAC) #52

ahpohl opened this issue Apr 8, 2020 · 0 comments

Comments

@ahpohl
Copy link

ahpohl commented Apr 8, 2020

Have you considered supporting AES-CCM mode?

It's used, for example, in Bluetooth Low Energy (BLE) applications to encrypt the payload in advertisement packets.

The code I am writing is for ESPHome and runs on ESP32 etc., so the implementation needs to be optimized for "small" µC like NodeMCUs and AVRs. This library looks ideal to me and is already supported by the Arduino IDE and PlatformIO. Additionally, it supports the other AES AEAD modes GCM and EAX, so the implementation of CCM would be trivial.

Here is a test vector for 128 bit AES-CCM I am struggling with:

static TestVector const testVectorCCM PROGMEM = {
    .name        = "AES-128 CCM BLE ADV",
    .key         = {0xE9, 0xEF, 0xAA, 0x68, 0x73, 0xF9, 0xF9, 0xC8,
                    0x7A, 0x5E, 0x75, 0xA5, 0xF8, 0x14, 0x80, 0x1C},
    .plaintext   = {0x04, 0x10, 0x02, 0xD3, 0x00},
    .ciphertext  = {0xDA, 0x61, 0x66, 0x77, 0xD5},
    .authdata    = {0x11},
    .iv          = {0x78, 0x16, 0x4E, 0x38, 0xC1, 0xA4, 0x5B, 0x05,
                    0x3D, 0x2E, 0x00, 0x00},
    .tag         = {0x92, 0x98, 0x23, 0x52},
    .authsize    = 1,
    .datasize    = 5,
    .tagsize     = 4,
    .ivsize      = 12
};

I already have the BLE decryption working "offline", but the current code uses Crypto++ as its AES library and is not portable to ESPHome.

Thank you very much for your help and support in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant