Commit acab12fb authored by Geoff Thorpe's avatar Geoff Thorpe
Browse files

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).
parent 1ba5b1b5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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"},
+2 −2
Original line number Diff line number Diff line
@@ -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)