Hello,
I am developing a driver that can handle cryptographic operations and I am using example code from nRF5_SDK_16.0.0_98a08e2/examples/crypto/nrf_cc310/aes to get started with encryption using AES-CCM. While developing my driver, I came across a strange phenomenon where when calling CRYS_AESCCM(), some of my input buffers are being overwritten to zero after the function executes. Additionally, the first 4 bytes of my output buffer (i.e. the ciphertext buffer) are being set to zero but the remaining bytes of the buffer are set to the correct expected output. Note that the CRYS_AESCCM() call returns no errors.
I am using IAR 8.40.2 and the CC310 Crypto library I'm using is located at nRF5_SDK_16.0.0_98a08e2/external/nrf_cc310/lib/cortex-m4/hard-float/libnrf_cc310_0.9.12.a. I first thought that there was something wrong with my project settings, so I switched to the example aes project and noticed that I get similar results when I reduce the size of the nonce buffer to 16 bytes (inside of aes_ccm_tests() of main.c), though only 7 bytes should be needed because the test vector nonce being used is only 7 bytes long. I found that if the nonce buffer size is 16 bytes or less, it gets overwritten to all zeros after calling CRYS_AESCCM(). However, if the nonce buffer is 17 bytes or more, the buffer remains intact after calling CRYS_AESCCM(). So in summary, I have two questions:
- Are there some minimum buffer size requirements that I need to keep in mind when calling CRYS_AESCCM?
- If I am using the S140 soft device to run BLE functionality, is it ok if i make calls to the Cryptocell310 module?
Thanks,
Keron