Added missing elf part.
[gnutls.git] / tests / dsa / testdsa
blob64a4b76ba4fe3449f80cf82eed4d7d4ff75a4a75
1 #!/bin/sh
3 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos
7 # This file is part of GnuTLS.
9 # GnuTLS is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the
11 # Free Software Foundation; either version 3 of the License, or (at
12 # your option) any later version.
14 # GnuTLS is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GnuTLS; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 srcdir="${srcdir:-.}"
24 SERV="${SERV:-../../src/gnutls-serv} -q"
25 CLI="${CLI:-../../src/gnutls-cli}"
26 PORT="${PORT:-5559}"
27 DEBUG=""
28 unset RETCODE
30 if test "${WINDIR}" != "";then
31 exit 77
32 fi
34 . $srcdir/../scripts/common.sh
36 echo "Checking various DSA key sizes"
38 # DSA 1024 + TLS 1.0
40 echo "Checking DSA-1024 with TLS 1.0"
42 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
43 wait_server $PID
45 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
46 fail $PID "Failed connection to a server with DSA 1024 key and TLS 1.0!"
48 echo "Checking server DSA-1024 with client DSA-1024 and TLS 1.0"
50 #try with client key of 1024 bits (should succeed)
51 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem </dev/null >/dev/null || \
52 fail $PID "Failed connection to a server with DSA 1024 key and TLS 1.0!"
54 echo "Checking server DSA-1024 with client DSA-2048 and TLS 1.0"
56 #try with client key of 2048 bits (should fail)
57 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem </dev/null >/dev/null 2>&1 && \
58 fail $PID "Succeeded connection to a server with a client DSA 2048 key and TLS 1.0!"
60 echo "Checking server DSA-1024 with client DSA-3072 and TLS 1.0"
62 #try with client key of 3072 bits (should fail)
63 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem </dev/null >/dev/null 2>&1 && \
64 fail $PID "Succeeded connection to a server with a client DSA 3072 key and TLS 1.0!"
66 kill $PID
67 wait
69 # DSA 1024 + TLS 1.2
71 echo "Checking DSA-1024 with TLS 1.2"
73 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
74 wait_server $PID
76 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
77 fail $PID "Failed connection to a server with DSA 1024 key and TLS 1.2!"
79 echo "Checking server DSA-1024 with client DSA-1024 and TLS 1.2"
81 #try with client key of 1024 bits (should succeed)
82 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem </dev/null >/dev/null || \
83 fail $PID "Failed connection to a server with DSA 1024 key and TLS 1.2!"
85 echo "Checking server DSA-1024 with client DSA-2048 and TLS 1.2"
87 #try with client key of 2048 bits (should succeed)
88 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem </dev/null >/dev/null || \
89 fail $PID "Failed connection to a server with a client DSA 2048 key and TLS 1.2!"
91 echo "Checking server DSA-1024 with client DSA-3072 and TLS 1.2"
93 #try with client key of 3072 bits (should succeed)
94 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem </dev/null >/dev/null || \
95 fail $PID "Failed connection to a server with a client DSA 3072 key and TLS 1.2!"
98 kill $PID
99 wait
101 # DSA 2048 + TLS 1.0
103 echo "Checking DSA-2048 with TLS 1.0"
105 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
106 wait_server $PID
108 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
109 fail $PID "Succeeded connection to a server with DSA 2048 key and TLS 1.0. Should have failed!"
111 kill $PID
112 wait
114 # DSA 2048 + TLS 1.2
116 echo "Checking DSA-2048 with TLS 1.2"
118 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
119 wait_server $PID
121 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
122 fail $PID "Failed connection to a server with DSA 2048 key and TLS 1.2!"
124 kill $PID
125 wait
127 # DSA 3072 + TLS 1.0
129 echo "Checking DSA-3072 with TLS 1.0"
131 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
132 wait_server $PID
134 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
135 fail $PID "Succeeded connection to a server with DSA 3072 key and TLS 1.0. Should have failed!"
137 kill $PID
138 wait
140 # DSA 3072 + TLS 1.2
142 echo "Checking DSA-3072 with TLS 1.2"
144 launch_server $$ --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
145 wait_server $PID
147 $CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
148 fail $PID "Failed connection to a server with DSA 3072 key and TLS 1.2!"
150 kill $PID
151 wait
153 exit 0