/* Performs AES encryption/decryption of one data block. 
This function encrypts/decrypts one block of data with specified size. */
static status_t hashcrypt_aes_one_block_aligned(HASHCRYPT_Type *base, const uint8_t *input, uint8_t *output, size_t size)
/* Performs AES encryption/decryption of one data block. 
This function encrypts/decrypts one block of data with specified size. */
static status_t hashcrypt_aes_one_block_aligned(HASHCRYPT_Type *base, const uint8_t *input, uint8_t *output, size_t size)
{
    status_t status = kStatus_Fail;
    uint32_t idx    = 0;
    base->MEMADDR = HASHCRYPT_MEMADDR_BASE(input);
    base->MEMCTRL = HASHCRYPT_MEMCTRL_MASTER(1) | HASHCRYPT_MEMCTRL_COUNT(size / 16U);
    while (size >= HASHCRYPT_AES_BLOCK_SIZE)
    {
        while (0U == (base->STATUS & HASHCRYPT_STATUS_DIGEST_MASK))
        {
        }
        for (int i = 0; i < 4; i++)
        {
            ((uint32_t *)(uintptr_t)output + idx)[i] = swap_bytes(base->DIGEST0[i]);
        }
        idx += HASHCRYPT_AES_BLOCK_SIZE / 4U;
        size -= HASHCRYPT_AES_BLOCK_SIZE;
    }
    if (0U == (base->STATUS & HASHCRYPT_STATUS_ERROR_MASK))
    {
        status = kStatus_Success;
    }
    return status;
}