summaryrefslogtreecommitdiff
path: root/src/regress/lib/libssl/interop/cipher/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libssl/interop/cipher/Makefile')
-rw-r--r--src/regress/lib/libssl/interop/cipher/Makefile180
1 files changed, 180 insertions, 0 deletions
diff --git a/src/regress/lib/libssl/interop/cipher/Makefile b/src/regress/lib/libssl/interop/cipher/Makefile
new file mode 100644
index 0000000000..5593ab233f
--- /dev/null
+++ b/src/regress/lib/libssl/interop/cipher/Makefile
@@ -0,0 +1,180 @@
1# $OpenBSD: Makefile,v 1.1 2019/02/21 23:06:33 bluhm Exp $
2
3# Connect a client to a server. Both can be current libressl, or
4# openssl 1.0.2, or openssl 1.1. Create lists of supported ciphers
5# and pin client and server to one of the ciphers. Use server
6# certificate with compatible type. Check that client and server
7# have used correct cipher by grepping in their session print out.
8
9check-cipher-GOST2001-GOST89-GOST89-client-libressl-server-libressl:
10 # cipher GOST2012256-GOST89-GOST89 is used in out file
11 # TODO: figure out why it is not GOST2001
12 @echo DISABLED
13
14check-cipher-ADH-AES128-GCM-SHA256-client-openssl11-server-openssl11 \
15check-cipher-ADH-AES128-SHA-client-openssl11-server-openssl11 \
16check-cipher-ADH-AES128-SHA256-client-openssl11-server-openssl11 \
17check-cipher-ADH-AES256-GCM-SHA384-client-openssl11-server-openssl11 \
18check-cipher-ADH-AES256-SHA-client-openssl11-server-openssl11 \
19check-cipher-ADH-AES256-SHA256-client-openssl11-server-openssl11 \
20check-cipher-ADH-CAMELLIA128-SHA-client-openssl11-server-openssl11 \
21check-cipher-ADH-CAMELLIA128-SHA256-client-openssl11-server-openssl11 \
22check-cipher-ADH-CAMELLIA256-SHA-client-openssl11-server-openssl11 \
23check-cipher-ADH-CAMELLIA256-SHA256-client-openssl11-server-openssl11 \
24check-cipher-AECDH-AES128-SHA-client-openssl11-server-openssl11 \
25check-cipher-AECDH-AES256-SHA-client-openssl11-server-openssl11 \
26check-cipher-AES128-GCM-SHA256-client-openssl11-server-openssl11 \
27check-cipher-AES128-SHA-client-openssl11-server-openssl11 \
28check-cipher-AES128-SHA256-client-openssl11-server-openssl11 \
29check-cipher-AES256-GCM-SHA384-client-openssl11-server-openssl11 \
30check-cipher-AES256-SHA-client-openssl11-server-openssl11 \
31check-cipher-AES256-SHA256-client-openssl11-server-openssl11 \
32check-cipher-CAMELLIA128-SHA-client-openssl11-server-openssl11 \
33check-cipher-CAMELLIA128-SHA256-client-openssl11-server-openssl11 \
34check-cipher-CAMELLIA256-SHA-client-openssl11-server-openssl11 \
35check-cipher-CAMELLIA256-SHA256-client-openssl11-server-openssl11 \
36check-cipher-DHE-RSA-AES128-GCM-SHA256-client-openssl11-server-openssl11 \
37check-cipher-DHE-RSA-AES128-SHA-client-openssl11-server-openssl11 \
38check-cipher-DHE-RSA-AES128-SHA256-client-openssl11-server-openssl11 \
39check-cipher-DHE-RSA-AES256-GCM-SHA384-client-openssl11-server-openssl11 \
40check-cipher-DHE-RSA-AES256-SHA-client-openssl11-server-openssl11 \
41check-cipher-DHE-RSA-AES256-SHA256-client-openssl11-server-openssl11 \
42check-cipher-DHE-RSA-CAMELLIA128-SHA-client-openssl11-server-openssl11 \
43check-cipher-DHE-RSA-CAMELLIA128-SHA256-client-openssl11-server-openssl11 \
44check-cipher-DHE-RSA-CAMELLIA256-SHA-client-openssl11-server-openssl11 \
45check-cipher-DHE-RSA-CAMELLIA256-SHA256-client-openssl11-server-openssl11 \
46check-cipher-DHE-RSA-CHACHA20-POLY1305-client-openssl11-server-openssl11 \
47check-cipher-ECDHE-ECDSA-AES128-GCM-SHA256-client-openssl11-server-openssl11 \
48check-cipher-ECDHE-ECDSA-AES128-SHA-client-openssl11-server-openssl11 \
49check-cipher-ECDHE-ECDSA-AES128-SHA256-client-openssl11-server-openssl11 \
50check-cipher-ECDHE-ECDSA-AES256-GCM-SHA384-client-openssl11-server-openssl11 \
51check-cipher-ECDHE-ECDSA-AES256-SHA-client-openssl11-server-openssl11 \
52check-cipher-ECDHE-ECDSA-AES256-SHA384-client-openssl11-server-openssl11 \
53check-cipher-ECDHE-ECDSA-CHACHA20-POLY1305-client-openssl11-server-openssl11 \
54check-cipher-ECDHE-RSA-AES128-GCM-SHA256-client-openssl11-server-openssl11 \
55check-cipher-ECDHE-RSA-AES128-SHA-client-openssl11-server-openssl11 \
56check-cipher-ECDHE-RSA-AES128-SHA256-client-openssl11-server-openssl11 \
57check-cipher-ECDHE-RSA-AES256-GCM-SHA384-client-openssl11-server-openssl11 \
58check-cipher-ECDHE-RSA-AES256-SHA-client-openssl11-server-openssl11 \
59check-cipher-ECDHE-RSA-AES256-SHA384-client-openssl11-server-openssl11 \
60check-cipher-ECDHE-RSA-CHACHA20-POLY1305-client-openssl11-server-openssl11:
61 # openssl11 always prints TLS_AES_256_GCM_SHA384 as cipher in out file
62 @echo DISABLED
63
64LIBRARIES = libressl
65.if exists(/usr/local/bin/eopenssl)
66LIBRARIES += openssl
67.endif
68.if exists(/usr/local/bin/eopenssl11)
69LIBRARIES += openssl11
70.endif
71
72CLEANFILES = *.tmp *.ciphers ciphers.mk
73
74.for clib in ${LIBRARIES}
75client-${clib}.ciphers:
76 LD_LIBRARY_PATH=/usr/local/lib/e${clib} \
77 ../${clib}/client -l ALL -L >$@.tmp
78 sed -n 's/^cipher //p' <$@.tmp | sort -u >$@
79 rm $@.tmp
80.endfor
81.for slib in ${LIBRARIES}
82server-${slib}.ciphers: 127.0.0.1.crt dsa.crt ec.crt rsa.crt
83 LD_LIBRARY_PATH=/usr/local/lib/e${slib} \
84 ../${slib}/server -l ALL -L >$@.tmp
85 sed -n 's/^cipher //p' <$@.tmp | sort -u >$@
86 rm $@.tmp
87.endfor
88
89.for clib in ${LIBRARIES}
90.for slib in ${LIBRARIES}
91ciphers.mk: client-${clib}-server-${slib}.ciphers
92client-${clib}-server-${slib}.ciphers: \
93 client-${clib}.ciphers server-${slib}.ciphers client-libressl.ciphers
94 # get ciphers shared between client and server
95 sort client-${clib}.ciphers server-${slib}.ciphers >$@.tmp
96 uniq -d <$@.tmp >$@
97 # we are only interested in cipers supported by libressl
98 sort $@ client-libressl.ciphers >$@.tmp
99 uniq -d <$@.tmp >$@
100 rm $@.tmp
101.endfor
102.endfor
103
104ciphers.mk:
105 rm -f $@ $@.tmp
106.for clib in ${LIBRARIES}
107.for slib in ${LIBRARIES}
108 echo 'CIPHERS_${clib}_${slib} =' >>$@.tmp \
109 `cat client-${clib}-server-${slib}.ciphers`
110.endfor
111.endfor
112 mv $@.tmp $@
113
114# hack to convert generated lists into usable make variables
115.if exists(ciphers.mk)
116.include "ciphers.mk"
117.else
118regress: ciphers.mk
119 ${MAKE} -C ${.CURDIR} regress
120.endif
121
122LEVEL_libressl =
123LEVEL_openssl =
124LEVEL_openssl11 = ,@SECLEVEL=0
125
126.for clib in ${LIBRARIES}
127.for slib in ${LIBRARIES}
128.for cipher in ${CIPHERS_${clib}_${slib}}
129
130.if "${cipher:M*-DSS-*}" != ""
131TYPE_${cipher} = dsa
132.elif "${cipher:M*-ECDSA-*}" != ""
133TYPE_${cipher} = ec
134.elif "${cipher:M*-GOST89-*}" != ""
135TYPE_${cipher} = gost
136.elif "${cipher:M*-RSA-*}" != ""
137TYPE_${cipher} = rsa
138.else
139TYPE_${cipher} = 127.0.0.1
140.endif
141
142.if "${slib}" == "openssl" && \
143 "${cipher:MADH-*}${cipher:MEDH-*}${cipher:MDHE-*}" != ""
144DHPARAM_${cipher}_${slib} = -p dh.param
145.else
146DHPARAM_${cipher}_${slib} =
147.endif
148
149REGRESS_TARGETS += run-cipher-${cipher}-client-${clib}-server-${slib}
150run-cipher-${cipher}-client-${clib}-server-${slib} \
151client-cipher-${cipher}-client-${clib}-server-${slib}.out \
152server-cipher-${cipher}-client-${clib}-server-${slib}.out: dh.param \
153 127.0.0.1.crt ${TYPE_${cipher}}.crt ../${clib}/client ../${slib}/server
154 @echo '\n======== $@ ========'
155 LD_LIBRARY_PATH=/usr/local/lib/e${slib} \
156 ../${slib}/server >${@:S/^run/server/}.out \
157 -c ${TYPE_${cipher}}.crt -k ${TYPE_${cipher}}.key \
158 -l ${cipher}${LEVEL_${slib}} ${DHPARAM_${cipher}_${slib}} \
159 127.0.0.1 0
160 LD_LIBRARY_PATH=/usr/local/lib/e${clib} \
161 ../${clib}/client >${@:S/^run/client/}.out \
162 -l ${cipher}${LEVEL_${clib}} \
163 `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out`
164 grep -q '^success$$' ${@:S/^run/server/}.out || \
165 { sleep 1; grep -q '^success$$' ${@:S/^run/server/}.out; }
166 grep -q '^success$$' ${@:S/^run/client/}.out
167
168REGRESS_TARGETS += check-cipher-${cipher}-client-${clib}-server-${slib}
169check-cipher-${cipher}-client-${clib}-server-${slib}: \
170 client-cipher-${cipher}-client-${clib}-server-${slib}.out \
171 server-cipher-${cipher}-client-${clib}-server-${slib}.out
172 @echo '\n======== $@ ========'
173 grep -q ' Cipher *: ${cipher}$$' ${@:S/^check/server/}.out
174 grep -q ' Cipher *: ${cipher}$$' ${@:S/^check/client/}.out
175
176.endfor
177.endfor
178.endfor
179
180.include <bsd.regress.mk>