summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-05 15:16:59 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-05-05 15:19:07 +0200
commita8b8641a2028689feebbb5d4d7d20447ad5ffa4d (patch)
tree483e97bb3f40c8132ebfe0a582485d4ad0b1b0a9
parentf8da1ca4eede4235bdf5ab290eb9e92cd73f7be1 (diff)
downloadlibtasn1-a8b8641a2028689feebbb5d4d7d20447ad5ffa4d.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.am1
-rw-r--r--tests/cert-invalid-time.derbin0 -> 1136 bytes
-rwxr-xr-xtests/decoding14
3 files changed, 15 insertions, 0 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
new file mode 100644
index 0000000..994ea3f
--- /dev/null
+++ b/tests/cert-invalid-time.der
Binary files differ
diff --git a/tests/decoding b/tests/decoding
index dd2c685..200a8b8 100755
--- a/tests/decoding
+++ b/tests/decoding
@@ -28,4 +28,18 @@ if test $? != 1;then
exit 1
fi
+# test decoding of certificate with invalid time field
+$VALGRIND $ASN1DECODING -s $ASN1PKIX 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 cert-invalid-time.der PKIX1.Certificate
+if test $? != 0;then
+ echo "Decoding with invalid time failed when not expected"
+ exit 1
+fi
+
exit 0