Modified AES-128 CCM code for working with Cypress PSOC 4 encoding functions. Based on OpenSSL
- PSOC4 uses AES-CCM 128 bits which is popular in BLE standard.
- IV (=Initial Vector) is named "nonce" in PSOC terminology and is 13 bytes.
- Tag is named MIC and is 4 bytes.
- According to PSOC docs a {1} array should be used for AAD
- Plaintext is the raw data. Its size is limited to 27 bytes in PSOC functions.
Here I use OpenSSL library. To install it on linux do the followings:
- Install the library:
- sudo apt install libss-dev
- Find the location of installed library. On Ubuntu 18 and 20 {OPENSSL_LOCATION} = /usr/lib/x86_64-linux-gnu/
- dpkg-query -L libssl-dev
- Add this parameters to GCC for compiling. You can use MakeFile as well:
- gcc XXX.c XXXXX.c -L{OPENSSL_LOCATION} -lcrypto -lssl