summaryrefslogtreecommitdiff
path: root/regress/unittests/test_helper/test_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/test_helper/test_helper.c')
-rw-r--r--regress/unittests/test_helper/test_helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 127e76c2b..9014ce8e4 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -23,6 +23,7 @@
23#include <sys/param.h> 23#include <sys/param.h>
24#include <sys/uio.h> 24#include <sys/uio.h>
25 25
26#include <stdarg.h>
26#include <fcntl.h> 27#include <fcntl.h>
27#include <stdio.h> 28#include <stdio.h>
28#ifdef HAVE_STDINT_H 29#ifdef HAVE_STDINT_H
@@ -34,8 +35,10 @@
34#include <unistd.h> 35#include <unistd.h>
35#include <signal.h> 36#include <signal.h>
36 37
38#ifdef WITH_OPENSSL
37#include <openssl/bn.h> 39#include <openssl/bn.h>
38#include <openssl/err.h> 40#include <openssl/err.h>
41#endif
39 42
40#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS) 43#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H) && !defined(BROKEN_STRNVIS)
41# include <vis.h> 44# include <vis.h>
@@ -126,7 +129,9 @@ main(int argc, char **argv)
126 int ch; 129 int ch;
127 130
128 seed_rng(); 131 seed_rng();
132#ifdef WITH_OPENSSL
129 ERR_load_CRYPTO_strings(); 133 ERR_load_CRYPTO_strings();
134#endif
130 135
131 /* Handle systems without __progname */ 136 /* Handle systems without __progname */
132 if (__progname == NULL) { 137 if (__progname == NULL) {
@@ -287,6 +292,7 @@ test_subtest_info(const char *fmt, ...)
287void 292void
288ssl_err_check(const char *file, int line) 293ssl_err_check(const char *file, int line)
289{ 294{
295#ifdef WITH_OPENSSL
290 long openssl_error = ERR_get_error(); 296 long openssl_error = ERR_get_error();
291 297
292 if (openssl_error == 0) 298 if (openssl_error == 0)
@@ -294,6 +300,10 @@ ssl_err_check(const char *file, int line)
294 300
295 fprintf(stderr, "\n%s:%d: uncaught OpenSSL error: %s", 301 fprintf(stderr, "\n%s:%d: uncaught OpenSSL error: %s",
296 file, line, ERR_error_string(openssl_error, NULL)); 302 file, line, ERR_error_string(openssl_error, NULL));
303#else /* WITH_OPENSSL */
304 fprintf(stderr, "\n%s:%d: uncaught OpenSSL error ",
305 file, line);
306#endif /* WITH_OPENSSL */
297 abort(); 307 abort();
298} 308}
299 309
@@ -338,6 +348,7 @@ test_header(const char *file, int line, const char *a1, const char *a2,
338 a2 != NULL ? ", " : "", a2 != NULL ? a2 : ""); 348 a2 != NULL ? ", " : "", a2 != NULL ? a2 : "");
339} 349}
340 350
351#ifdef WITH_OPENSSL
341void 352void
342assert_bignum(const char *file, int line, const char *a1, const char *a2, 353assert_bignum(const char *file, int line, const char *a1, const char *a2,
343 const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred) 354 const BIGNUM *aa1, const BIGNUM *aa2, enum test_predicate pred)
@@ -350,6 +361,7 @@ assert_bignum(const char *file, int line, const char *a1, const char *a2,
350 fprintf(stderr, "%12s = 0x%s\n", a2, BN_bn2hex(aa2)); 361 fprintf(stderr, "%12s = 0x%s\n", a2, BN_bn2hex(aa2));
351 test_die(); 362 test_die();
352} 363}
364#endif
353 365
354void 366void
355assert_string(const char *file, int line, const char *a1, const char *a2, 367assert_string(const char *file, int line, const char *a1, const char *a2,