summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-04-14 12:37:20 +0000
committertb <>2023-04-14 12:37:20 +0000
commitf78b4c90269928d9cf87e71271ceff64401ba9ce (patch)
treed6d9816f3922d92b5be899e1a712c877192e2b1d
parent25fb8b7b6452723037d5e49c8ceb8e1430e7e379 (diff)
downloadopenbsd-f78b4c90269928d9cf87e71271ceff64401ba9ce.tar.gz
openbsd-f78b4c90269928d9cf87e71271ceff64401ba9ce.tar.bz2
openbsd-f78b4c90269928d9cf87e71271ceff64401ba9ce.zip
Make cttest work better with the portable test harness
-rw-r--r--src/regress/lib/libcrypto/ct/Makefile6
-rw-r--r--src/regress/lib/libcrypto/ct/cttest.c15
2 files changed, 12 insertions, 9 deletions
diff --git a/src/regress/lib/libcrypto/ct/Makefile b/src/regress/lib/libcrypto/ct/Makefile
index 5cfdf74c11..a30fd1c278 100644
--- a/src/regress/lib/libcrypto/ct/Makefile
+++ b/src/regress/lib/libcrypto/ct/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.5 2023/04/14 11:18:40 tb Exp $ 1# $OpenBSD: Makefile,v 1.6 2023/04/14 12:37:20 tb Exp $
2 2
3PROG= cttest 3PROG= cttest
4LDADD= -lcrypto 4LDADD= -lcrypto
@@ -7,8 +7,6 @@ DPADD= ${LIBCRYPTO}
7WARNINGS= Yes 7WARNINGS= Yes
8CFLAGS+= -Wundef -Werror 8CFLAGS+= -Wundef -Werror
9CFLAGS+= -DLIBRESSL_CRYPTO_INTERNAL -DLIBRESSL_INTERNAL 9CFLAGS+= -DLIBRESSL_CRYPTO_INTERNAL -DLIBRESSL_INTERNAL
10 10CFLAGS+= -DCTPATH=\"${.CURDIR}\"
11run-regress-cttest: cttest
12 ./cttest ${.CURDIR}/../../libcrypto/ct/
13 11
14.include <bsd.regress.mk> 12.include <bsd.regress.mk>
diff --git a/src/regress/lib/libcrypto/ct/cttest.c b/src/regress/lib/libcrypto/ct/cttest.c
index 8986c93883..a0c75560ef 100644
--- a/src/regress/lib/libcrypto/ct/cttest.c
+++ b/src/regress/lib/libcrypto/ct/cttest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cttest.c,v 1.5 2023/04/14 11:18:40 tb Exp $ */ 1/* $OpenBSD: cttest.c,v 1.6 2023/04/14 12:37:20 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -23,6 +23,10 @@
23#include <openssl/pem.h> 23#include <openssl/pem.h>
24#include <openssl/x509v3.h> 24#include <openssl/x509v3.h>
25 25
26#ifndef CTPATH
27#define CTPATH "."
28#endif
29
26char *test_ctlog_conf_file; 30char *test_ctlog_conf_file;
27char *test_cert_file; 31char *test_cert_file;
28char *test_issuer_file; 32char *test_issuer_file;
@@ -452,14 +456,15 @@ ct_sct_verify_test(void)
452int 456int
453main(int argc, char **argv) 457main(int argc, char **argv)
454{ 458{
455 const char *ctpath; 459 const char *ctpath = CTPATH;
456 int failed = 0; 460 int failed = 0;
457 461
458 if (argc != 2) { 462 if (argc > 2) {
459 fprintf(stderr, "usage: %s ctpath\n", argv[0]); 463 fprintf(stderr, "usage %s [ctpath]\n", argv[0]);
460 exit(1); 464 exit(1);
461 } 465 }
462 ctpath = argv[1]; 466 if (argc == 2)
467 ctpath = argv[1];
463 468
464 if (asprintf(&test_cert_file, "%s/%s", ctpath, 469 if (asprintf(&test_cert_file, "%s/%s", ctpath,
465 "libressl.org.crt") == -1) 470 "libressl.org.crt") == -1)