summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2020-11-09 15:43:46 +0000
committertb <tb@openbsd.org>2020-11-09 15:43:46 +0000
commit8743c87256084b6701246d2e5f04858dc304d415 (patch)
treefb7d9f2b76b13e7b8a16cf6a1ffbc162074ad032
parentClear TX sent counter on up/down. (diff)
downloadwireguard-openbsd-8743c87256084b6701246d2e5f04858dc304d415.tar.xz
wireguard-openbsd-8743c87256084b6701246d2e5f04858dc304d415.zip
Rework the rpki-client test to also run against OpenSSL 1.1 if the
package is installed. This ensures that the part of rpki-client that uses libcrypto works as expected with both LibreSSL and OpenSSL. This will hopefully also help reduce the friction of cutting the portable release. The OpenSSL code reaches around into libcrypto for the LibreSSL specific functions that are provided in -portable. A tiny bit of glue in test-mft.c is also needed. Positive feedback from benno
-rw-r--r--regress/usr.sbin/rpki-client/Makefile47
-rw-r--r--regress/usr.sbin/rpki-client/Makefile.inc42
-rw-r--r--regress/usr.sbin/rpki-client/libressl/Makefile3
-rw-r--r--regress/usr.sbin/rpki-client/openssl11/Makefile12
-rw-r--r--regress/usr.sbin/rpki-client/test-mft.c10
5 files changed, 72 insertions, 42 deletions
diff --git a/regress/usr.sbin/rpki-client/Makefile b/regress/usr.sbin/rpki-client/Makefile
index 82612214df8..e3d651a65a9 100644
--- a/regress/usr.sbin/rpki-client/Makefile
+++ b/regress/usr.sbin/rpki-client/Makefile
@@ -1,44 +1,9 @@
-# $OpenBSD: Makefile,v 1.8 2020/08/21 15:05:51 tb Exp $
+# $OpenBSD: Makefile,v 1.9 2020/11/09 15:43:46 tb Exp $
-.PATH: ${.CURDIR}/../../../usr.sbin/rpki-client
-
-PROGS += test-ip
-PROGS += test-cert
-PROGS += test-mft
-PROGS += test-roa
-PROGS += test-tal
-
-.for p in ${PROGS}
-REGRESS_TARGETS += run-regress-$p
-.endfor
-
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../../usr.sbin/rpki-client
-LDADD+= -lcrypto
-DPADD+= ${LIBCRYPTO}
-
-SRCS_test-ip= test-ip.c ip.c io.c
-run-regress-test-ip: test-ip
- ./test-ip
-
-TALARGS += ta/AfriNIC.cer tal/afrinic.tal
-TALARGS += ta/apnic-rpki-root-iana-origin.cer tal/apnic.tal
-TALARGS += ta/ripe-ncc-ta.cer tal/ripe.tal
-
-SRCS_test-cert= test-cert.c cert.c x509.c ip.c as.c rsync.c io.c log.c tal.c
-run-regress-test-cert: test-cert
- ./test-cert -v ${.CURDIR}/cer/*.cer
- ./test-cert -vt ${TALARGS:S,,${.CURDIR}/&,}
-
-SRCS_test-mft= test-mft.c mft.c cms.c x509.c io.c log.c
-run-regress-test-mft: test-mft
- ./test-mft -v ${.CURDIR}/mft/*.mft
-
-SRCS_test-roa= test-roa.c roa.c cms.c x509.c ip.c as.c io.c log.c
-run-regress-test-roa: test-roa
- ./test-roa -v ${.CURDIR}/roa/*.roa
-
-SRCS_test-tal= test-tal.c tal.c rsync.c io.c log.c
-run-regress-test-tal: test-tal
- ./test-tal -v ${.CURDIR}/tal/*.tal
+SUBDIR += libressl
+.if exists(/usr/local/bin/eopenssl11)
+SUBDIR += openssl11
+.endif
+.include <bsd.subdir.mk>
.include <bsd.regress.mk>
diff --git a/regress/usr.sbin/rpki-client/Makefile.inc b/regress/usr.sbin/rpki-client/Makefile.inc
new file mode 100644
index 00000000000..a6dc0b459ca
--- /dev/null
+++ b/regress/usr.sbin/rpki-client/Makefile.inc
@@ -0,0 +1,42 @@
+# $OpenBSD: Makefile.inc,v 1.1 2020/11/09 15:43:46 tb Exp $
+
+.PATH: ${.CURDIR}/../../../../usr.sbin/rpki-client
+
+PROGS += test-ip
+PROGS += test-cert
+PROGS += test-mft
+PROGS += test-roa
+PROGS += test-tal
+
+.for p in ${PROGS}
+REGRESS_TARGETS += run-regress-$p
+.endfor
+
+CFLAGS+= -I${.CURDIR}/.. -I${.CURDIR}/../../../../usr.sbin/rpki-client
+LDADD+= -lcrypto
+DPADD+= ${LIBCRYPTO}
+
+SRCS_test-ip= test-ip.c ip.c io.c
+run-regress-test-ip: test-ip
+ ./test-ip
+
+TALARGS += ta/AfriNIC.cer tal/afrinic.tal
+TALARGS += ta/apnic-rpki-root-iana-origin.cer tal/apnic.tal
+TALARGS += ta/ripe-ncc-ta.cer tal/ripe.tal
+
+SRCS_test-cert= test-cert.c cert.c x509.c ip.c as.c rsync.c io.c log.c tal.c
+run-regress-test-cert: test-cert
+ ./test-cert -v ${.CURDIR}/../cer/*.cer
+ ./test-cert -vt ${TALARGS:S,,${.CURDIR}/../&,}
+
+SRCS_test-mft+= test-mft.c mft.c cms.c x509.c io.c log.c
+run-regress-test-mft: test-mft
+ ./test-mft -v ${.CURDIR}/../mft/*.mft
+
+SRCS_test-roa= test-roa.c roa.c cms.c x509.c ip.c as.c io.c log.c
+run-regress-test-roa: test-roa
+ ./test-roa -v ${.CURDIR}/../roa/*.roa
+
+SRCS_test-tal= test-tal.c tal.c rsync.c io.c log.c
+run-regress-test-tal: test-tal
+ ./test-tal -v ${.CURDIR}/../tal/*.tal
diff --git a/regress/usr.sbin/rpki-client/libressl/Makefile b/regress/usr.sbin/rpki-client/libressl/Makefile
new file mode 100644
index 00000000000..38c2a357fea
--- /dev/null
+++ b/regress/usr.sbin/rpki-client/libressl/Makefile
@@ -0,0 +1,3 @@
+.PATH: ${.CURDIR}/..
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.sbin/rpki-client/openssl11/Makefile b/regress/usr.sbin/rpki-client/openssl11/Makefile
new file mode 100644
index 00000000000..3153d5809f8
--- /dev/null
+++ b/regress/usr.sbin/rpki-client/openssl11/Makefile
@@ -0,0 +1,12 @@
+LDADD += -Wl,-rpath,/usr/local/lib/eopenssl11 -L/usr/local/lib/eopenssl11
+CFLAGS += -I/usr/local/include/eopenssl11/
+
+# For mft.c we need ASN1_time_parse() and ASN1_time_tm_cmp() from LibreSSL
+SRCS_test-mft = a_time_tm.c o_time.c
+CFLAGS += -I${.CURDIR}/../../../../lib/libcrypto/
+
+.PATH: ${.CURDIR}/..
+.PATH: ${.CURDIR}/../../../../lib/libcrypto
+.PATH: ${.CURDIR}/../../../../lib/libcrypto/asn1
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.sbin/rpki-client/test-mft.c b/regress/usr.sbin/rpki-client/test-mft.c
index 24f7bf84913..eba5777f7ff 100644
--- a/regress/usr.sbin/rpki-client/test-mft.c
+++ b/regress/usr.sbin/rpki-client/test-mft.c
@@ -1,4 +1,4 @@
-/* $Id: test-mft.c,v 1.8 2020/11/03 21:16:32 tb Exp $ */
+/* $Id: test-mft.c,v 1.9 2020/11/09 15:43:46 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -34,6 +34,14 @@
#include "extern.h"
+#ifndef ASN1error
+void
+ASN1error(int err)
+{
+ ASN1err(0, err);
+}
+#endif
+
int verbose;
static void