After loading a dynamic engine, reset the command definitions to the
authorRichard Levitte <levitte@openssl.org>
Wed, 14 Nov 2001 22:32:19 +0000 (22:32 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 14 Nov 2001 22:32:19 +0000 (22:32 +0000)
empty set.  This prevents engines that do not set the command
definitions themselves to inherit the ones from "dynamic", which would
otherwise be very confusing.

crypto/engine/eng_dyn.c

index 8fd70786783fcb754433f229d2babb3a1f109b54..bac5e712022ca0f31400d9034b519a6bd32e4570 100644 (file)
@@ -108,6 +108,9 @@ static const ENGINE_CMD_DEFN dynamic_cmd_defns[] = {
                ENGINE_CMD_FLAG_NO_INPUT},
        {0, NULL, NULL, 0}
        };
                ENGINE_CMD_FLAG_NO_INPUT},
        {0, NULL, NULL, 0}
        };
+static const ENGINE_CMD_DEFN dynamic_cmd_defns_empty[] = {
+       {0, NULL, NULL, 0}
+       };
 
 /* Loading code stores state inside the ENGINE structure via the "ex_data"
  * element. We load all our state into a single structure and use that as a
 
 /* Loading code stores state inside the ENGINE structure via the "ex_data"
  * element. We load all our state into a single structure and use that as a
@@ -402,6 +405,10 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
        fns.lock_fns.dynlock_create_cb = CRYPTO_get_dynlock_create_callback();
        fns.lock_fns.dynlock_lock_cb = CRYPTO_get_dynlock_lock_callback();
        fns.lock_fns.dynlock_destroy_cb = CRYPTO_get_dynlock_destroy_callback();
        fns.lock_fns.dynlock_create_cb = CRYPTO_get_dynlock_create_callback();
        fns.lock_fns.dynlock_lock_cb = CRYPTO_get_dynlock_lock_callback();
        fns.lock_fns.dynlock_destroy_cb = CRYPTO_get_dynlock_destroy_callback();
+       /* Now that we've loaded the dynamic engine, initialise the command
+          array to contain none */
+       ENGINE_set_cmd_defns(e, dynamic_cmd_defns_empty);
+
        /* Try to bind the ENGINE onto our own ENGINE structure */
        if(!ctx->bind_engine(e, ctx->engine_id, &fns))
                {
        /* Try to bind the ENGINE onto our own ENGINE structure */
        if(!ctx->bind_engine(e, ctx->engine_id, &fns))
                {