crypto: only try to set FIPS mode if different
Turning FIPS mode on (or off) when it's already on (or off) should be a no-op, not an error.
Fixes: https://github.com/nodejs/node/issues/11849
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
crypto (FIPS)
Patch shamelessly stolen from @bnoordhuis here. PR'd to remind myself to test this properly.