diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/src/apps/apps.h | 30 | ||||
| -rw-r--r-- | src/lib/libssl/src/apps/openssl.c | 48 |
2 files changed, 42 insertions, 36 deletions
diff --git a/src/lib/libssl/src/apps/apps.h b/src/lib/libssl/src/apps/apps.h index a79bdc9436..1f013e358b 100644 --- a/src/lib/libssl/src/apps/apps.h +++ b/src/lib/libssl/src/apps/apps.h | |||
| @@ -140,36 +140,6 @@ extern BIO *bio_err; | |||
| 140 | #define zlib_cleanup() COMP_zlib_cleanup() | 140 | #define zlib_cleanup() COMP_zlib_cleanup() |
| 141 | #endif | 141 | #endif |
| 142 | 142 | ||
| 143 | #if !defined(OPENSSL_C) | ||
| 144 | # define apps_startup() \ | ||
| 145 | do_pipe_sig() | ||
| 146 | # define apps_shutdown() | ||
| 147 | #else | ||
| 148 | # ifndef OPENSSL_NO_ENGINE | ||
| 149 | # define apps_startup() \ | ||
| 150 | do { do_pipe_sig(); CRYPTO_malloc_init(); \ | ||
| 151 | ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \ | ||
| 152 | ENGINE_load_builtin_engines(); setup_ui_method(); } while(0) | ||
| 153 | # define apps_shutdown() \ | ||
| 154 | do { CONF_modules_unload(1); destroy_ui_method(); \ | ||
| 155 | OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \ | ||
| 156 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ | ||
| 157 | RAND_cleanup(); \ | ||
| 158 | ERR_free_strings(); zlib_cleanup();} while(0) | ||
| 159 | # else | ||
| 160 | # define apps_startup() \ | ||
| 161 | do { do_pipe_sig(); CRYPTO_malloc_init(); \ | ||
| 162 | ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \ | ||
| 163 | setup_ui_method(); } while(0) | ||
| 164 | # define apps_shutdown() \ | ||
| 165 | do { CONF_modules_unload(1); destroy_ui_method(); \ | ||
| 166 | OBJ_cleanup(); EVP_cleanup(); \ | ||
| 167 | CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \ | ||
| 168 | RAND_cleanup(); \ | ||
| 169 | ERR_free_strings(); zlib_cleanup(); } while(0) | ||
| 170 | # endif | ||
| 171 | #endif | ||
| 172 | |||
| 173 | typedef struct args_st { | 143 | typedef struct args_st { |
| 174 | char **data; | 144 | char **data; |
| 175 | int count; | 145 | int count; |
diff --git a/src/lib/libssl/src/apps/openssl.c b/src/lib/libssl/src/apps/openssl.c index 5778191cb1..7070b4c896 100644 --- a/src/lib/libssl/src/apps/openssl.c +++ b/src/lib/libssl/src/apps/openssl.c | |||
| @@ -112,8 +112,6 @@ | |||
| 112 | #include <stdio.h> | 112 | #include <stdio.h> |
| 113 | #include <string.h> | 113 | #include <string.h> |
| 114 | #include <stdlib.h> | 114 | #include <stdlib.h> |
| 115 | #define OPENSSL_C /* tells apps.h to use complete | ||
| 116 | * apps_startup() */ | ||
| 117 | #include "apps.h" | 115 | #include "apps.h" |
| 118 | #include <openssl/bio.h> | 116 | #include <openssl/bio.h> |
| 119 | #include <openssl/crypto.h> | 117 | #include <openssl/crypto.h> |
| @@ -130,13 +128,16 @@ | |||
| 130 | #include "s_apps.h" | 128 | #include "s_apps.h" |
| 131 | #include <openssl/err.h> | 129 | #include <openssl/err.h> |
| 132 | 130 | ||
| 131 | static void openssl_startup(void); | ||
| 132 | static void openssl_shutdown(void); | ||
| 133 | |||
| 133 | /* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the | 134 | /* The LHASH callbacks ("hash" & "cmp") have been replaced by functions with the |
| 134 | * base prototypes (we cast each variable inside the function to the required | 135 | * base prototypes (we cast each variable inside the function to the required |
| 135 | * type of "FUNCTION*"). This removes the necessity for macro-generated wrapper | 136 | * type of "FUNCTION*"). This removes the necessity for macro-generated wrapper |
| 136 | * functions. */ | 137 | * functions. */ |
| 137 | 138 | ||
| 138 | static LHASH_OF(FUNCTION) * prog_init(void); | 139 | static LHASH_OF(FUNCTION) *prog_init(void); |
| 139 | static int do_cmd(LHASH_OF(FUNCTION) * prog, int argc, char *argv[]); | 140 | static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]); |
| 140 | static void list_pkey(BIO * out); | 141 | static void list_pkey(BIO * out); |
| 141 | static void list_cipher(BIO * out); | 142 | static void list_cipher(BIO * out); |
| 142 | static void list_md(BIO * out); | 143 | static void list_md(BIO * out); |
| @@ -195,6 +196,41 @@ err: | |||
| 195 | } | 196 | } |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 199 | static void | ||
| 200 | openssl_startup(void) | ||
| 201 | { | ||
| 202 | do_pipe_sig(); | ||
| 203 | |||
| 204 | CRYPTO_malloc_init(); | ||
| 205 | ERR_load_crypto_strings(); | ||
| 206 | OpenSSL_add_all_algorithms(); | ||
| 207 | |||
| 208 | #ifndef OPENSSL_NO_ENGINE | ||
| 209 | ENGINE_load_builtin_engines(); | ||
| 210 | #endif | ||
| 211 | |||
| 212 | setup_ui_method(); | ||
| 213 | } | ||
| 214 | |||
| 215 | static void | ||
| 216 | openssl_shutdown(void) | ||
| 217 | { | ||
| 218 | CONF_modules_unload(1); | ||
| 219 | destroy_ui_method(); | ||
| 220 | OBJ_cleanup(); | ||
| 221 | EVP_cleanup(); | ||
| 222 | |||
| 223 | #ifndef OPENSSL_NO_ENGINE | ||
| 224 | ENGINE_cleanup(); | ||
| 225 | #endif | ||
| 226 | |||
| 227 | CRYPTO_cleanup_all_ex_data(); | ||
| 228 | ERR_remove_thread_state(NULL); | ||
| 229 | RAND_cleanup(); | ||
| 230 | ERR_free_strings(); | ||
| 231 | zlib_cleanup(); | ||
| 232 | } | ||
| 233 | |||
| 198 | int | 234 | int |
| 199 | main(int argc, char **argv) | 235 | main(int argc, char **argv) |
| 200 | { | 236 | { |
| @@ -237,7 +273,7 @@ main(int argc, char **argv) | |||
| 237 | CRYPTO_set_locking_callback(lock_dbg_cb); | 273 | CRYPTO_set_locking_callback(lock_dbg_cb); |
| 238 | } | 274 | } |
| 239 | 275 | ||
| 240 | apps_startup(); | 276 | openssl_startup(); |
| 241 | 277 | ||
| 242 | /* Lets load up our environment a little */ | 278 | /* Lets load up our environment a little */ |
| 243 | p = getenv("OPENSSL_CONF"); | 279 | p = getenv("OPENSSL_CONF"); |
| @@ -348,7 +384,7 @@ end: | |||
| 348 | if (arg.data != NULL) | 384 | if (arg.data != NULL) |
| 349 | free(arg.data); | 385 | free(arg.data); |
| 350 | 386 | ||
| 351 | apps_shutdown(); | 387 | openssl_shutdown(); |
| 352 | 388 | ||
| 353 | CRYPTO_mem_leaks(bio_err); | 389 | CRYPTO_mem_leaks(bio_err); |
| 354 | if (bio_err != NULL) { | 390 | if (bio_err != NULL) { |
