add valid utc time that should fail to parse as generalized
authorbeck <beck@openbsd.org>
Thu, 30 Jun 2022 08:41:01 +0000 (08:41 +0000)
committerbeck <beck@openbsd.org>
Thu, 30 Jun 2022 08:41:01 +0000 (08:41 +0000)
regress/lib/libcrypto/asn1/asn1time.c

index 2bcf3d6..ca54087 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: asn1time.c,v 1.11 2022/06/30 08:32:26 beck Exp $ */
+/* $OpenBSD: asn1time.c,v 1.12 2022/06/30 08:41:01 beck Exp $ */
 /*
  * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
  *
@@ -77,6 +77,10 @@ struct asn1_time_test asn1_invgentime_tests[] = {
        {
                .str = "201612081934Z",
        },
+       /* Valid UTC time, should fail as a generalized time */
+       {
+               .str = "160908234300Z",
+       },
 };
 
 struct asn1_time_test asn1_goodtime_tests[] = {
@@ -473,7 +477,7 @@ main(int argc, char **argv)
        fprintf(stderr, "Invalid generalized time tests...\n");
        for (i = 0; i < N_INVGENTIME_TESTS; i++) {
                att = &asn1_invgentime_tests[i];
-               failed |= asn1_invtime_test(i, att, 0);
+               failed |= asn1_invtime_test(i, att, 1);
        }
 
        fprintf(stderr, "GENERALIZEDTIME tests...\n");