To improve this part, maybe I'll add the next:
uint8_t cipherStreamAvailable = 16 - ctx->cipherstreamUsed;

// Dont allow to xor more bytes than available bytes
if( thisLoop > cipherStreamAvailable)
{
     thisLoop = cipherStreamAvailable;
}

What do you think ? I think this way the code is more readable and easier to understand.