summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regress/lib/libssl/interop/Makefile.inc10
-rw-r--r--src/regress/lib/libssl/interop/client.c5
-rw-r--r--src/regress/lib/libssl/interop/libressl/Makefile7
-rw-r--r--src/regress/lib/libssl/interop/openssl/Makefile7
-rw-r--r--src/regress/lib/libssl/interop/server.c5
-rw-r--r--src/regress/lib/libssl/interop/util.c46
-rw-r--r--src/regress/lib/libssl/interop/util.h3
7 files changed, 71 insertions, 12 deletions
diff --git a/src/regress/lib/libssl/interop/Makefile.inc b/src/regress/lib/libssl/interop/Makefile.inc
index fc282bea88..f209bdbd91 100644
--- a/src/regress/lib/libssl/interop/Makefile.inc
+++ b/src/regress/lib/libssl/interop/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ 1# $OpenBSD: Makefile.inc,v 1.2 2018/11/07 06:29:26 bluhm Exp $
2 2
3.PATH: ${.CURDIR}/.. 3.PATH: ${.CURDIR}/..
4 4
@@ -20,7 +20,7 @@ ldd-$p.out: $p
20 20
21CLEANFILES += client.out netcat-l.out netcat-l.fstat 21CLEANFILES += client.out netcat-l.out netcat-l.fstat
22REGRESS_TARGETS += run-client 22REGRESS_TARGETS += run-client
23run-client: client 127.0.0.1.crt 23client.out run-client: client 127.0.0.1.crt
24 @echo '\n======== $@ ========' 24 @echo '\n======== $@ ========'
25 echo "greeting" | nc -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \ 25 echo "greeting" | nc -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \
26 127.0.0.1 0 >netcat-l.out & \ 26 127.0.0.1 0 >netcat-l.out & \
@@ -39,7 +39,7 @@ run-client: client 127.0.0.1.crt
39 39
40CLEANFILES += server.out netcat.out 40CLEANFILES += server.out netcat.out
41REGRESS_TARGETS += run-server 41REGRESS_TARGETS += run-server
42run-server: server 127.0.0.1.crt 42server.out run-server: server 127.0.0.1.crt
43 @echo '\n======== $@ ========' 43 @echo '\n======== $@ ========'
44 LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./server 127.0.0.1 0 >server.out 44 LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./server 127.0.0.1 0 >server.out
45 echo "hello" | nc -c -T noverify \ 45 echo "hello" | nc -c -T noverify \
@@ -52,6 +52,10 @@ run-server: server 127.0.0.1.crt
52 # client must have read server greeting 52 # client must have read server greeting
53 grep -q '^greeting$$' netcat.out 53 grep -q '^greeting$$' netcat.out
54 54
55# check that programs have used correct runtime library
56
57REGRESS_TARGETS += ${PROGS:S/^/run-version-/}
58
55# create certificates for TLS 59# create certificates for TLS
56 60
57CLEANFILES += 127.0.0.1.crt 127.0.0.1.key 61CLEANFILES += 127.0.0.1.crt 127.0.0.1.key
diff --git a/src/regress/lib/libssl/interop/client.c b/src/regress/lib/libssl/interop/client.c
index d4d4f1e94d..9d56182932 100644
--- a/src/regress/lib/libssl/interop/client.c
+++ b/src/regress/lib/libssl/interop/client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: client.c,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ */ 1/* $OpenBSD: client.c,v 1.2 2018/11/07 06:29:26 bluhm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org> 3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
4 * 4 *
@@ -21,6 +21,7 @@
21#include <err.h> 21#include <err.h>
22#include <netdb.h> 22#include <netdb.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <string.h>
24#include <unistd.h> 25#include <unistd.h>
25 26
26#include <openssl/err.h> 27#include <openssl/err.h>
@@ -61,6 +62,7 @@ main(int argc, char *argv[])
61 62
62 SSL_library_init(); 63 SSL_library_init();
63 SSL_load_error_strings(); 64 SSL_load_error_strings();
65 print_version();
64 66
65 /* setup method and context */ 67 /* setup method and context */
66 method = SSLv23_client_method(); 68 method = SSLv23_client_method();
@@ -77,7 +79,6 @@ main(int argc, char *argv[])
77 bio = BIO_new_connect(host_port); 79 bio = BIO_new_connect(host_port);
78 if (bio == NULL) 80 if (bio == NULL)
79 err_ssl(1, "BIO_new_connect"); 81 err_ssl(1, "BIO_new_connect");
80
81 print_ciphers(SSL_get_ciphers(ssl)); 82 print_ciphers(SSL_get_ciphers(ssl));
82 83
83 /* connect */ 84 /* connect */
diff --git a/src/regress/lib/libssl/interop/libressl/Makefile b/src/regress/lib/libssl/interop/libressl/Makefile
index 2d8ef78922..5fce6c5c22 100644
--- a/src/regress/lib/libssl/interop/libressl/Makefile
+++ b/src/regress/lib/libssl/interop/libressl/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ 1# $OpenBSD: Makefile,v 1.2 2018/11/07 06:29:26 bluhm Exp $
2 2
3PROGS = client server 3PROGS = client server
4CPPFLAGS = 4CPPFLAGS =
@@ -15,6 +15,11 @@ run-ldd-$p: ldd-$p.out
15 grep -q /usr/lib/libssl.so ldd-$p.out 15 grep -q /usr/lib/libssl.so ldd-$p.out
16 # check that $p is not linked with OpenSSL 16 # check that $p is not linked with OpenSSL
17 ! grep /usr/local/lib/ ldd-$p.out 17 ! grep /usr/local/lib/ ldd-$p.out
18
19run-version-$p: $p.out
20 @echo '\n======== $@ ========'
21 # check that runtime version is LibreSSL
22 grep 'SSLEAY_VERSION: LibreSSL' $p.out
18.endfor 23.endfor
19 24
20.include <bsd.regress.mk> 25.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/openssl/Makefile b/src/regress/lib/libssl/interop/openssl/Makefile
index 26095d0019..9661767d7b 100644
--- a/src/regress/lib/libssl/interop/openssl/Makefile
+++ b/src/regress/lib/libssl/interop/openssl/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ 1# $OpenBSD: Makefile,v 1.2 2018/11/07 06:29:26 bluhm Exp $
2 2
3.if ! exists(/usr/local/bin/eopenssl) 3.if ! exists(/usr/local/bin/eopenssl)
4regress: 4regress:
@@ -22,6 +22,11 @@ run-ldd-$p: ldd-$p.out
22 grep -q /usr/local/lib/eopenssl/libssl.so ldd-$p.out 22 grep -q /usr/local/lib/eopenssl/libssl.so ldd-$p.out
23 # check that $p is not linked with LibreSSL 23 # check that $p is not linked with LibreSSL
24 ! grep -v libc.so ldd-$p.out | grep /usr/lib/ 24 ! grep -v libc.so ldd-$p.out | grep /usr/lib/
25
26run-version-$p: $p.out
27 @echo '\n======== $@ ========'
28 # check that runtime version is OpenSSL 1.0
29 grep 'SSLEAY_VERSION: OpenSSL 1.0' $p.out
25.endfor 30.endfor
26 31
27.include <bsd.regress.mk> 32.include <bsd.regress.mk>
diff --git a/src/regress/lib/libssl/interop/server.c b/src/regress/lib/libssl/interop/server.c
index 862ca21fcb..6f40c4899c 100644
--- a/src/regress/lib/libssl/interop/server.c
+++ b/src/regress/lib/libssl/interop/server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: server.c,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ */ 1/* $OpenBSD: server.c,v 1.2 2018/11/07 06:29:26 bluhm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org> 3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
4 * 4 *
@@ -21,6 +21,7 @@
21#include <err.h> 21#include <err.h>
22#include <netdb.h> 22#include <netdb.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <string.h>
24#include <unistd.h> 25#include <unistd.h>
25 26
26#include <openssl/err.h> 27#include <openssl/err.h>
@@ -65,6 +66,7 @@ main(int argc, char *argv[])
65 66
66 SSL_library_init(); 67 SSL_library_init();
67 SSL_load_error_strings(); 68 SSL_load_error_strings();
69 print_version();
68 70
69 /* setup method and context */ 71 /* setup method and context */
70 method = SSLv23_server_method(); 72 method = SSLv23_server_method();
@@ -93,7 +95,6 @@ main(int argc, char *argv[])
93 bio = BIO_new_accept(host_port); 95 bio = BIO_new_accept(host_port);
94 if (bio == NULL) 96 if (bio == NULL)
95 err_ssl(1, "BIO_new_accept"); 97 err_ssl(1, "BIO_new_accept");
96
97 print_ciphers(SSL_get_ciphers(ssl)); 98 print_ciphers(SSL_get_ciphers(ssl));
98 99
99 /* bind, listen */ 100 /* bind, listen */
diff --git a/src/regress/lib/libssl/interop/util.c b/src/regress/lib/libssl/interop/util.c
index 3f1c221d51..b012d73193 100644
--- a/src/regress/lib/libssl/interop/util.c
+++ b/src/regress/lib/libssl/interop/util.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: util.c,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ */ 1/* $OpenBSD: util.c,v 1.2 2018/11/07 06:29:26 bluhm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org> 3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
4 * 4 *
@@ -24,13 +24,55 @@
24 24
25#include <openssl/err.h> 25#include <openssl/err.h>
26#include <openssl/ssl.h> 26#include <openssl/ssl.h>
27#include <openssl/opensslv.h>
28#include <openssl/crypto.h>
27 29
28#include "util.h" 30#include "util.h"
29 31
30void 32void
33print_version(void)
34{
35#ifdef OPENSSL_VERSION_NUMBER
36 printf("OPENSSL_VERSION_NUMBER: %#08lx\n", OPENSSL_VERSION_NUMBER);
37#endif
38#ifdef LIBRESSL_VERSION_NUMBER
39 printf("LIBRESSL_VERSION_NUMBER: %#08lx\n", LIBRESSL_VERSION_NUMBER);
40#endif
41#ifdef LIBRESSL_VERSION_TEXT
42 printf("LIBRESSL_VERSION_TEXT: %s\n", LIBRESSL_VERSION_TEXT);
43#endif
44#if OPENSSL_VERSION_NUMBER >= 0x1010000f
45 printf("OpenSSL_version_num: %#08lx\n", OpenSSL_version_num());
46 printf("OpenSSL_version OPENSSL_VERSION: %s\n",
47 OpenSSL_version(OPENSSL_VERSION));
48 printf("OpenSSL_version OPENSSL_CFLAGS: %s\n",
49 OpenSSL_version(OPENSSL_CFLAGS));
50 printf("OpenSSL_version OPENSSL_BUILT_ON: %s\n",
51 OpenSSL_version(OPENSSL_BUILT_ON));
52 printf("OpenSSL_version OPENSSL_PLATFORM: %s\n",
53 OpenSSL_version(OPENSSL_PLATFORM));
54 printf("OpenSSL_version OPENSSL_DIR: %s\n",
55 OpenSSL_version(OPENSSL_DIR));
56 printf("OpenSSL_version OPENSSL_ENGINES_DIR: %s\n",
57 OpenSSL_version(OPENSSL_ENGINES_DIR));
58#endif
59 printf("SSLeay: %#08lx\n", SSLeay());
60 printf("SSLeay_version SSLEAY_VERSION: %s\n",
61 SSLeay_version(SSLEAY_VERSION));
62 printf("SSLeay_version SSLEAY_CFLAGS: %s\n",
63 SSLeay_version(SSLEAY_CFLAGS));
64 printf("SSLeay_version SSLEAY_BUILT_ON: %s\n",
65 SSLeay_version(SSLEAY_BUILT_ON));
66 printf("SSLeay_version SSLEAY_PLATFORM: %s\n",
67 SSLeay_version(SSLEAY_PLATFORM));
68 printf("SSLeay_version SSLEAY_DIR: %s\n",
69 SSLeay_version(SSLEAY_DIR));
70}
71
72void
31print_ciphers(STACK_OF(SSL_CIPHER) *cstack) 73print_ciphers(STACK_OF(SSL_CIPHER) *cstack)
32{ 74{
33 SSL_CIPHER *cipher; 75 const SSL_CIPHER *cipher;
34 int i; 76 int i;
35 77
36 for (i = 0; (cipher = sk_SSL_CIPHER_value(cstack, i)) != NULL; i++) 78 for (i = 0; (cipher = sk_SSL_CIPHER_value(cstack, i)) != NULL; i++)
diff --git a/src/regress/lib/libssl/interop/util.h b/src/regress/lib/libssl/interop/util.h
index 2fdebf34b3..78f7bb63b6 100644
--- a/src/regress/lib/libssl/interop/util.h
+++ b/src/regress/lib/libssl/interop/util.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: util.h,v 1.1.1.1 2018/11/07 01:08:49 bluhm Exp $ */ 1/* $OpenBSD: util.h,v 1.2 2018/11/07 06:29:26 bluhm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org> 3 * Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
4 * 4 *
@@ -15,6 +15,7 @@
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */ 16 */
17 17
18void print_version(void);
18void print_ciphers(STACK_OF(SSL_CIPHER) *); 19void print_ciphers(STACK_OF(SSL_CIPHER) *);
19void print_sockname(BIO *); 20void print_sockname(BIO *);
20void print_peername(BIO *); 21void print_peername(BIO *);