X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Fcrypto%2Fssl_init.cpp;h=161874cba65fa67993b905da29fd706113f2fae0;hb=ef338226ccf699c8d8a149d9b74e9888175c7099;hp=f32da3a49787ec0b0f707f81bbda7cc3d681e07d;hpb=457b128b77b5b4a0b7dd3094de543de2ce1477ad;p=feisty_meow.git diff --git a/nucleus/library/crypto/ssl_init.cpp b/nucleus/library/crypto/ssl_init.cpp index f32da3a4..161874cb 100644 --- a/nucleus/library/crypto/ssl_init.cpp +++ b/nucleus/library/crypto/ssl_init.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -23,12 +24,23 @@ #include using namespace basis; +using namespace loggers; using namespace mathematics; using namespace structures; namespace crypto { -#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) +//#define DEBUG_SSL + // uncomment to cause more debugging information to be generated, plus + // more checking to be performed in the SSL support. + +#ifdef DEBUG_SSL + #undef LOG + #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) +#else + #undef LOG + #define LOG(s) +#endif const int SEED_SIZE = 100; // the size of the random seed that we'll use. @@ -36,26 +48,38 @@ const int SEED_SIZE = 100; // our global initialization object. SAFE_STATIC_CONST(ssl_init, static_ssl_initializer, ) -//#define DEBUG_SSL - // uncomment to cause more debugging information to be generated, plus - // more checking to be performed in the SSL support. - ssl_init::ssl_init() : c_rando() { + FUNCDEF("ctor"); #ifdef DEBUG_SSL + LOG("prior to crypto debug init"); CRYPTO_malloc_debug_init(); + LOG("prior to dbg set options"); CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); + LOG("prior to mem ctrl"); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); #endif + LOG("prior to rand seed"); RAND_seed(random_bytes(SEED_SIZE).observe(), SEED_SIZE); + LOG("after rand seed"); } ssl_init::~ssl_init() { + FUNCDEF("dtor"); + LOG("prior to crypto cleanup"); CRYPTO_cleanup_all_ex_data(); - ERR_remove_state(0); - CRYPTO_mem_leaks_fp(stderr); + +//hmmm: deprecated +// LOG("prior to err remove state"); +// ERR_remove_thread_state(NULL); + + +//THIS HAD TO be removed in most recent openssl; does it exist? +// LOG("prior to mem leaks fp"); +// CRYPTO_mem_leaks_fp(stderr); +// LOG("after mem leaks fp"); } const chaos &ssl_init::randomizer() const { return c_rando; }