ENGINE_ADD(3SSL)

πŸ’… NAME πŸ’…

okay so bestie, welcome to ENGINE_ADD, a page from the OpenSSL manual β€” and no, it is not about adding an engine to your car, we're in the ENGINE cryptographic module support section now πŸš—βœ¨

This one page covers a whole entire squad of functions (it's giving main character energy fr fr). Here's the full roster, no cap, nobody left out:

ENGINE_get_DH, ENGINE_get_DSA, ENGINE_by_id, ENGINE_get_cipher_engine,
ENGINE_get_default_DH, ENGINE_get_default_DSA, ENGINE_get_default_RAND,
ENGINE_get_default_RSA, ENGINE_get_digest_engine, ENGINE_get_first,
ENGINE_get_last, ENGINE_get_next, ENGINE_get_prev, ENGINE_new,
ENGINE_get_ciphers, ENGINE_get_ctrl_function, ENGINE_get_digests,
ENGINE_get_destroy_function, ENGINE_get_finish_function,
ENGINE_get_init_function, ENGINE_get_load_privkey_function,
ENGINE_get_load_pubkey_function, ENGINE_load_private_key,
ENGINE_load_public_key, ENGINE_get_RAND, ENGINE_get_RSA, ENGINE_get_id,
ENGINE_get_name, ENGINE_get_cmd_defns, ENGINE_get_cipher,
ENGINE_get_digest, ENGINE_add, ENGINE_cmd_is_executable, ENGINE_ctrl,
ENGINE_ctrl_cmd, ENGINE_ctrl_cmd_string, ENGINE_finish, ENGINE_free,
ENGINE_get_flags, ENGINE_init, ENGINE_register_DH, ENGINE_register_DSA,
ENGINE_register_RAND, ENGINE_register_RSA, ENGINE_register_all_complete,
ENGINE_register_ciphers, ENGINE_register_complete,
ENGINE_register_digests, ENGINE_remove, ENGINE_set_DH, ENGINE_set_DSA,
ENGINE_set_RAND, ENGINE_set_RSA, ENGINE_set_ciphers,
ENGINE_set_cmd_defns, ENGINE_set_ctrl_function, ENGINE_set_default,
ENGINE_set_default_DH, ENGINE_set_default_DSA, ENGINE_set_default_RAND,
ENGINE_set_default_RSA, ENGINE_set_default_ciphers,
ENGINE_set_default_digests, ENGINE_set_default_string,
ENGINE_set_destroy_function, ENGINE_set_digests,
ENGINE_set_finish_function, ENGINE_set_flags, ENGINE_set_id,
ENGINE_set_init_function, ENGINE_set_load_privkey_function,
ENGINE_set_load_pubkey_function, ENGINE_set_name, ENGINE_up_ref,
ENGINE_get_table_flags, ENGINE_cleanup, ENGINE_load_builtin_engines,
ENGINE_register_all_DH, ENGINE_register_all_DSA,
ENGINE_register_all_RAND, ENGINE_register_all_RSA,
ENGINE_register_all_ciphers, ENGINE_register_all_digests,
ENGINE_set_table_flags, ENGINE_unregister_DH, ENGINE_unregister_DSA,
ENGINE_unregister_RAND, ENGINE_unregister_RSA,
ENGINE_unregister_ciphers, ENGINE_get_ex_new_index, ENGINE_set_ex_data,
ENGINE_get_ex_data, ENGINE_unregister_digests, ENGINE_add_conf_module
  • ENGINE cryptographic module support β€” that's the whole vibe of this page 🫢

✨ SYNOPSIS ✨

First things first, include the header bestie:

#include <openssl/engine.h>
⚠️ real talk: the following functions have been removed in OpenSSL 4.0. The Provider API should be used instead. ok that's the tea β˜•
ENGINE *ENGINE_get_first(void);
ENGINE *ENGINE_get_last(void);
ENGINE *ENGINE_get_next(ENGINE *e);
ENGINE *ENGINE_get_prev(ENGINE *e);

int ENGINE_add(ENGINE *e);
int ENGINE_remove(ENGINE *e);

ENGINE *ENGINE_by_id(const char *id);

int ENGINE_init(ENGINE *e);
int ENGINE_finish(ENGINE *e);

void ENGINE_load_builtin_engines(void);

ENGINE *ENGINE_get_default_RSA(void);
ENGINE *ENGINE_get_default_DSA(void);
ENGINE *ENGINE_get_default_DH(void);
ENGINE *ENGINE_get_default_RAND(void);
ENGINE *ENGINE_get_cipher_engine(int nid);
ENGINE *ENGINE_get_digest_engine(int nid);

int ENGINE_set_default_RSA(ENGINE *e);
int ENGINE_set_default_DSA(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_string(ENGINE *e, const char *list);

int ENGINE_set_default(ENGINE *e, unsigned int flags);

unsigned int ENGINE_get_table_flags(void);
void ENGINE_set_table_flags(unsigned int flags);

int ENGINE_register_RSA(ENGINE *e);
void ENGINE_unregister_RSA(ENGINE *e);
void ENGINE_register_all_RSA(void);
int ENGINE_register_DSA(ENGINE *e);
void ENGINE_unregister_DSA(ENGINE *e);
void ENGINE_register_all_DSA(void);
int ENGINE_register_DH(ENGINE *e);
void ENGINE_unregister_DH(ENGINE *e);
void ENGINE_register_all_DH(void);
int ENGINE_register_RAND(ENGINE *e);
void ENGINE_unregister_RAND(ENGINE *e);
void ENGINE_register_all_RAND(void);
int ENGINE_register_ciphers(ENGINE *e);
void ENGINE_unregister_ciphers(ENGINE *e);
void ENGINE_register_all_ciphers(void);
int ENGINE_register_digests(ENGINE *e);
void ENGINE_unregister_digests(ENGINE *e);
void ENGINE_register_all_digests(void);
int ENGINE_register_complete(ENGINE *e);
int ENGINE_register_all_complete(void);

int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
                    long i, void *p, void (*f)(void), int cmd_optional);
int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
                           int cmd_optional);

ENGINE *ENGINE_new(void);
int ENGINE_free(ENGINE *e);
int ENGINE_up_ref(ENGINE *e);

int ENGINE_set_id(ENGINE *e, const char *id);
int ENGINE_set_name(ENGINE *e, const char *name);
int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
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);
int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
int ENGINE_set_flags(ENGINE *e, int flags);
int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);

const char *ENGINE_get_id(const ENGINE *e);
const char *ENGINE_get_name(const ENGINE *e);
const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
int ENGINE_get_flags(const ENGINE *e);
const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);

EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
                                  UI_METHOD *ui_method, void *callback_data);
EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
                                 UI_METHOD *ui_method, void *callback_data);
void ENGINE_cleanup(void);
void ENGINE_add_conf_module(void);
int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
                            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int ENGINE_set_ex_data(ENGINE *type, int idx, void *arg);
void *ENGINE_get_ex_data(ENGINE *type, int idx);

🌸 DESCRIPTION 🌸

ok so here's the situation and I need you to sit down for it 🫢

All of these functions were removed since OpenSSL 4.0. Every. Single. One. The whole squad. gone. iconic but also a little tragic 😭

But like… if you still need these definitions to exist (even though, and I cannot stress this enough, support for engines is absent), you can define the OPENSSL_ENGINE_STUB macro to get stub definitions of the aforementioned functions. The key detail: you define it before the inclusion of the "openssl/engine.h" header. Before, bestie. Before. Not after. Timing is everything πŸ’…


πŸ¦‹ ENVIRONMENT πŸ¦‹

  • OPENSSL_ENGINES β€” yeah so this environment variable was removed in OpenSSL 4.0. rip to a real one πŸ•ŠοΈ

✨ RETURN VALUES ✨

When the OPENSSL_ENGINE_STUB macro is defined, these functions will always fail β€” and depending on the nature of the function, they'll return either NULL or 0. That's it. That's the whole return value situation. No surprises, no plot twists πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘


🌈 HISTORY 🌈

ok the lore, in order, because the timeline matters:

  1. All of these functions were deprecated in OpenSSL 3.0.
  2. ENGINE_cleanup() was deprecated in OpenSSL 1.1.0 by the automatic cleanup done by OPENSSL_cleanup() β€” and it should not be used. like, genuinely, don't πŸ™ˆ
  3. All of these functions were removed in OpenSSL 4.0.

Copyright 2002-2025 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.


and that's the page bestie, ily, go use the Provider API instead πŸŽ€βœ¨

β€” OpenSSL 4.0.3, dated 2026-09-29 πŸ¦‹πŸ’–

πŸ“¦ where this page comes from