summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
AgeCommit message (Collapse)Author
2016-06-14RT4562: Fix misleading doc on OPENSSL_configRich Salz
Also changed the code to use "appname" not "filename" Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-17Copyright consolidation 08/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-16Fold threads.h into crypto.h making API publicViktor Dukhovni
Document thread-safe lock creation Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-10Restore the ERR_remove_thread_state() API and make it a no-opRichard Levitte
The ERR_remove_thread_state() API is restored to take a pointer argument, but does nothing more. ERR_remove_state() is also made into a no-op. Both functions are deprecated and users are recommended to use OPENSSL_thread_stop() instead. Documentation is changed to reflect this. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-14Ensure all locks are properly cleaned upMatt Caswell
Some locks were not being properly cleaned up during close down. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Remove check_defer()Dr. Stephen Henson
The check_defer() function was used to ensure that EVP_cleanup() was always called before OBJ_cleanup(). The new cleanup code ensures this so it is no longer needed. Remove obj_cleanup() call in OID config module: it is not needed any more either. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-13Move a declaration that's private to libcryptoRichard Levitte
Don't expose purely libcrypto internal symbols, even to libssl. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-13Rename int_*() functions to *_int()Matt Caswell
There is a preference for suffixes to indicate that a function is internal rather than prefixes. Note: the suffix is only required to disambiguate internal functions and public symbols with the same name (but different case) Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Rename lots of *_intern or *_internal function to int_*Matt Caswell
There was a lot of naming inconsistency, so we try and standardise on one form. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate CONF_modules_free() and make it a no-opMatt Caswell
CONF_modules_free() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate ENGINE_cleanup() and make it a no-opMatt Caswell
ENGINE_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate OBJ_cleanup() and make it a no-opMatt Caswell
OBJ_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate EVP_cleanup() and make it a no-opMatt Caswell
EVP_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate BIO_sock_cleanup() and make it a no-opMatt Caswell
BIO_sock_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate CRYPTO_cleanup_all_ex_data() and make it a no-opMatt Caswell
CRYPTO_cleanup_all_ex_data() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate RAND_cleanup() and make it a no-opMatt Caswell
RAND_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate ERR_free_strings() and make it a no-opMatt Caswell
ERR_free_strings() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-13Deprecate COMP_zlib_cleanup() and make it a no-opMatt Caswell
COMP_zlib_cleanup() should not be called expicitly - we should leave auto-deinit to clean this up instead. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-06Remove some OPENSSL_NO_ASYNC guards in initMatt Caswell
When config'd with "no-async" the ASYNC_NULL implementation is used, so async symbols still exist. We should still init the NULL implementation so that when we get the async ctx it is NULL rather than undefined. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-21Fix no-sockMatt Caswell
Misc fixes for no-sock Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-20Remove #error from include files.Rich Salz
Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-18Ensure that no-comp functions are flagged as suchMatt Caswell
mkdef.pl was not detecting no-comp functions. This updates the header file so that mkdef.pl detects that no-comp applies, and the functions are marked accordingly. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-15Fix CRYPTO_THREAD_run_once return value checksEmilia Kasper
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-15Small typoRichard Levitte
OPENSSL_INIT_ONCE and OPENSSL_INIT_ONCE_STATIC_INIT are really CRYPTO_ONCE and CRYPTO_ONCE_STATIC_INIT. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-14Fix the init cleanup orderMatt Caswell
There are internal dependencies between the various cleanup functions. This re-orders things to try and get that right. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-14Add some missing cleanup calls to de-initMatt Caswell
OBJ_cleanup() doesn't always get called from EVP_cleanup() so needs to be explicitly called in de-init. Also BIO_sock_cleanup() also needs to be called. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-12Fix memory leak in library deinitEmilia Kasper
ENGINE_cleanup calls CRYPTO_free_ex_data and therefore, CRYPTO_cleanup_all_ex_data - which cleans up the method pointers - must run after ENGINE_cleanup. Additionally, don't needlessly initialize the EX_CALLBACKS stack during e.g. CRYPTO_free_ex_data. The only time this is actually needed is when reserving the first ex data index. Specifically, since sk_num returns -1 on NULL input, the rest of the code already handles a NULL method stack correctly. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-12Fix no-comp buildEmilia Kasper
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-11Call CONF_modules_free() before ENGINE_cleanup() in auto-deinitMatt Caswell
During auto de-init we were calling ENGINE_cleanup(), and then later CONF_modules_free(). However the latter function can end up calling engine code, which can lead to a use of the global_engine_lock after it has already been freed. Therefore we should swap the calling order of these two functions. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-09Don't call ENGINE_cleanup when configured "no-engine"Richard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-09Always call ENGINE_cleanup() in de-initMatt Caswell
Even if we haven't loaded an engine, we might have set up the global_engine_lock, so we should still clean up. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-08Convert ERR_STATE to new multi-threading APIAlessandro Ghedini
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07Remove use of CRYPTO_LOCK_INIT in init codeMatt Caswell
Swap the use of CRYPTO_LOCK_INIT in the init code to use the new threading API mechanism for locking. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07Swap the init code to use the new Thread API thread localsMatt Caswell
The init code was using its own thread local code. Now we have a central API for it we should use that instead. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07Swap the init code to use CRYPTO_ONCEMatt Caswell
The init code was using its own "once" implementation. Now that we have the new thread API we should use that instead. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-07Rework based on feedback:clucey
1. Cleaned up eventfd handling 2. Reworked socket setup code to allow other algorithms to be added in future 3. Fixed compile errors for static build 4. Added error to error stack in all cases of ALG_PERR/ALG_ERR 5. Called afalg_aes_128_cbc() from bind() to avoid race conditions 6. Used MAX_INFLIGHT define in io_getevents system call 7. Coding style fixes Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-02Ensure Async is deinited properlyMatt Caswell
The global thread local keys were not being deinited properly in async. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-18Fix windows thread stop codeMatt Caswell
The windows thread stop code was erroneously not just deleting the thread local variable on thread stop, but also deleting the thread local *key* (thus removing thread local data for *all* threads in one go!). Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-17RT4310: Fix varous no-XXX buildsRich Salz
When OPENSSL_NO_ASYNC is set, make ASYNC_{un,}block_pause() do nothing. This prevents md_rand.c from failing to build. Probably better to do it this way than to wrap every instance in an explicit #ifdef. A bunch of new socket code got added to a new file crypto/bio/b_addr.c. Make it all go away if OPENSSL_NO_SOCK is defined. Allow configuration with no-ripemd, no-ts, no-ui We use these for the UEFI build. Also remove the 'Really???' comment from no-err and no-locking. We use those too. We need to drop the crypto/engine directory from the build too, and also set OPENSSL_NO_ENGINE Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-02-17RT4315: Fix UEFI build in crypto/init.cDavid Woodhouse
We don't have atexit() in the EDK2 environment. Firmware never exits. Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-14Fixes to make no-deprecated work againViktor Dukhovni
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-11Hide OPENSSL_INIT_SETTINGS.Rich Salz
Make OPENSSL_INIT_SETTINGS an opaque structure. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-10After renaming init, update errors.Rich Salz
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-10Attempt to log an error if init failedMatt Caswell
If init failed we'd like to set an error code to indicate that. But if init failed then when the error system tries to load its strings its going to fail again. We could get into an infinite loop. Therefore we just set a single error the first time around. After that no error is set. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-10The new init functions can now fail so shouldn't be voidMatt Caswell
The new init functions can fail if the library has already been stopped. We should be able to indicate failure with a 0 return value. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-10Variable was declared static when it shouldn't beMatt Caswell
The local variable tmp was declared static when it shouldn't be. This is in the no-threads implementation, and it was immediately initialised to something else on every invokation of the function so it doesn't break anything...but still shouldn't be there. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-02-10Rename INIT funtions, deprecate old ones.Rich Salz
Man, there were a lot of renamings :) Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-10No dynamic-init fix; merge goof.Rich Salz
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-10Can't re-init after stop.Rich Salz
Remoce DYANMIC once-init stuff. After the library is stopped, you can't restart it. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-02-10If we've not been inited don't deinitMatt Caswell
If you call an explicit deinit when we've not been inited then a seg fault can occur. We should check that we've been inited before attempting to deinit. Reviewed-by: Rich Salz <rsalz@openssl.org>