/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-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 <stdio.h>
#include <openssl/opensslconf.h>
+#include <string.h>
+#include <openssl/engine.h>
+#include <openssl/evp.h>
+#include <openssl/rand.h>
+#include "testutil.h"
+
+/* Use a buffer size which is not aligned to block size */
+#define BUFFER_SIZE (8 * 1024) - 13
+
+#ifndef OPENSSL_NO_ENGINE
+static ENGINE *e;
+#endif
+
+
#ifndef OPENSSL_NO_AFALGENG
# include <linux/version.h>
# define K_MAJ 4
#endif
#ifndef OPENSSL_NO_AFALGENG
-/* #if 1 */
-#include <string.h>
-#include <openssl/engine.h>
-#include <openssl/evp.h>
-#include <openssl/rand.h>
-#include "testutil.h"
-
-/* Use a buffer size which is not aligned to block size */
-#define BUFFER_SIZE (8 * 1024) - 13
-
-static ENGINE *e;
-
static int test_afalg_aes_128_cbc(void)
{
EVP_CIPHER_CTX *ctx;
EVP_CIPHER_CTX_free(ctx);
return ret;
}
+#endif
-int main(int argc, char **argv)
+#ifndef OPENSSL_NO_ENGINE
+int global_init(void)
{
- int ret = 0;
-
ENGINE_load_builtin_engines();
# ifndef OPENSSL_NO_STATIC_ENGINE
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL);
# endif
+ return 1;
+}
+#endif
- setup_test();
-
+int setup_tests(void)
+{
+#ifndef OPENSSL_NO_ENGINE
if ((e = ENGINE_by_id("afalg")) == NULL) {
/* Probably a platform env issue, not a test failure. */
TEST_info("Can't load AFALG engine");
} else {
+# ifndef OPENSSL_NO_AFALGENG
ADD_TEST(test_afalg_aes_128_cbc);
+# endif
}
- ret = run_tests(argv[0]);
+#endif
- ENGINE_free(e);
- return finish_test(ret);
+ return 1;
}
-#else /* OPENSSL_NO_AFALGENG */
-
-int main(int argc, char **argv)
+#ifndef OPENSSL_NO_ENGINE
+void cleanup_tests(void)
{
- fprintf(stderr, "AFALG not supported - skipping AFALG tests\n");
- printf("PASS\n");
- return 0;
+ ENGINE_free(e);
}
-
#endif