Add a test for the certificate callback
[openssl.git] / test / ecdsatest.c
index 54f1a526d94257b73668efb421d90d9507db0592..c4bcb8edd699ebb2638dd618a7e7a9c4e67334b1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
 #include <string.h>
 
 #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_EC is defined */
+# include "testutil.h"
 
-#ifdef OPENSSL_NO_EC
-int main(int argc, char *argv[])
-{
-    puts("Elliptic curves are disabled.");
-    return 0;
-}
-#else
+#ifndef OPENSSL_NO_EC
 
 # include <openssl/crypto.h>
 # include <openssl/bio.h>
@@ -32,11 +27,6 @@ int main(int argc, char *argv[])
 # endif
 # include <openssl/err.h>
 # include <openssl/rand.h>
-# include "testutil.h"
-
-static const char rnd_seed[] = "string to make the random number generator "
-    "think it has entropy";
-
 
 /* functions to change the RAND_METHOD */
 static int fbytes(unsigned char *buf, int num);
@@ -175,7 +165,7 @@ static int x9_62_test_internal(int nid, const char *r_in, const char *s_in)
     return ret;
 }
 
-static int x9_62_tests()
+static int x9_62_tests(void)
 {
     int ret = 0;
 
@@ -249,7 +239,7 @@ static int test_builtin(void)
         unsigned char dirt, offset;
 
         nid = curves[n].nid;
-        if (nid == NID_ipsec4 || nid == NID_X25519)
+        if (nid == NID_ipsec4)
             continue;
         /* create new ecdsa key (== EC_KEY) */
         if (!TEST_ptr(eckey = EC_KEY_new())
@@ -400,12 +390,15 @@ static int test_builtin(void)
 
     return ret;
 }
+#endif
 
-void register_tests(void)
+int setup_tests(void)
 {
-    /* initialize the prng */
-    RAND_seed(rnd_seed, sizeof(rnd_seed));
+#ifdef OPENSSL_NO_EC
+    TEST_note("Elliptic curves are disabled.");
+#else
     ADD_TEST(x9_62_tests);
     ADD_TEST(test_builtin);
-}
 #endif
+    return 1;
+}