crypto: fix behavior of createCipher in wrap mode
The old implementation silently failed in EVP_CipherInit_ex
in EVP_CIPH_WRAP_MODE
with EVP_R_WRAP_MODE_NOT_ALLOWED
, this commit should fix that by moving the flag to the earliest possible moment.
I am pinging @shigeki who originally authored this in https://github.com/nodejs/node/pull/15037 just in case I missed something and this behavior was intentional.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines