Reputation: 504
I'm using openssl library in my C++ app. I've found out how to ignore an OPENSSL_CONF
environment variable. It's possible by specifying of my own config file:
OPENSSL_config("openssl.cnf");
But what about an OPENSSL_ENGINES
environment variable? How can it's value be ignored in my app? How to prevent loading the engines from this path?
I've a look at openssl sources. There is the OPENSSL_ENGINES
variable reads by default without any conditions.
...
if ((load_dir = getenv("OPENSSL_ENGINES")) == 0)
load_dir = ENGINESDIR;
...
Upvotes: 1
Views: 1072
Reputation: 17383
OpenSSL does not seem to expose a proper way to ignore that environment variable. As a workaround, you could set that environment variable yourself to some bogus value before invoking ENGINE_by_id()
, like this:
putenv("OPENSSL_ENGINES=/dev/null");
You will have to be a little careful that the bogus value you choose does not happen to exist as a valid path on the file system. /dev/null
could be an option, depending on your environment.
Upvotes: 1