Fix no-tls1_2
[openssl.git] / test / exptest.c
index e6f52139a197da7619a59f0a75e2c20aa59ef373..cde4d6bc4548d96f714dc4dbfdaed0b5092f87f5 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "../e_os.h"
+#include "internal/nelem.h"
 
 #include <openssl/bio.h>
 #include <openssl/bn.h>
@@ -43,7 +43,7 @@ static int a_is_zero_mod_one(const char *method, const BIGNUM *r,
 /*
  * test_mod_exp_zero tests that x**0 mod 1 == 0. It returns zero on success.
  */
-static int test_mod_exp_zero()
+static int test_mod_exp_zero(void)
 {
     BIGNUM *a = NULL, *p = NULL, *m = NULL;
     BIGNUM *r = NULL;
@@ -156,10 +156,9 @@ static int test_mod_exp(int round)
     c = (c % BN_BITS) - BN_BITS2;
     BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
 
-    BN_mod(a, a, m, ctx);
-    BN_mod(b, b, m, ctx);
-
-    if (!TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))
+    if (!TEST_true(BN_mod(a, a, m, ctx))
+        || !TEST_true(BN_mod(b, b, m, ctx))
+        || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))
         || !TEST_true(BN_mod_exp_recp(r_recp, a, b, m, ctx))
         || !TEST_true(BN_mod_exp_simple(r_simple, a, b, m, ctx))
         || !TEST_true(BN_mod_exp_mont_consttime(r_mont_const, a, b, m, ctx, NULL)))
@@ -199,8 +198,9 @@ static int test_mod_exp(int round)
     return ret;
 }
 
-void register_tests(void)
+int setup_tests(void)
 {
     ADD_TEST(test_mod_exp_zero);
     ADD_ALL_TESTS(test_mod_exp, 200);
+    return 1;
 }