aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/init.c
Commit message (Collapse)AuthorAgeFilesLines
* Copyright consolidation 08/10Rich Salz2016-05-171-53/+5
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fold threads.h into crypto.h making API publicViktor Dukhovni2016-05-161-1/+0
| | | | | | Document thread-safe lock creation Reviewed-by: Richard Levitte <levitte@openssl.org>
* Restore the ERR_remove_thread_state() API and make it a no-opRichard Levitte2016-05-101-2/+2
| | | | | | | | | | | 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>
* Ensure all locks are properly cleaned upMatt Caswell2016-04-141-3/+7
| | | | | | Some locks were not being properly cleaned up during close down. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove check_defer()Dr. Stephen Henson2016-04-131-1/+3
| | | | | | | | | | | 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>
* Move a declaration that's private to libcryptoRichard Levitte2016-04-131-0/+1
| | | | | | Don't expose purely libcrypto internal symbols, even to libssl. Reviewed-by: Matt Caswell <matt@openssl.org>
* Rename int_*() functions to *_int()Matt Caswell2016-04-131-48/+48
| | | | | | | | | | 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>
* Rename lots of *_intern or *_internal function to int_*Matt Caswell2016-04-131-47/+47
| | | | | | | | 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>
* Deprecate CONF_modules_free() and make it a no-opMatt Caswell2016-04-131-4/+4
| | | | | | | | 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>
* Deprecate ENGINE_cleanup() and make it a no-opMatt Caswell2016-04-131-4/+4
| | | | | | | | 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>
* Deprecate OBJ_cleanup() and make it a no-opMatt Caswell2016-04-131-2/+3
| | | | | | | | 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>
* Deprecate EVP_cleanup() and make it a no-opMatt Caswell2016-04-131-2/+2
| | | | | | | | 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>
* Deprecate BIO_sock_cleanup() and make it a no-opMatt Caswell2016-04-131-2/+3
| | | | | | | | 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>
* Deprecate CRYPTO_cleanup_all_ex_data() and make it a no-opMatt Caswell2016-04-131-2/+2
| | | | | | | | 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>
* Deprecate RAND_cleanup() and make it a no-opMatt Caswell2016-04-131-5/+5
| | | | | | | | 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>
* Deprecate ERR_free_strings() and make it a no-opMatt Caswell2016-04-131-2/+2
| | | | | | | | 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>
* Deprecate COMP_zlib_cleanup() and make it a no-opMatt Caswell2016-04-131-3/+3
| | | | | | | | 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>
* Remove some OPENSSL_NO_ASYNC guards in initMatt Caswell2016-04-061-8/+1
| | | | | | | | 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>
* Fix no-sockMatt Caswell2016-03-211-0/+2
| | | | | | Misc fixes for no-sock Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove #error from include files.Rich Salz2016-03-201-4/+0
| | | | | | | | 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>
* Ensure that no-comp functions are flagged as suchMatt Caswell2016-03-181-0/+2
| | | | | | | | 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>
* Fix CRYPTO_THREAD_run_once return value checksEmilia Kasper2016-03-151-4/+4
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Small typoRichard Levitte2016-03-151-1/+1
| | | | | | | 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>
* Fix the init cleanup orderMatt Caswell2016-03-141-14/+21
| | | | | | | 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>
* Add some missing cleanup calls to de-initMatt Caswell2016-03-141-0/+2
| | | | | | | | 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>
* Fix memory leak in library deinitEmilia Kasper2016-03-121-5/+8
| | | | | | | | | | | | | | 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>
* Fix no-comp buildEmilia Kasper2016-03-121-0/+7
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Call CONF_modules_free() before ENGINE_cleanup() in auto-deinitMatt Caswell2016-03-111-3/+3
| | | | | | | | | | 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>
* Don't call ENGINE_cleanup when configured "no-engine"Richard Levitte2016-03-091-0/+4
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Always call ENGINE_cleanup() in de-initMatt Caswell2016-03-091-19/+4
| | | | | | | 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>
* Convert ERR_STATE to new multi-threading APIAlessandro Ghedini2016-03-081-2/+2
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove use of CRYPTO_LOCK_INIT in init codeMatt Caswell2016-03-071-2/+7
| | | | | | | 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>
* Swap the init code to use the new Thread API thread localsMatt Caswell2016-03-071-97/+11
| | | | | | | 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>
* Swap the init code to use CRYPTO_ONCEMatt Caswell2016-03-071-131/+80
| | | | | | | 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>
* Rework based on feedback:clucey2016-03-071-1/+19
| | | | | | | | | | | | | | 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>
* Ensure Async is deinited properlyMatt Caswell2016-03-021-0/+10
| | | | | | The global thread local keys were not being deinited properly in async. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix windows thread stop codeMatt Caswell2016-02-181-1/+2
| | | | | | | | 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>
* RT4310: Fix varous no-XXX buildsRich Salz2016-02-171-1/+8
| | | | | | | | | | | | | | | | | | | | | 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>
* RT4315: Fix UEFI build in crypto/init.cDavid Woodhouse2016-02-171-0/+2
| | | | | | | 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>
* Fixes to make no-deprecated work againViktor Dukhovni2016-02-141-0/+1
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Hide OPENSSL_INIT_SETTINGS.Rich Salz2016-02-111-23/+2
| | | | | Make OPENSSL_INIT_SETTINGS an opaque structure. Reviewed-by: Richard Levitte <levitte@openssl.org>
* After renaming init, update errors.Rich Salz2016-02-101-2/+1
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Attempt to log an error if init failedMatt Caswell2016-02-101-1/+14
| | | | | | | | | 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>
* The new init functions can now fail so shouldn't be voidMatt Caswell2016-02-101-3/+5
| | | | | | | 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>
* Variable was declared static when it shouldn't beMatt Caswell2016-02-101-1/+1
| | | | | | | | | 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>
* Rename INIT funtions, deprecate old ones.Rich Salz2016-02-101-9/+8
| | | | | | Man, there were a lot of renamings :) Reviewed-by: Richard Levitte <levitte@openssl.org>
* No dynamic-init fix; merge goof.Rich Salz2016-02-101-1/+0
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Can't re-init after stop.Rich Salz2016-02-101-36/+11
| | | | | | | Remoce DYANMIC once-init stuff. After the library is stopped, you can't restart it. Reviewed-by: Matt Caswell <matt@openssl.org>
* If we've not been inited don't deinitMatt Caswell2016-02-101-16/+18
| | | | | | | | 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>
* Make some global variables staticMatt Caswell2016-02-091-2/+2
| | | | | | | Make some global variables that are only ever accessed from one file static. Reviewed-by: Rich Salz <rsalz@openssl.org>