How to use AES128 ECB for decryption


I am using nRF51822, and try to use the ECB block AES128 to do some data decryption. From the SDK I found 2 API functions:

  1. uint32_t sd_ecb_block_encrypt ( nrf_ecb_hal_data_t * p_ecb_data ) Seems this one is only usable for encrypt, can you provide or have a similar one for decrypt?

  2. bool nrf_ecb_crypt ( uint8_t * dst, const uint8_t * src ) This one seems can be used for both encrypt and decrypt, but I am not sure how to specify whether I need to decrypt or encrypt and also how to specify the key correctly, if you have any code snippets or examples that will be really helpful.

Another question is about the data block size, seems it is fixed at 16 bytes now, can I specify a different size or need to cut into 16 byte block in my applicaiton code?