Only set the verify callback if there's one to set!
[openssl.git] / ssl / ssltest.c
index cbcb00c89b1ec4daf792862050a2bb2bd8b06c89..0960c1acbcbddbb6ea000b74baa694fa41ac15c1 100644 (file)
 #include <string.h>
 #include <time.h>
 
-#include "openssl/e_os.h"
+#include "e_os.h"
 
 #include <openssl/bio.h>
 #include <openssl/crypto.h>
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/ssl.h>
+#include <openssl/engine.h>
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #ifdef OPENSSL_SYS_WINDOWS
@@ -353,6 +354,12 @@ int main(int argc, char *argv[])
        
        CRYPTO_set_locking_callback(lock_dbg_cb);
 
+       /* enable memory leak checking unless explicitly disabled */
+       if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
+               {
+               CRYPTO_malloc_debug_init();
+               CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+               }
        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
        RAND_seed(rnd_seed, sizeof rnd_seed);
@@ -698,6 +705,7 @@ end:
 #ifndef OPENSSL_NO_RSA
        free_tmp_rsa();
 #endif
+       ENGINE_cleanup();
        ERR_free_strings();
        ERR_remove_state(0);
        EVP_cleanup();