diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-05-05 15:16:59 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-05-18 17:47:17 +0200 |
commit | 873d019405591b6903bd010164d8b8ced3b685fc (patch) | |
tree | ea559543dad24f4ef94bb4e9c8ab8073519f8272 | |
parent | 0c2971ec3f6392911b5114bba9dc17c284b2950d (diff) | |
download | libtasn1-873d019405591b6903bd010164d8b8ced3b685fc.tar.gz |
tests: check decoding with ASN1_DECODE_FLAG_ALLOW_INCORRECT_TIME flag
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/cert-invalid-time.der | bin | 0 -> 1136 bytes | |||
-rwxr-xr-x | tests/decoding | 18 |
3 files changed, 18 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index bea3310..0b45543 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,7 @@ LDADD = ../lib/libtasn1.la ../gl/libgnu.la EXTRA_DIST = Test_parser.asn Test_tree.asn Test_tree_asn1_tab.c mscat.asn \ Test_encoding.asn pkix.asn TestIndef.p12 choice.asn coding-decoding2.asn \ TestIndef2.p12 TestIndef3.der TestCertOctetOverflow.der \ + cert-invalid-time.der \ libtasn1.supp ocsp-basic-response.der spc_pe_image_data.der \ invalid-x509/id-000000.der invalid-x509/id-000001.der \ invalid-x509/id-000002.der invalid-x509/id-000003.der \ diff --git a/tests/cert-invalid-time.der b/tests/cert-invalid-time.der Binary files differnew file mode 100644 index 0000000..994ea3f --- /dev/null +++ b/tests/cert-invalid-time.der diff --git a/tests/decoding b/tests/decoding index dd2c685..6dccb1c 100755 --- a/tests/decoding +++ b/tests/decoding @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +srcdir="${srcdir:-.}" + if ! test -z "${VALGRIND}";then VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=7 --leak-check=no" fi @@ -22,10 +24,24 @@ fi ASN1DECODING="${ASN1DECODING:-../src/asn1Decoding$EXEEXT}" ASN1PKIX="${ASN1PKIX:-pkix.asn}" -$VALGRIND $ASN1DECODING $ASN1PKIX TestCertOctetOverflow.der PKIX1.Certificate +$VALGRIND $ASN1DECODING $ASN1PKIX ${srcdir}/TestCertOctetOverflow.der PKIX1.Certificate if test $? != 1;then echo "Decoding failed" exit 1 fi +# test decoding of certificate with invalid time field +$VALGRIND $ASN1DECODING -s $ASN1PKIX ${srcdir}/cert-invalid-time.der PKIX1.Certificate +if test $? != 1;then + echo "Decoding with invalid time succeeded when not expected" + exit 1 +fi + +# test decoding of certificate with invalid time field +$VALGRIND $ASN1DECODING -t $ASN1PKIX ${srcdir}/cert-invalid-time.der PKIX1.Certificate +if test $? != 0;then + echo "Decoding with invalid time failed when not expected" + exit 1 +fi + exit 0 |