Nikos Mavrogiannopoulos | fda8ab9 | 2016-04-04 16:09:48 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright (C) 2016 Free Software Foundation, Inc. |
| 4 | # |
| 5 | # This program is free software: you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation, either version 3 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
Nikos Mavrogiannopoulos | 36b0a98 | 2016-04-05 15:50:00 +0200 | [diff] [blame] | 18 | srcdir="${srcdir:-.}" |
| 19 | |
Nikos Mavrogiannopoulos | fda8ab9 | 2016-04-04 16:09:48 +0200 | [diff] [blame] | 20 | if ! test -z "${VALGRIND}";then |
| 21 | VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=7 --leak-check=no" |
| 22 | fi |
| 23 | |
| 24 | ASN1DECODING="${ASN1DECODING:-../src/asn1Decoding$EXEEXT}" |
| 25 | ASN1PKIX="${ASN1PKIX:-pkix.asn}" |
| 26 | |
| 27 | # This tests an invalid input which caused an infinite recursion |
| 28 | # to certain libtasn1 versions. |
| 29 | |
Nikos Mavrogiannopoulos | 36b0a98 | 2016-04-05 15:50:00 +0200 | [diff] [blame] | 30 | for i in "${srcdir}/invalid-x509/"*.der;do |
Nikos Mavrogiannopoulos | 9ec2c56 | 2016-04-05 16:09:29 +0200 | [diff] [blame] | 31 | $VALGRIND $ASN1DECODING "$ASN1PKIX" "$i" PKIX1.Certificate >/dev/null 2>&1 |
Nikos Mavrogiannopoulos | b0d58b2 | 2016-04-08 14:03:28 +0200 | [diff] [blame^] | 32 | ret=$? |
| 33 | if test $ret != 1;then |
| 34 | echo "Decoding failed for $i" |
Nikos Mavrogiannopoulos | fda8ab9 | 2016-04-04 16:09:48 +0200 | [diff] [blame] | 35 | exit 1 |
| 36 | fi |
Nikos Mavrogiannopoulos | 36b0a98 | 2016-04-05 15:50:00 +0200 | [diff] [blame] | 37 | echo "$(basename $i): ok" |
| 38 | done |
Nikos Mavrogiannopoulos | fda8ab9 | 2016-04-04 16:09:48 +0200 | [diff] [blame] | 39 | |
| 40 | exit 0 |