|
Packit Service |
4684c1 |
#!/bin/sh
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# Copyright (C) 2015 Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# Author: Nikos Mavrogiannopoulos
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# This file is part of GnuTLS.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# GnuTLS is free software; you can redistribute it and/or modify it
|
|
Packit Service |
4684c1 |
# under the terms of the GNU General Public License as published by the
|
|
Packit Service |
4684c1 |
# Free Software Foundation; either version 3 of the License, or (at
|
|
Packit Service |
4684c1 |
# your option) any later version.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# GnuTLS is distributed in the hope that it will be useful, but
|
|
Packit Service |
4684c1 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
4684c1 |
# General Public License for more details.
|
|
Packit Service |
4684c1 |
#
|
|
Packit Service |
4684c1 |
# You should have received a copy of the GNU General Public License
|
|
Packit Service |
4684c1 |
# along with GnuTLS; if not, write to the Free Software Foundation,
|
|
Packit Service |
4684c1 |
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#set -e
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
srcdir="${srcdir:-.}"
|
|
Packit Service |
4684c1 |
CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
|
|
Packit Service |
4684c1 |
DIFF="${DIFF:-diff}"
|
|
Packit Service |
4684c1 |
if ! test -z "${VALGRIND}"; then
|
|
Packit Service |
4684c1 |
VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND}"
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if ! test -x "${CERTTOOL}"; then
|
|
Packit Service |
4684c1 |
exit 77
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#check whether a different PKCS #1 signature than the advertized in certificate is tolerated
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" -e --infile "${srcdir}/data/invalid-sig.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" = "0"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (1) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#check whether a different tbsCertificate than the outer signature algorithm is tolerated
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" -e --infile "${srcdir}/data/invalid-sig2.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" = "0"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (2) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#check whether a different tbsCertificate than the outer signature algorithm is tolerated
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" -e --infile "${srcdir}/data/invalid-sig3.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" = "0"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (3) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#check whether different parameters in tbsCertificate than the outer signature is tolerated
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" -e --infile "${srcdir}/data/invalid-sig4.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" = "0"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (4) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#check whether different RSA-PSS parameters in tbsCertificate than the outer signature is tolerated
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" --verify-chain --infile "${srcdir}/data/invalid-sig5.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" = "0"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (5) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#this was causing a double free; verify that we receive the expected error code
|
|
Packit Service |
4684c1 |
${VALGRIND} "${CERTTOOL}" --verify-chain --infile "${srcdir}/data/cve-2019-3829.pem"
|
|
Packit Service |
4684c1 |
rc=$?
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# We're done.
|
|
Packit Service |
4684c1 |
if test "${rc}" != "1"; then
|
|
Packit Service |
4684c1 |
echo "Verification of invalid signature (6) failed"
|
|
Packit Service |
4684c1 |
exit ${rc}
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
exit 0
|