static int ENGINE_free_nolock(ENGINE *e);
static STACK_OF(CRYPTO_EX_DATA_FUNCS) *engine_ex_data_stack = NULL;/* The linked-list of pointers to engine types. engine_list_head * incorporates an implicit structural reference but engine_list_tail * does not - the latter is a computational niceity and only points * to something that is already pointed to by its predecessor in the * list (or engine_list_head itself). In the same way, the use of the * "prev" pointer in each ENGINE is to save excessive list iteration, * it doesn't correspond to an extra structural reference. Hence, * engine_list_head, and each non-null "next" pointer account for * the list itself assuming exactly 1 structural reference on each * list member. */static ENGINE *engine_list_head = NULL;static ENGINE *engine_list_tail = NULL;/* A boolean switch, used to ensure we only initialise once. This * is needed because the engine list may genuinely become empty during * use (so we can't use engine_list_head as an indicator for example. */static int engine_list_flag = 0;/* These static functions starting with a lower case "engine_" always * take place when CRYPTO_LOCK_ENGINE has been locked up. */static int engine_list_add(ENGINE *e)	{	int conflict = 0;	ENGINE *iterator = NULL;	if(e == NULL)		{		ENGINEerr(ENGINE_F_ENGINE_LIST_ADD,			ERR_R_PASSED_NULL_PARAMETER);		return 0;		}	iterator = engine_list_head;	while(iterator && !conflict)		{		conflict = (strcmp(iterator->id, e->id) == 0);		iterator = iterator->next;		}	if(conflict)		{		ENGINEerr(ENGINE_F_ENGINE_LIST_ADD,			ENGINE_R_CONFLICTING_ENGINE_ID);		return 0;		}	if(engine_list_head == NULL)		{		/* We are adding to an empty list. */		if(engine_list_tail)			{			ENGINEerr(ENGINE_F_ENGINE_LIST_ADD,				ENGINE_R_INTERNAL_LIST_ERROR);			return 0;			}		engine_list_head = e;		e->prev = NULL;		}	else		{		/* We are adding to the tail of an existing list. */		if((engine_list_tail == NULL) ||				(engine_list_tail->next != NULL))			{			ENGINEerr(ENGINE_F_ENGINE_LIST_ADD,				ENGINE_R_INTERNAL_LIST_ERROR);			return 0;			}		engine_list_tail->next = e;		e->prev = engine_list_tail;		}	/* Having the engine in the list assumes a structural	 * reference. */	e->struct_ref++;	engine_ref_debug(e, 0, 1)	/* However it came to be, e is the last item in the list. */	engine_list_tail = e;	e->next = NULL;	return 1;	}