I am using my nRF52833 chip to send 20 bytes beacons frequently.
I want to encrypt the initial 16bits of my data using AES128.
What is the library to use for this purpose? How to include the initialization vector and encryption key?
Thanks
I am using my nRF52833 chip to send 20 bytes beacons frequently.
I want to encrypt the initial 16bits of my data using AES128.
What is the library to use for this purpose? How to include the initialization vector and encryption key?
Thanks
There already seems to be some examples in SDK for AES encryption under examples\crypto\nrf_crypto\aes
What is the difference between these examples aes_all_cli, aes_cbc_mac, aes_cbc_with_padding, aes_ccm, aes_ctr.
They all use the AES cipher; the difference is in what mode of operation they support. I think this wiki article explains the differences pretty well: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
SDK documentation: AES Example
They all use the AES cipher; the difference is in what mode of operation they support. I think this wiki article explains the differences pretty well: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation
SDK documentation: AES Example
Thanks Vidar. I am going to use aes_cbc_mac library and encrypt my beacon.
How much is the expected added power consumption and delay to my code because of this AES128 encryption of beacon data?
The impact of encryption on your average current consumption will depend on how long it takes to encrypt the payload and how frequently you update the data. I don't think there will be a very noticeable difference, but this is something you have to verify with your application.
Thanks Vidar. I do encryption of first 16bytes of data in my beacon every 10 sec and send the beacon.
I read somewhere that the encryption speed on a computer CPU typically is in order of Gb per sec. What is the clock frequency of internal CPU in nRF52833 so that I can scale this number. I use external crystal at 32.7k Hz on XL1 and XL2 pins.
The CPU frequency is 64 MHz, but the processing speed does not scale linearly with that. Desktop CPUs have different instruction sets, and most, if not all, come with HW accelerated AES support - similar to how we have dedicated AES peripherals encrypting Bluetooth connections on our chips. The processing time will also depend on how optimized the AES library is.
The most accurate way to determine the additional power usage in your case is to actually measure it on the device with a Power Profiler Kit II or similar tool. Alternatively, you can time the AES execution time with a TIMER or the CPU cycle counter and multiply that by the typical CPU current.