Call ENGINE_add to prevent ENGINEs from unloading

The only user of the OpenSSLEngine interface is a dynamic engine (loaded
from eng_dyn.c), so it will unload the .so when references to it
decrease to zero.

Calling ENGINE_add will add the loaded engine to the list of loaded
engines. The next time ENGINE_by_id is called, it will just use the one
from the list instead of loading the .so again.

You can still control whether the engine is ref-counted or copied with
ENGINE_set_flags(ret, ENGINE_FLAGS_BY_ID_COPY) in the engine
initialization method.

Change-Id: Ic005e9ea22a3c6027e3a5aab2adf41fb7995c1f0
3 files changed