Add prototypes for new DSA functions Steve added recently.
[oweals/openssl.git] / crypto / dsa / dsatest.c
index 1613f5350eba58addb07bf451d8a99bb143d12cf..fc25c9a1b797647e82fb1c4d4681e4d3431d1af7 100644 (file)
 #include <openssl/rand.h>
 #include <openssl/bio.h>
 #include <openssl/err.h>
-#include <openssl/dsa.h>
 #ifdef WINDOWS
 #include "../bio/bss_file.c"
 #endif
 
+#ifdef NO_DSA
+int main(int argc, char *argv[])
+{
+    printf("No DSA support\n");
+    return(0);
+}
+#else
+#include <openssl/dsa.h>
+
 #ifdef WIN16
 #define MS_CALLBACK     _far _loadds
 #else
 #define MS_CALLBACK
 #endif
 
-#ifndef NOPROTO
 static void MS_CALLBACK dsa_cb(int p, int n, char *arg);
-#else
-static void MS_CALLBACK dsa_cb();
-#endif
-
 static unsigned char seed[20]={
        0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40,
        0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3,
@@ -131,6 +134,8 @@ int main(int argc, char **argv)
        if (bio_err == NULL)
                bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 
+       CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
        BIO_printf(bio_err,"test generation of DSA parameters\n");
        BIO_printf(bio_err,"expect '.*' followed by 5 lines of '.'s and '+'s\n");
        dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,
@@ -187,8 +192,9 @@ int main(int argc, char **argv)
 end:
        if (!ret)
                ERR_print_errors(bio_err);
-       if (bio_err != NULL) BIO_free(bio_err);
        if (dsa != NULL) DSA_free(dsa);
+       CRYPTO_mem_leaks(bio_err);
+       if (bio_err != NULL) BIO_free(bio_err);
        exit(!ret);
        return(0);
        }
@@ -203,7 +209,7 @@ static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
        if (p == 2) { c='*'; ok++; }
        if (p == 3) c='\n';
        BIO_write((BIO *)arg,&c,1);
-       BIO_flush((BIO *)arg);
+       (void)BIO_flush((BIO *)arg);
 
        if (!ok && (p == 0) && (num > 1))
                {
@@ -211,5 +217,4 @@ static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
                exit(1);
                }
        }
-
-
+#endif