Fix no-tls1_2
[openssl.git] / test / bftest.c
index 978fd582b1ac0654bd3c25b98eec6052752fb18f..5abb81d7c911f856c6d07d06c0d2e09dd578a4a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
 #include <string.h>
 #include <stdlib.h>
 #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_BF is defined */
-
-#include "test_main_custom.h"
 #include "testutil.h"
 
-#include "../e_os.h"
+#include "internal/nelem.h"
 
-#ifdef OPENSSL_NO_BF
-int main(int argc, char *argv[])
-{
-    printf("No BF support\n");
-    return (0);
-}
-#else
+#ifndef OPENSSL_NO_BF
 # include <openssl/blowfish.h>
 
 # ifdef CHARSET_EBCDIC
@@ -294,7 +286,7 @@ static int print_test_data(void)
     for (j = 0; j < strlen(cbc_data) + 1; j++)
         printf("%02X", ofb64_ok[j]);
     printf("\n");
-    return (0);
+    return 0;
 }
 
 static int test_bf_ecb_raw(int n)
@@ -364,7 +356,7 @@ static int test_bf_cbc(void)
     BF_set_key(&key, 16, cbc_key);
     memset(cbc_in, 0, sizeof(cbc_in));
     memset(cbc_out, 0, sizeof(cbc_out));
-    memcpy(iv, cbc_iv, sizeof iv);
+    memcpy(iv, cbc_iv, sizeof(iv));
     BF_cbc_encrypt((unsigned char *)cbc_data, cbc_out, len,
                    &key, iv, BF_ENCRYPT);
     if (!TEST_mem_eq(cbc_out, 32, cbc_ok, 32))
@@ -440,10 +432,11 @@ static int test_bf_ofb64(void)
 
     return ret;
 }
+#endif
 
-int test_main(int argc, char *argv[])
+int setup_tests(void)
 {
-    int ret;
+#ifndef OPENSSL_NO_BF
 # ifdef CHARSET_EBCDIC
     int n;
 
@@ -453,18 +446,16 @@ int test_main(int argc, char *argv[])
     }
 # endif
 
-    ADD_ALL_TESTS(test_bf_ecb_raw, 2);
-    ADD_ALL_TESTS(test_bf_ecb, NUM_TESTS);
-    ADD_ALL_TESTS(test_bf_set_key, KEY_TEST_NUM-1);
-    ADD_TEST(test_bf_cbc);
-    ADD_TEST(test_bf_cfb64);
-    ADD_TEST(test_bf_ofb64);
-
-    if (argc > 1)
-        ret = print_test_data();
-    else
-        ret = run_tests(argv[0]);
-
-    return ret;
-}
+    if (test_get_argument(0) != NULL) {
+        print_test_data();
+    } else {
+        ADD_ALL_TESTS(test_bf_ecb_raw, 2);
+        ADD_ALL_TESTS(test_bf_ecb, NUM_TESTS);
+        ADD_ALL_TESTS(test_bf_set_key, KEY_TEST_NUM-1);
+        ADD_TEST(test_bf_cbc);
+        ADD_TEST(test_bf_cfb64);
+        ADD_TEST(test_bf_ofb64);
+    }
 #endif
+    return 1;
+}