Refactoring BIO: add a simple networking test of s_client and s_server
[openssl.git] / test / dsatest.c
index a5d40f1eb605a970c6cb7072fca0b371c29744dd..426e443bbcc5c3c3dbe461389fbb248adfd552ba 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/dsa/dsatest.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -136,10 +135,9 @@ int main(int argc, char **argv)
     unsigned int siglen;
 
     if (bio_err == NULL)
-        bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
+        bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
-    CRYPTO_malloc_debug_init();
-    CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_set_mem_debug(1);
     CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
 
     ERR_load_crypto_strings();
@@ -212,12 +210,13 @@ int main(int argc, char **argv)
     if (!ret)
         ERR_print_errors(bio_err);
     DSA_free(dsa);
-    if (cb != NULL)
-        BN_GENCB_free(cb);
+    BN_GENCB_free(cb);
     CRYPTO_cleanup_all_ex_data();
     ERR_remove_thread_state(NULL);
     ERR_free_strings();
+#ifndef OPENSSL_NO_CRYPTO_MDEBUG
     CRYPTO_mem_leaks(bio_err);
+#endif
     BIO_free(bio_err);
     bio_err = NULL;
 # ifdef OPENSSL_SYS_NETWARE
@@ -248,7 +247,7 @@ static int dsa_cb(int p, int n, BN_GENCB *arg)
     (void)BIO_flush(BN_GENCB_get_arg(arg));
 
     if (!ok && (p == 0) && (num > 1)) {
-        BIO_printf((BIO *)arg, "error in dsatest\n");
+        BIO_printf(BN_GENCB_get_arg(arg), "error in dsatest\n");
         return 0;
     }
     return 1;