ENGINE_ctrl() had been insisting that the ENGINE supplied was already
authorGeoff Thorpe <geoff@openssl.org>
Tue, 1 Aug 2000 12:22:14 +0000 (12:22 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Tue, 1 Aug 2000 12:22:14 +0000 (12:22 +0000)
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
crypto/engine/engine_err.c
crypto/engine/engine_lib.c

index 6815c4e5ad85899c88d8da1b2c5d3f4ba5f8f5f7..adf32e751c0fb94806e1c6f2b78debb230202a15 100644 (file)
@@ -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
index 75ae563bf7e1c370f4129f23860af64ca260c92a..0d7a31f6d517388b373c532a9ac29e328404b695 100644 (file)
@@ -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"},
index 354f73a03f6a96ab8c065b54d4ee010f0d54833f..1df07af03a68c1e17bcc7583349e06d67382462a 100644 (file)
@@ -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)