/* Encrypts the len-bytes in the specified data-array, using the specified 256-bit (32 bytes) key. The results are written back into the same array.  */
bool UtilCryptoAes256Encrypt(uint8_t *data, uint32_t len, uint8_t const *key)
/* Encrypts the len-bytes in the specified data-array, using the specified 256-bit (32 bytes) key. The results are written back into the same array.  */
bool UtilCryptoAes256Encrypt(uint8_t *data, uint32_t len, uint8_t const *key)
{
  bool result = false;
  aes256_context ctx;
  assert(data != NULL);
  assert(key != NULL);
  if ( (data != NULL) && (key != NULL) && ((len % 16u) == 0) )
  {
    aes256_init(&ctx, key);
    for (uint32_t i = 0; i < (len / 16u); i++)
    {
      aes256_encrypt_ecb(&ctx, &data[i * 16u]);
    }
    aes256_done(&ctx);
    result = true;
  }
  return result;
}