ENGINE(3)

NAME
ENGINE_set_default, ENGINE_set_default_string, ENGINE_set_default_RSA, ENGINE_set_default_DSA, ENGINE_set_default_ECDH, ENGINE_set_default_ECDSA, ENGINE_set_default_DH, ENGINE_set_default_RAND, ENGINE_set_default_ciphers, ENGINE_set_default_digests - register an ENGINE as the default for an algorithm

SYNOPSIS
#include <openssl/engine.h>
int
ENGINE_set_default_RSA(ENGINE *e);
int
ENGINE_set_default_DSA(ENGINE *e);
int
ENGINE_set_default_ECDH(ENGINE *e);
int
ENGINE_set_default_ECDSA(ENGINE *e);
int
ENGINE_set_default_DH(ENGINE *e);
int
ENGINE_set_default_RAND(ENGINE *e);
int
ENGINE_set_default_ciphers(ENGINE *e);
int
ENGINE_set_default_digests(ENGINE *e);
int
ENGINE_set_default(ENGINE *e, unsigned int flags);
int
ENGINE_set_default_string(ENGINE *e, const char *list);

DESCRIPTION
These functions register e as implementing the respective algorithm like the functions described in the ENGINE_register_RSA(3) manual page do it. In addition, they call ENGINE_init(3) on e and select e as the default implementation of the respective algorithm to be returned by the functions described in ENGINE_get_default_RSA(3) in the future. If another engine was previously selected as the default implementation of the respective algorithm, ENGINE_finish(3) is called on that previous engine.

If e implements more than one cipher or digest, ENGINE_set_default_ciphers() and ENGINE_set_default_digests() register and select it for all these ciphers and digests, respectively.

ENGINE_set_default() registers e as the default implementation of all algorithms specified by the flags by calling the appropriate ones among the other functions. Algorithms can be selected by combining any number of the following constants with bitwise OR: ENGINE_METHOD_ALL, ENGINE_METHOD_RSA, ENGINE_METHOD_DSA, ENGINE_METHOD_ECDH, ENGINE_METHOD_ECDSA, ENGINE_METHOD_DH, ENGINE_METHOD_RAND, ENGINE_METHOD_CIPHERS, ENGINE_METHOD_DIGESTS, ENGINE_METHOD_PKEY_METHS, and ENGINE_METHOD_PKEY_ASN1_METHS.

ENGINE_set_default_string() is similar except that it selects the algorithms according to the string def_list, which contains an arbitrary number of comma-separated keywords from the following list: ALL, RSA, DSA, ECDH, ECDSA, DH, RAND, CIPHERS, DIGESTS, PKEY_CRYPTO, PKEY_ASN1, and PKEY. PKEY_CRYPTO corresponds to ENGINE_METHOD_PKEY_METHS, PKEY_ASN1 to ENGINE_METHOD_PKEY_ASN1_METHS, and PKEY selects both.

RETURN VALUES
These functions return 1 on success or 0 on error. They fail if ENGINE_init(3) fails or if insufficient memory is available.

SEE ALSO
ENGINE_get_default_RSA(3), ENGINE_init(3), ENGINE_new(3), ENGINE_register_RSA(3), ENGINE_set_RSA(3), ENGINE_unregister_RSA(3)

HISTORY
ENGINE_set_default(), ENGINE_set_default_RSA(), ENGINE_set_default_DSA(), ENGINE_set_default_DH(), and ENGINE_set_default_RAND() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 2.9.

ENGINE_set_default_string(), ENGINE_set_default_ciphers(), and ENGINE_set_default_digests() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

ENGINE_set_default_ECDH() and ENGINE_set_default_ECDSA() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.

CAVEATS
Failure of ENGINE_finish(3) is ignored.

BUGS
Even when ENGINE_set_default() or ENGINE_set_default_string() fail, they typically still register e for some algorithms, but usually not for all it could be registered for by calling the individual functions.