I'm about to setup a backup using an LTO-4 Drive. I know that drives are meant to be compatible to any tape within the past 3 generations (so I should be able to read an LTO-4 tape using an LTO-4, 5 or 6 drive).
I wonder if this also applies to hardware compression and hardware encryption?
Is it safe in practice to rely on the ability of any LTO-4/5/6 drive to read my backup tapes?
Both compression and encryption are parts of the LTO standard. This means that a compressed and encrypted LTO-4 tape should be read by a LTO-6 drive.
That said, as the hardware encryption key can be managed by the backup system itself, I think that occasional compatibility problem can arise, at least in theory. On the other side, for compression I don't expect anything to go wrong.
The answer that the LTO consortium want you to read is Yes, but unfortunately it isn't that simple.
Both major OEMs (IBM and HP) do follow published standards IEEE 1619.1 (see also) (encryption) and ISO/IEC 22091:2002 / ECMA-321 (compression). However there are some slight differences in areas that are not covered by the standard, for example: IV generation differs between drives, IBM disregards raw data protection flags, and IBM has a different (and better) SLDC compression algorithm. You can find more detail here: https://darkimmortal.com/the-secrets-of-lto-tape/
Returning to the spirit of the original question, one key issue I have found is that IBM LTO-4 drives cannot read encrypted LTO-4 tapes written by HP LTO-4 drives (drive immediately crashes on read and has to be restarted). I've tried enough combinations of firmwares, settings, tapes and data that I am as certain as one can be with 2 drives that this is a wider issue. I doubt this issue exists in later generations or it would be more widely reported, but it highlights the fact that the LTO standard isn't as bulletproof as the marketing would suggest. I have written a program to workaround this issue in software: https://github.com/lukefor/ltoex
Additionally, IBM SLDC compression does not appear to follow spec. Although I have not seen any issues with HP drives' ability to read this data, I was not able to decompress it successfully in software by following the standard.