Config for AES-128 ECB crypto only

Hello,

I am looking for some help or example code that describes minimum set of the files and #defines required to enable AES 128bit encryption and decryption using ECB mode only. The only example I have found in the sdk examples is in '\crypto\nrf_crypto\aes\aes_all_cli' but this pulls in a lot of unwanted code and takes more ram than is available together with my existing code and SoftDevice.

I have written the encrypt and decrypt functions I need based on the code in function nrf_cli_cmd_crypt_ecb() in the above example main.c but cannot find the right combination of #includes and #defines to build the solution.

An example emProject file would be great or even the required entries for include dirs, preprocessor directives, files/folders etc.

Parents
  • Hi,

    You are right that there are a large number of files needed for nrf_crypto. It should not add much overhead in the resulting binary though, as most of what you don't use is removed by the preprocessor. When it comes to RAM usage that depends on both configuration and which crypto backend you use.

    There are a number of other ways to include AES-128 ECB in your application:

    • The obvious which you have tried is to use nrf_crypto, and optimize it's memory usage by for instance not reserving more memory than you need for it (specifically because mbedTLS use heap).
    • Alternatively, use a different crypto library directly. In that case, you can refer to the nrf_crypto implementation for how to use it. If we limit this to what is already available in the SDK and works on nRF528810 the only option for  AES ECB is mbed TLS. You could use that directly, but it would not give you a significant advantage over using nrf_crypto.
    • You could use another AES ECB library of your choice.
    • You could use the AES ECB peripheral, as explained in this post.
Reply
  • Hi,

    You are right that there are a large number of files needed for nrf_crypto. It should not add much overhead in the resulting binary though, as most of what you don't use is removed by the preprocessor. When it comes to RAM usage that depends on both configuration and which crypto backend you use.

    There are a number of other ways to include AES-128 ECB in your application:

    • The obvious which you have tried is to use nrf_crypto, and optimize it's memory usage by for instance not reserving more memory than you need for it (specifically because mbedTLS use heap).
    • Alternatively, use a different crypto library directly. In that case, you can refer to the nrf_crypto implementation for how to use it. If we limit this to what is already available in the SDK and works on nRF528810 the only option for  AES ECB is mbed TLS. You could use that directly, but it would not give you a significant advantage over using nrf_crypto.
    • You could use another AES ECB library of your choice.
    • You could use the AES ECB peripheral, as explained in this post.
Children
No Data
Related