/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness  */
static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1])
/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness  */
static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1])
{   unsigned long i = 0, pos = cx->encr_pos;
    while(i < d_len)
    {
        if(pos == AES_BLOCK_SIZE)
        {   unsigned int j = 0;
            while(j < 8 && !++cx->nonce[j])
                ++j;
            aes_encrypt(cx->nonce, cx->encr_bfr, cx->encr_ctx);
            pos = 0;
        }
        data[i++] ^= cx->encr_bfr[pos++];
    }
    cx->encr_pos = pos;
}