diff options
author | Matt Caswell <matt@openssl.org> | 2016-02-08 16:43:03 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-02-09 15:11:38 +0000 |
commit | 7b9f8f7f03eda2faa1cdd42ed29a0b70e60eaf59 (patch) | |
tree | 30f805756265bd1d016aead84dcf1c909cca8b4b /include/openssl | |
parent | b184e3ef73200cb3b7914a603b43a5b8a074c85f (diff) | |
download | openssl-new-7b9f8f7f03eda2faa1cdd42ed29a0b70e60eaf59.tar.gz |
Auto init/deinit libcrypto
This builds on the previous commit to auto initialise/deinitialise
libcrypto.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'include/openssl')
-rw-r--r-- | include/openssl/async.h | 2 | ||||
-rw-r--r-- | include/openssl/conf.h | 3 | ||||
-rw-r--r-- | include/openssl/crypto.h | 5 | ||||
-rw-r--r-- | include/openssl/engine.h | 29 | ||||
-rw-r--r-- | include/openssl/err.h | 5 | ||||
-rw-r--r-- | include/openssl/evp.h | 22 | ||||
-rw-r--r-- | include/openssl/symhacks.h | 4 |
7 files changed, 39 insertions, 31 deletions
diff --git a/include/openssl/async.h b/include/openssl/async.h index 5ddfafb5da..8ec9b000c4 100644 --- a/include/openssl/async.h +++ b/include/openssl/async.h @@ -74,8 +74,6 @@ typedef struct async_job_st ASYNC_JOB; #define ASYNC_PAUSE 2 #define ASYNC_FINISH 3 -int ASYNC_init(int init_thread, size_t max_size, size_t init_size); -void ASYNC_cleanup(int cleanupthread); int ASYNC_init_thread(size_t max_size, size_t init_size); void ASYNC_cleanup_thread(void); diff --git a/include/openssl/conf.h b/include/openssl/conf.h index 6598107914..9144c6d17d 100644 --- a/include/openssl/conf.h +++ b/include/openssl/conf.h @@ -138,7 +138,8 @@ int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); void OPENSSL_config(const char *config_name); -void OPENSSL_no_config(void); +#define OPENSSL_no_config() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) /* * New conf code. The semantics are different from the functions above. If diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index dd1089dc6c..6529bf4dd4 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -1,5 +1,5 @@ /* ==================================================================== - * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -205,7 +205,8 @@ extern "C" { # define CRYPTO_LOCK_COMP 38 # define CRYPTO_LOCK_FIPS 39 # define CRYPTO_LOCK_FIPS2 40 -# define CRYPTO_NUM_LOCKS 41 +# define CRYPTO_LOCK_INIT 41 +# define CRYPTO_NUM_LOCKS 42 # define CRYPTO_LOCK 1 # define CRYPTO_UNLOCK 2 diff --git a/include/openssl/engine.h b/include/openssl/engine.h index 58b2d7cebc..b5b4d07ab1 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -387,23 +387,22 @@ 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); +#define ENGINE_load_openssl() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +#define ENGINE_load_dynamic() \ + OPENSSL_INIT_crypto_library_start(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); -void ENGINE_load_dasync(void); +# define ENGINE_load_padlock() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +#define ENGINE_load_capi() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_CAPI, NULL) +#define ENGINE_load_dasync() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_DASYNC, NULL) # endif -void ENGINE_load_cryptodev(void); -void ENGINE_load_rdrand(void); +#define ENGINE_load_cryptodev() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +#define ENGINE_load_rdrand() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ENGINE_RDRAND, NULL) void ENGINE_load_builtin_engines(void); /* diff --git a/include/openssl/err.h b/include/openssl/err.h index 8baf6b7a13..f8742a4681 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -354,7 +354,10 @@ void ERR_add_error_vdata(int num, va_list args); void ERR_load_strings(int lib, ERR_STRING_DATA str[]); void ERR_unload_strings(int lib, ERR_STRING_DATA str[]); void ERR_load_ERR_strings(void); -void ERR_load_crypto_strings(void); + +#define ERR_load_crypto_strings() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) + void ERR_free_strings(void); void ERR_remove_thread_state(const CRYPTO_THREADID *tid); diff --git a/include/openssl/evp.h b/include/openssl/evp.h index a0d0d678b8..91305b87b9 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -870,19 +870,29 @@ const EVP_CIPHER *EVP_seed_cfb128(void); const EVP_CIPHER *EVP_seed_ofb(void); # endif -void OPENSSL_add_all_algorithms_noconf(void); -void OPENSSL_add_all_algorithms_conf(void); +# define OPENSSL_add_all_algorithms_conf() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, NULL) +# define OPENSSL_add_all_algorithms_noconf() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \ + OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) # ifdef OPENSSL_LOAD_CONF # define OpenSSL_add_all_algorithms() \ - OPENSSL_add_all_algorithms_conf() + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, NULL) # else # define OpenSSL_add_all_algorithms() \ - OPENSSL_add_all_algorithms_noconf() + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) # endif -void OpenSSL_add_all_ciphers(void); -void OpenSSL_add_all_digests(void); +# define OpenSSL_add_all_ciphers() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) +# define OpenSSL_add_all_digests() \ + OPENSSL_INIT_crypto_library_start(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) int EVP_add_cipher(const EVP_CIPHER *cipher); int EVP_add_digest(const EVP_MD *digest); diff --git a/include/openssl/symhacks.h b/include/openssl/symhacks.h index 8e0edfc013..f78a58448a 100644 --- a/include/openssl/symhacks.h +++ b/include/openssl/symhacks.h @@ -220,10 +220,6 @@ # define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit /* Hack some long EVP names */ -# undef OPENSSL_add_all_algorithms_noconf -# define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf -# undef OPENSSL_add_all_algorithms_conf -# define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf # undef EVP_PKEY_meth_set_verify_recover # define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover |