summaryrefslogtreecommitdiffstats
path: root/crypto/engine/eng_dyn.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2002-10-18 20:45:38 +0000
committerGeoff Thorpe <geoff@openssl.org>2002-10-18 20:45:38 +0000
commit0587ec264563249bbc26302aa1d5e9ff5f45d7f0 (patch)
tree3ea67ff3570335fbbbc848aa06c6da151bc7db78 /crypto/engine/eng_dyn.c
parentb76d66fbf6f060e464bde86d078b8925a04e3062 (diff)
If dynamically-loadable ENGINEs are linked against a shared-library version
of libcrypto, then it is possible that when they are loaded they will share the same static data as the loading application/library. This means it will be too late to set memory/ERR/ex_data/[etc] callbacks, but entirely unnecessary to try. This change puts a static variable in the core ENGINE code (contained in libcrypto) and a function returning a pointer to it. If the loaded ENGINE's return value from this function matches the loading application/library's return value - they share static data. If they don't match, the loaded ENGINE has its own copy of libcrypto's static data and so the callbacks need to be set. Also, although 0.9.7 hasn't been released yet, it's clear this will introduce a binary incompatibility between dynamic ENGINEs built for 0.9.7 and 0.9.8 (though others probably exist already from EC_*** hooks and what-not) - so the version control values are correspondingly bumped.
Diffstat (limited to 'crypto/engine/eng_dyn.c')
-rw-r--r--crypto/engine/eng_dyn.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c
index 5803c0123a..61ae230570 100644
--- a/crypto/engine/eng_dyn.c
+++ b/crypto/engine/eng_dyn.c
@@ -500,6 +500,7 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
* engine.h, much of this would be simplified if each area of code
* provided its own "summary" structure of all related callbacks. It
* would also increase opaqueness. */
+ fns.static_state = ENGINE_get_static_state();
fns.err_fns = ERR_get_implementation();
fns.ex_data_fns = CRYPTO_get_ex_data_implementation();
CRYPTO_get_mem_functions(&fns.mem_fns.malloc_cb,