From acab12fbe340f0ca9e7ad171b448444dff12fe88 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Tue, 1 Aug 2000 12:22:14 +0000 Subject: [PATCH] ENGINE_ctrl() had been insisting that the ENGINE supplied was already initialised for use, but one of the useful things about ENGINE_ctrl() is that it can be a useful way to provide settings that should be used during initialisation. Instead, I've altered the code to insist that the engine has a valid *structural* reference (rather than a *functional* one). --- crypto/engine/engine.h | 1 + crypto/engine/engine_err.c | 1 + crypto/engine/engine_lib.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/engine/engine.h b/crypto/engine/engine.h index 6815c4e5ad..adf32e751c 100644 --- a/crypto/engine/engine.h +++ b/crypto/engine/engine.h @@ -381,6 +381,7 @@ void ERR_load_ENGINE_strings(void); #define ENGINE_R_NO_CONTROL_FUNCTION 120 #define ENGINE_R_NO_KEY 124 #define ENGINE_R_NO_LOAD_FUNCTION 125 +#define ENGINE_R_NO_REFERENCE 130 #define ENGINE_R_NO_SUCH_ENGINE 116 #define ENGINE_R_NO_UNLOAD_FUNCTION 126 #define ENGINE_R_PROVIDE_PARAMETERS 113 diff --git a/crypto/engine/engine_err.c b/crypto/engine/engine_err.c index 75ae563bf7..0d7a31f6d5 100644 --- a/crypto/engine/engine_err.c +++ b/crypto/engine/engine_err.c @@ -154,6 +154,7 @@ static ERR_STRING_DATA ENGINE_str_reasons[]= {ENGINE_R_NO_CONTROL_FUNCTION ,"no control function"}, {ENGINE_R_NO_KEY ,"no key"}, {ENGINE_R_NO_LOAD_FUNCTION ,"no load function"}, +{ENGINE_R_NO_REFERENCE ,"no reference"}, {ENGINE_R_NO_SUCH_ENGINE ,"no such engine"}, {ENGINE_R_NO_UNLOAD_FUNCTION ,"no unload function"}, {ENGINE_R_PROVIDE_PARAMETERS ,"provide parameters"}, diff --git a/crypto/engine/engine_lib.c b/crypto/engine/engine_lib.c index 354f73a03f..1df07af03a 100644 --- a/crypto/engine/engine_lib.c +++ b/crypto/engine/engine_lib.c @@ -296,9 +296,9 @@ int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) return 0; } CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); - if(e->funct_ref == 0) + if(e->struct_ref == 0) { - ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NOT_INITIALISED); + ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_REFERENCE); return 0; } if (!e->ctrl) -- 2.25.1