]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/testssl
Trying cherrypick:
[thirdparty/openssl.git] / test / testssl
CommitLineData
d02b48c6
RE
1#!/bin/sh
2
65b002f3
BM
3if [ "$1" = "" ]; then
4 key=../apps/server.pem
5else
6 key="$1"
7fi
8if [ "$2" = "" ]; then
9 cert=../apps/server.pem
10else
11 cert="$2"
12fi
62d27939 13ssltest="../util/shlib_wrap.sh ./ssltest -key $key -cert $cert -c_key $key -c_cert $cert"
65b002f3 14
62d27939 15if ../util/shlib_wrap.sh ../apps/openssl x509 -in $cert -text -noout | fgrep 'DSA Public Key' >/dev/null; then
65b002f3
BM
16 dsa_cert=YES
17else
18 dsa_cert=NO
19fi
20
21if [ "$3" = "" ]; then
22 CA="-CApath ../certs"
23else
24 CA="-CAfile $3"
25fi
26
23f80f46
RL
27if [ "$4" = "" ]; then
28 extra=""
29else
30 extra="$4"
31fi
32
e27711cf
T
33serverinfo="./serverinfo.pem"
34
65b002f3
BM
35#############################################################################
36
d02b48c6 37echo test sslv2
23f80f46 38$ssltest -ssl2 $extra || exit 1
d02b48c6
RE
39
40echo test sslv2 with server authentication
23f80f46 41$ssltest -ssl2 -server_auth $CA $extra || exit 1
d02b48c6 42
65b002f3
BM
43if [ $dsa_cert = NO ]; then
44 echo test sslv2 with client authentication
23f80f46 45 $ssltest -ssl2 -client_auth $CA $extra || exit 1
d02b48c6 46
65b002f3 47 echo test sslv2 with both client and server authentication
23f80f46 48 $ssltest -ssl2 -server_auth -client_auth $CA $extra || exit 1
65b002f3 49fi
d02b48c6
RE
50
51echo test sslv3
23f80f46 52$ssltest -ssl3 $extra || exit 1
d02b48c6
RE
53
54echo test sslv3 with server authentication
23f80f46 55$ssltest -ssl3 -server_auth $CA $extra || exit 1
d02b48c6
RE
56
57echo test sslv3 with client authentication
23f80f46 58$ssltest -ssl3 -client_auth $CA $extra || exit 1
d02b48c6
RE
59
60echo test sslv3 with both client and server authentication
23f80f46 61$ssltest -ssl3 -server_auth -client_auth $CA $extra || exit 1
d02b48c6
RE
62
63echo test sslv2/sslv3
23f80f46 64$ssltest $extra || exit 1
d02b48c6
RE
65
66echo test sslv2/sslv3 with server authentication
23f80f46 67$ssltest -server_auth $CA $extra || exit 1
d02b48c6
RE
68
69echo test sslv2/sslv3 with client authentication
23f80f46 70$ssltest -client_auth $CA $extra || exit 1
d02b48c6
RE
71
72echo test sslv2/sslv3 with both client and server authentication
23f80f46 73$ssltest -server_auth -client_auth $CA $extra || exit 1
d02b48c6 74
95d29597 75echo test sslv2 via BIO pair
23f80f46 76$ssltest -bio_pair -ssl2 $extra || exit 1
95d29597
BM
77
78echo test sslv2 with server authentication via BIO pair
23f80f46 79$ssltest -bio_pair -ssl2 -server_auth $CA $extra || exit 1
95d29597 80
65b002f3
BM
81if [ $dsa_cert = NO ]; then
82 echo test sslv2 with client authentication via BIO pair
23f80f46 83 $ssltest -bio_pair -ssl2 -client_auth $CA $extra || exit 1
95d29597 84
65b002f3 85 echo test sslv2 with both client and server authentication via BIO pair
23f80f46 86 $ssltest -bio_pair -ssl2 -server_auth -client_auth $CA $extra || exit 1
65b002f3 87fi
95d29597
BM
88
89echo test sslv3 via BIO pair
23f80f46 90$ssltest -bio_pair -ssl3 $extra || exit 1
95d29597
BM
91
92echo test sslv3 with server authentication via BIO pair
23f80f46 93$ssltest -bio_pair -ssl3 -server_auth $CA $extra || exit 1
95d29597
BM
94
95echo test sslv3 with client authentication via BIO pair
23f80f46 96$ssltest -bio_pair -ssl3 -client_auth $CA $extra || exit 1
95d29597
BM
97
98echo test sslv3 with both client and server authentication via BIO pair
23f80f46 99$ssltest -bio_pair -ssl3 -server_auth -client_auth $CA $extra || exit 1
d02b48c6 100
95d29597 101echo test sslv2/sslv3 via BIO pair
23f80f46 102$ssltest $extra || exit 1
95d29597 103
65b002f3 104if [ $dsa_cert = NO ]; then
f30258c4
BM
105 echo 'test sslv2/sslv3 w/o (EC)DHE via BIO pair'
106 $ssltest -bio_pair -no_dhe -no_ecdhe $extra || exit 1
65b002f3 107fi
77fa04a9 108
563f1503 109echo test sslv2/sslv3 with 1024bit DHE via BIO pair
23f80f46 110$ssltest -bio_pair -dhe1024dsa -v $extra || exit 1
a87030a1 111
95d29597 112echo test sslv2/sslv3 with server authentication
23f80f46 113$ssltest -bio_pair -server_auth $CA $extra || exit 1
95d29597
BM
114
115echo test sslv2/sslv3 with client authentication via BIO pair
23f80f46 116$ssltest -bio_pair -client_auth $CA $extra || exit 1
95d29597
BM
117
118echo test sslv2/sslv3 with both client and server authentication via BIO pair
23f80f46 119$ssltest -bio_pair -server_auth -client_auth $CA $extra || exit 1
65b002f3 120
023ec151
BM
121echo test sslv2/sslv3 with both client and server authentication via BIO pair and app verify
122$ssltest -bio_pair -server_auth -client_auth -app_verify $CA $extra || exit 1
123
0462eedf
AL
124echo "Testing ciphersuites"
125for protocol in TLSv1.2 SSLv3; do
126 echo "Testing ciphersuites for $protocol"
127 for cipher in `../util/shlib_wrap.sh ../apps/openssl ciphers "RSA+$protocol" | tr ':' ' '`; do
128 echo "Testing $cipher"
129 prot=""
130 if [ $protocol = "SSLv3" ] ; then
131 prot="-ssl3"
132 fi
133 $ssltest -cipher $cipher $prot
134 if [ $? -ne 0 ] ; then
135 echo "Failed $cipher"
136 exit 1
137 fi
138 done
139done
140
65b002f3
BM
141#############################################################################
142
62d27939 143if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
0d3f2ccb
RL
144 echo skipping anonymous DH tests
145else
146 echo test tls1 with 1024bit anonymous DH, multiple handshakes
147 $ssltest -v -bio_pair -tls1 -cipher ADH -dhe1024dsa -num 10 -f -time $extra || exit 1
148fi
d58d6c27 149
62d27939 150if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then
46c4647e
BM
151 echo skipping RSA tests
152else
f30258c4
BM
153 echo 'test tls1 with 1024bit RSA, no (EC)DHE, multiple handshakes'
154 ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -no_dhe -no_ecdhe -num 10 -f -time $extra || exit 1
95d29597 155
62d27939 156 if ../util/shlib_wrap.sh ../apps/openssl no-dh; then
0d3f2ccb
RL
157 echo skipping RSA+DHE tests
158 else
159 echo test tls1 with 1024bit RSA, 1024bit DHE, multiple handshakes
62d27939 160 ../util/shlib_wrap.sh ./ssltest -v -bio_pair -tls1 -cert ../apps/server2.pem -dhe1024dsa -num 10 -f -time $extra || exit 1
0d3f2ccb 161 fi
65b002f3 162fi
563f1503 163
efebb108
BM
164echo test tls1 with PSK
165$ssltest -tls1 -cipher PSK -psk abc123 $extra || exit 1
ddac1974
NL
166
167echo test tls1 with PSK via BIO pair
168$ssltest -bio_pair -tls1 -cipher PSK -psk abc123 $extra || exit 1
169
e27711cf
T
170#############################################################################
171# Custom Extension tests
172
173echo test tls1 with custom extensions
174$ssltest -bio_pair -tls1 -custom_ext || exit 1
175
176#############################################################################
177# Serverinfo tests
178
179echo test tls1 with serverinfo
180$ssltest -bio_pair -tls1 -serverinfo_file $serverinfo || exit 1
181$ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct || exit 1
182$ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_tack || exit 1
183$ssltest -bio_pair -tls1 -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
184$ssltest -bio_pair -tls1 -custom_ext -serverinfo_file $serverinfo -serverinfo_sct -serverinfo_tack || exit 1
185
186
a149b246
BL
187if ../util/shlib_wrap.sh ../apps/openssl no-srp; then
188 echo skipping SRP tests
189else
190 echo test tls1 with SRP
191 $ssltest -tls1 -cipher SRP -srpuser test -srppass abc123
192
193 echo test tls1 with SRP via BIO pair
194 $ssltest -bio_pair -tls1 -cipher SRP -srpuser test -srppass abc123
195fi
196
95d29597 197exit 0