Skip to main content
alemv
Associate
Feb 6, 2022 12:01 PM UTC
Question

Are AES-CCM encryption functions available to the BlueNRG-LP application developer?

I noticed that the BlueNRG-LP BLE stack uses a special version of the cryptographic library "libcrypto.a" with only AES-CMAC cryptographic functions. But I do know that LE Legacy connections and LE Secure connections share AES in four different flavors: AES-ECB, AES-CBC, AES-CTR, and AES-CCM.

Since I need AES-CCM to encrypt(decrypt) traffic over UART, I have a question: is the AES-CCM encryption(decryption) used by the stack available to the application developer? If not, which of the plain AES encryption function is safe and better to use: AES_general_SW_enc (from cryptolib), AES_128_HW_enc (from aes_hw.c), hci_le_encrypt (from BLE stack) or AESMGR_Encrypt (from AESMGR)?

    This topic has been closed for replies.

    5 replies

    alemv
    alemvAuthor
    Associate
    Jul 13, 2022 6:15 AM UTC

    I haven't found a way to use the AES-CCM feature of the BLE stack itself. So I had to write my own encryption and decryption functions for my special case (1 <= payload <= 255, no extra data, MAC length = 4, nonce = 13 zeros, ciphertext = payload + 4) using the function hci_le_encrypt. It works.

    Khojah
    Visitor II
    Aug 9, 2022 9:09 AM UTC

    you saved my day thanks

    let me ask how to encrypt an extended packet (more than 16 bytes)

    alemv
    alemvAuthor
    Associate
    Aug 9, 2022 2:28 PM UTC

    See encrypt_special_aes_ccm and decrypt_special_aes_ccm functions in the attachment.

    AndyR1
    Senior
    Jul 13, 2022 12:40 PM UTC

    ok, i was using the BlueNRG-LP DK 1.0.0, I moved to the actual last BlueNRG-LP_LPS DK 1.2.0 to have the AES ECB.

    JLEE.191
    Visitor II
    Nov 15, 2022 9:20 AM UTC

    I haven't found a way to use the AES-CCM feature of the BLE stack itself. So I had to write my own encryption and decryption functions for my special case (1 <= payload <= 255, no extra data, MAC length = 4, nonce = 13 zeros, ciphertext = payload + 4) using the function hci_le_encrypt. It works.