blob: cc98b91fb315f8058aeb099a36e70ab72f8d73ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#!/bin/sh
# Copyright (C) 2017 Nikos Mavrogiannopoulos
#
# Author: Nikos Mavrogiannopoulos
#
# This file is part of GnuTLS.
#
# GnuTLS is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GnuTLS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>
: ${srcdir=.}
: ${SERV=../src/gnutls-serv${EXEEXT}}
: ${CLI=../src/gnutls-cli${EXEEXT}}
unset RETCODE
if ! test -x "${SERV}"; then
exit 77
fi
if ! test -x "${CLI}"; then
exit 77
fi
if test "${WINDIR}" != ""; then
exit 77
fi
if ! test -z "${VALGRIND}"; then
VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=15"
fi
SERV="${SERV} -q"
. "${srcdir}/scripts/common.sh"
KEY1=${srcdir}/../doc/credentials/x509/key-rsa.pem
CERT1=${srcdir}/../doc/credentials/x509/cert-rsa.pem
CA1=${srcdir}/../doc/credentials/x509/ca.pem
ALLOWED_PARAMS="
rfc3526-group-14-2048
rfc3526-group-15-3072
rfc3526-group-16-4096
rfc3526-group-17-6144
rfc3526-group-18-8192
rfc7919-ffdhe2048
rfc7919-ffdhe3072
rfc7919-ffdhe4096
rfc7919-ffdhe6144
rfc7919-ffdhe8192
"
DISALLOWED_PARAMS="
rfc2409-group-2-1024
rfc3526-group-5-1536
rfc5054-1024
rfc5054-1536
rfc5054-2048
rfc5054-3072
rfc5054-4096
rfc5054-6144
rfc5054-8192
rfc5114-group-22-1024
rfc5114-group-23-2048
rfc5114-group-24-2048
"
OPTS="--priority=NORMAL:-VERS-ALL:+VERS-TLS1.2:-KX-ALL:+DHE-RSA:+AES-128-GCM:-GROUP-ALL"
for params in $ALLOWED_PARAMS; do
echo "Checking with approved DH params: $params"
PARAMS=${srcdir}/../doc/credentials/dhparams/${params}.pem
eval "${GETPORT}"
launch_server ${OPTS} --x509keyfile ${KEY1} --x509certfile ${CERT1} --dhparams ${PARAMS}
PID=$!
wait_server ${PID}
${VALGRIND} "${CLI}" ${OPTS} -p "${PORT}" 127.0.0.1 --verify-hostname=localhost --x509cafile ${CA1} </dev/null >/dev/null || \
fail ${PID} "handshake should have succeeded!"
kill ${PID}
wait
done
for params in $DISALLOWED_PARAMS; do
echo "Checking with non-approved DH params: $params"
PARAMS=${srcdir}/../doc/credentials/dhparams/${params}.pem
eval "${GETPORT}"
launch_server ${OPTS} --x509keyfile ${KEY1} --x509certfile ${CERT1} --dhparams ${PARAMS}
PID=$!
wait_server ${PID}
${VALGRIND} "${CLI}" ${OPTS} -p "${PORT}" 127.0.0.1 --verify-hostname=localhost --x509cafile ${CA1} </dev/null >/dev/null
RET=$?
if test $RET -eq 0; then
if test "${GNUTLS_FORCE_FIPS_MODE}" = 1; then
fail ${PID} "handshake should have failed (FIPS mode 1)!"
fi
else
if test "${GNUTLS_FORCE_FIPS_MODE}" != 1; then
fail ${PID} "handshake should have succeeded (FIPS mode 0)!"
fi
fi
kill ${PID}
wait
done
exit 0
|