Fix CVE-2017-6891 in minitasn1 code
[platform/upstream/gnutls.git] / tests / cert-tests / invalid-sig
1 #!/bin/sh
2
3 # Copyright (C) 2015 Nikos Mavrogiannopoulos
4 #
5 # Author: Nikos Mavrogiannopoulos
6 #
7 # This file is part of GnuTLS.
8 #
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.
13 #
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.
18 #
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.
22
23 #set -e
24
25 srcdir=${srcdir:-.}
26 CERTTOOL=${CERTTOOL:-../../src/certtool$EXEEXT}
27 DIFF=${DIFF:-diff}
28 if ! test -z "${VALGRIND}";then
29 VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
30 fi
31
32 #check whether a different tbsCertificate than the outer signature algorithm is tolerated
33 $VALGRIND $CERTTOOL -e --infile $srcdir/invalid-sig2.pem
34 rc=$?
35
36 # We're done.
37 if test "$rc" = "0"; then
38   echo "Verification of invalid signature (2) failed"
39   exit $rc
40 fi
41
42 #check whether a different tbsCertificate than the outer signature algorithm is tolerated
43 $VALGRIND $CERTTOOL -e --infile $srcdir/invalid-sig3.pem
44 rc=$?
45
46 # We're done.
47 if test "$rc" = "0"; then
48   echo "Verification of invalid signature (3) failed"
49   exit $rc
50 fi
51
52 exit 0