Fix minor type warnings and risk of memory leak in testutil/driver.c
[oweals/openssl.git] / test / dhtest.c
index ccae3412d2a2f54ed04c9d7763029302da903d4f..595732c67322a2bffbda7c27982a3bab653f2a88 100644 (file)
 #include <openssl/err.h>
 #include "testutil.h"
 
-#ifdef OPENSSL_NO_DH
-int main(int argc, char *argv[])
-{
-    printf("No DH support\n");
-    return EXIT_SUCCESS;
-}
-#else
+#ifndef OPENSSL_NO_DH
 # include <openssl/dh.h>
 
 static int cb(int p, int n, BN_GENCB *arg);
 
-static const char rnd_seed[] =
-    "string to make the random number generator think it has randomness";
-
 static int dh_test(void)
 {
     BN_GENCB *_cb = NULL;
@@ -46,8 +37,6 @@ static int dh_test(void)
     int i, alen, blen, aout, bout;
     int ret = 0;
 
-    RAND_seed(rnd_seed, sizeof rnd_seed);
-
     if (!TEST_ptr(_cb = BN_GENCB_new()))
         goto err;
     BN_GENCB_set(_cb, &cb, NULL);
@@ -507,11 +496,16 @@ static int rfc5114_test(void)
     TEST_error("Test failed RFC5114 set %d\n", i + 1);
     return 0;
 }
+#endif
 
 
-void register_tests(void)
+int setup_tests(void)
 {
+#ifdef OPENSSL_NO_DH
+    TEST_note("No DH support");
+#else
     ADD_TEST(dh_test);
     ADD_TEST(rfc5114_test);
-}
 #endif
+    return 1;
+}