X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=include%2Fopenssl%2Fengine.h;h=d1cd17a24c59f5084197af186b543c4ab92d41c2;hp=300ff26b084c70fea3a41b364ff4f11075a8f922;hb=be1251f73def8169b98d53430b631df13d430dbc;hpb=98186eb4e4aef6262ed6b0f499348defa2c26893 diff --git a/include/openssl/engine.h b/include/openssl/engine.h index 300ff26b08..d1cd17a24c 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -1,4 +1,3 @@ -/* openssl/engine.h */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. @@ -109,7 +108,6 @@ extern "C" { # define ENGINE_METHOD_RAND (unsigned int)0x0008 # define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 # define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 -# define ENGINE_METHOD_STORE (unsigned int)0x0100 # define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 # define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 # define ENGINE_METHOD_EC (unsigned int)0x0800 @@ -387,27 +385,27 @@ int ENGINE_add(ENGINE *e); int ENGINE_remove(ENGINE *e); /* Retrieve an engine from the list by its unique "id" value. */ ENGINE *ENGINE_by_id(const char *id); -/* Add all the built-in engines. */ -void ENGINE_load_openssl(void); -void ENGINE_load_dynamic(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ENGINE_load_openssl() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +# define ENGINE_load_dynamic() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) # ifndef OPENSSL_NO_STATIC_ENGINE -void ENGINE_load_4758cca(void); -void ENGINE_load_aep(void); -void ENGINE_load_atalla(void); -void ENGINE_load_chil(void); -void ENGINE_load_cswift(void); -void ENGINE_load_nuron(void); -void ENGINE_load_sureware(void); -void ENGINE_load_ubsec(void); -void ENGINE_load_padlock(void); -void ENGINE_load_capi(void); -# ifndef OPENSSL_NO_GOST -void ENGINE_load_gost(void); -# endif -void ENGINE_load_dasync(void); +# define ENGINE_load_padlock() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +# define ENGINE_load_capi() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) +# define ENGINE_load_dasync() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DASYNC, NULL) +# define ENGINE_load_afalg() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) # endif -void ENGINE_load_cryptodev(void); -void ENGINE_load_rdrand(void); +# define ENGINE_load_cryptodev() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +# define ENGINE_load_rdrand() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) +#endif void ENGINE_load_builtin_engines(void); /* @@ -446,10 +444,6 @@ int ENGINE_register_RAND(ENGINE *e); void ENGINE_unregister_RAND(ENGINE *e); void ENGINE_register_all_RAND(void); -int ENGINE_register_STORE(ENGINE *e); -void ENGINE_unregister_STORE(ENGINE *e); -void ENGINE_register_all_STORE(void); - int ENGINE_register_ciphers(ENGINE *e); void ENGINE_unregister_ciphers(ENGINE *e); void ENGINE_register_all_ciphers(void); @@ -547,7 +541,6 @@ int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_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_STORE(ENGINE *e, const STORE_METHOD *store_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); @@ -591,7 +584,6 @@ const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); -const STORE_METHOD *ENGINE_get_STORE(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); @@ -715,12 +707,12 @@ void ENGINE_add_conf_module(void); /**************************/ /* Binary/behaviour compatibility levels */ -# define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 +# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 /* * Binary versions older than this are too old for us (whether we're a loader * or a loadee) */ -# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 +# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 /* * When compiling an ENGINE entirely as an external shared library, loadable @@ -733,29 +725,22 @@ void ENGINE_add_conf_module(void); * same static data as the calling application (or library), and thus whether * these callbacks need to be set or not. */ +typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); +typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); +typedef void (*dyn_MEM_free_fn) (void *, const char *, int); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_fn malloc_fn; + dyn_MEM_realloc_fn realloc_fn; + dyn_MEM_free_fn free_fn; +} dynamic_MEM_fns; /* * FIXME: Perhaps the memory and locking code (crypto.h) should declare and * use these types so we (and any other dependant code) can simplify a bit?? */ -typedef void (*dyn_lock_locking_cb) (int, int, const char *, int); -typedef int (*dyn_lock_add_lock_cb) (int *, int, int, const char *, int); -typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb) (const char *, - int); -typedef void (*dyn_dynlock_lock_cb) (int, struct CRYPTO_dynlock_value *, - const char *, int); -typedef void (*dyn_dynlock_destroy_cb) (struct CRYPTO_dynlock_value *, - const char *, int); -typedef struct st_dynamic_LOCK_fns { - dyn_lock_locking_cb lock_locking_cb; - dyn_lock_add_lock_cb lock_add_lock_cb; - dyn_dynlock_create_cb dynlock_create_cb; - dyn_dynlock_lock_cb dynlock_lock_cb; - dyn_dynlock_destroy_cb dynlock_destroy_cb; -} dynamic_LOCK_fns; /* The top-level structure */ typedef struct st_dynamic_fns { void *static_state; - dynamic_LOCK_fns lock_fns; + dynamic_MEM_fns mem_fns; } dynamic_fns; /* @@ -803,11 +788,9 @@ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ - CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ - CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ - CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ - CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ - CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ + CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ + fns->mem_fns.realloc_fn, \ + fns->mem_fns.free_fn); \ skip_cbs: \ if(!fn(e,id)) return 0; \ return 1; }