ENGINE_INIT(3)

NAME
ENGINE_init, ENGINE_finish, ENGINE_set_init_function, ENGINE_set_finish_function, ENGINE_get_init_function, ENGINE_get_finish_function - initialize ENGINE objects

SYNOPSIS
#include <openssl/engine.h>
int
ENGINE_init(ENGINE *e);
int
ENGINE_finish(ENGINE *e);
typedef int
(*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *e);
int
ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
int
ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
ENGINE_GEN_INT_FUNC_PTR
ENGINE_get_init_function(const ENGINE *e);
ENGINE_GEN_INT_FUNC_PTR
ENGINE_get_finish_function(const ENGINE *e);

DESCRIPTION
ENGINE_init() initializes e by calling the init_f previously installed with ENGINE_set_init_function(), if any. In case of success, it also increments both the structural and the functional reference count by 1. If no init_f was installed, ENGINE_init() always succeeds. Calling ENGINE_init() again after it already succeeded always succeeds, but has no effect except that it increments both the structural and the functional reference count by 1.

ENGINE_finish() decrements the functional reference count by 1. When it reaches 0, it calls the finish_f previously installed with ENGINE_set_finish_function(), if any. If no finish_f was installed, ENGINE_finish() always succeeds. Unless finish_f fails, ENGINE_finish() also calls ENGINE_free(3).

ENGINE_init() is internally called by the functions documented in the ENGINE_get_default_RSA(3) manual page.

RETURN VALUES
ENGINE_init() and ENGINE_finish() return 1 on success or 0 on error.

ENGINE_set_init_function() and ENGINE_set_finish_function() always return 1.

ENGINE_get_init_function() and ENGINE_get_finish_function() return a function pointer to the respective callback, or NULL if none is installed.

SEE ALSO
ENGINE_add(3), ENGINE_ctrl(3), ENGINE_get_default_RSA(3), ENGINE_new(3), ENGINE_register_RSA(3), ENGINE_set_default(3), ENGINE_set_flags(3), ENGINE_set_RSA(3), ENGINE_unregister_RSA(3)

HISTORY
These functions first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 2.9.