Fixed incorrect ciphertext and hmac length conversion to host byte order