Hi,
I ran some tests with the SW and HW crypto on nrf5340dk. I expected that using the crypto cell would improve my crypto performance tremendously but unfortunately, it did not.
I ran some unit tests and they are better in HW on average but some are worse in HW than they are in SW and those are the ones that I need for my dev.
I'm attaching the sample code I'm using for my tests but here is the essence:
Using the SW encryption, I get a pretty similar performance over the encryption and decryption (west build -p -b nrf5340dk_nrf5340_cpuapp --build-dir build/crypto.sw test_crypto -DOVERLAY_CONFIG=crypto_sw.conf)
Now, using the HW encryption (west build -p -b nrf5340dk_nrf5340_cpuapp --build-dir build/crypto.hw test_crypto -DOVERLAY_CONFIG=crypto_hw.conf), I get very different performance and even worse for some vectors than the SW implementation.
Could you please advise if I did something wrong? Or help me getting this better.
SW crypto output:
===================================================================
Test suite crypto_tests succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL
Running test suite crypto_tests
===================================================================
START - test_ccm_star_encrypt_vectors
I: test_ccm_star_encrypt_vectors: test 0 duration 17535 cycles
I: test_ccm_star_encrypt_vectors: test 1 duration 175 cycles
I: test_ccm_star_encrypt_vectors: test 2 duration 143 cycles
I: test_ccm_star_encrypt_vectors: test 3 duration 161 cycles
PASS - test_ccm_star_encrypt_vectors in 0.23 seconds
===================================================================
START - test_ccm_star_decrypt_vectors
I: test_ccm_star_decrypt_vectors: test 0 duration 239 cycles
I: test_ccm_star_decrypt_vectors: test 1 duration 17308 cycles
I: test_ccm_star_decrypt_vectors: test 2 duration 197 cycles
I: test_ccm_star_decrypt_vectors: test 3 duration 280 cycles
PASS - test_ccm_star_decrypt_vectors in 0.23 seconds
===================================================================
Test suite crypto_tests succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL