Put all "common" initialisation in the apps_startup() and apps_shutdown()
macros in apps.h.
This commit is contained in:
parent
1023cfe70d
commit
16e819e1d8
@ -126,21 +126,26 @@ extern BIO *bio_err;
|
|||||||
# ifdef _O_BINARY
|
# ifdef _O_BINARY
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
do { _fmode=_O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||||
|
ERR_load_crypto_strings(); \
|
||||||
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines(); \
|
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines(); \
|
||||||
setup_ui_method(); } while(0)
|
setup_ui_method(); } while(0)
|
||||||
# else
|
# else
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
do { _fmode=O_BINARY; do_pipe_sig(); CRYPTO_malloc_init(); \
|
||||||
|
ERR_load_crypto_strings(); \
|
||||||
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines(); \
|
OpenSSL_add_all_algorithms(); ENGINE_load_builtin_engines(); \
|
||||||
setup_ui_method(); } while(0)
|
setup_ui_method(); } while(0)
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# define apps_startup() \
|
# define apps_startup() \
|
||||||
do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
do { do_pipe_sig(); OpenSSL_add_all_algorithms(); \
|
||||||
|
ERR_load_crypto_strings(); \
|
||||||
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
|
||||||
# endif
|
# endif
|
||||||
# define apps_shutdown() \
|
# define apps_shutdown() \
|
||||||
do { destroy_ui_method(); CRYPTO_cleanup_all_ex_data(); } while(0)
|
do { destroy_ui_method(); EVP_cleanup(); \
|
||||||
|
ENGINE_cleanup(); CRYPTO_cleanup_all_ex_data(); \
|
||||||
|
ERR_remove_state(0); ERR_free_strings(); } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct args_st
|
typedef struct args_st
|
||||||
|
@ -255,9 +255,6 @@ int main(int Argc, char *Argv[])
|
|||||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||||
|
|
||||||
ERR_load_crypto_strings();
|
|
||||||
ENGINE_load_builtin_engines();
|
|
||||||
|
|
||||||
/* Lets load up our environment a little */
|
/* Lets load up our environment a little */
|
||||||
p=getenv("OPENSSL_CONF");
|
p=getenv("OPENSSL_CONF");
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
@ -350,12 +347,6 @@ end:
|
|||||||
}
|
}
|
||||||
if (prog != NULL) lh_free(prog);
|
if (prog != NULL) lh_free(prog);
|
||||||
if (arg.data != NULL) OPENSSL_free(arg.data);
|
if (arg.data != NULL) OPENSSL_free(arg.data);
|
||||||
ERR_remove_state(0);
|
|
||||||
|
|
||||||
EVP_cleanup();
|
|
||||||
ERR_free_strings();
|
|
||||||
|
|
||||||
ENGINE_cleanup();
|
|
||||||
|
|
||||||
apps_shutdown();
|
apps_shutdown();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user