I think it's not "whenever" but it's only limited to openssl algorithms, you should not get that error with 'encryption xor "test"', right?
I suspect it's some sort of lack of compatibility of EVP_CipherInit with openssl 1.1 but I don't know why that happens because if it works with 1.0 it must work with 1.1 too:
The functions EVP_EncryptInit(), EVP_EncryptFinal(), EVP_DecryptInit(), EVP_CipherInit() and EVP_CipherFinal() are obsolete but are retained for compatibility with existing code.
Maybe it's related to how evp_ctx is initialized since I maintained the old code (that has ever worked) and made it compatible with 1.1, but I don't think.
That error is the final step of setting the encryption when key and ivec are assigned
Currently I have no solution.
Do you have the same error if you set an empty ivec like "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"?