diff options
Diffstat (limited to 'src/regress/lib/libcrypto/asn1')
| -rw-r--r-- | src/regress/lib/libcrypto/asn1/Makefile | 23 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1evp.c | 145 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1time.c | 428 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/asn1/rfc5280time.c | 384 |
4 files changed, 0 insertions, 980 deletions
diff --git a/src/regress/lib/libcrypto/asn1/Makefile b/src/regress/lib/libcrypto/asn1/Makefile deleted file mode 100644 index 2dae70e9e5..0000000000 --- a/src/regress/lib/libcrypto/asn1/Makefile +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.5 2018/08/31 17:35:21 tb Exp $ | ||
| 2 | |||
| 3 | TESTS = \ | ||
| 4 | asn1evp \ | ||
| 5 | asn1time \ | ||
| 6 | rfc5280time | ||
| 7 | |||
| 8 | PROGS = ${TESTS} | ||
| 9 | |||
| 10 | REGRESS_TARGETS= all_tests | ||
| 11 | |||
| 12 | LDADD= -lcrypto | ||
| 13 | DPADD= ${LIBCRYPTO} ${LIBSSL} | ||
| 14 | WARNINGS= Yes | ||
| 15 | LDFLAGS+= -lcrypto | ||
| 16 | CFLAGS+= -DLIBRESSL_INTERNAL -Wall -Wundef -Werror | ||
| 17 | |||
| 18 | all_tests: ${TESTS} | ||
| 19 | @for test in $>; do \ | ||
| 20 | ./$$test; \ | ||
| 21 | done | ||
| 22 | |||
| 23 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libcrypto/asn1/asn1evp.c b/src/regress/lib/libcrypto/asn1/asn1evp.c deleted file mode 100644 index d1870f9acc..0000000000 --- a/src/regress/lib/libcrypto/asn1/asn1evp.c +++ /dev/null | |||
| @@ -1,145 +0,0 @@ | |||
| 1 | /* $OpenBSD: asn1evp.c,v 1.2 2017/12/09 14:34:09 jsing Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <limits.h> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <string.h> | ||
| 21 | |||
| 22 | #include <openssl/asn1.h> | ||
| 23 | |||
| 24 | #define TEST_NUM 0x7fffffffL | ||
| 25 | |||
| 26 | unsigned char asn1_atios[] = { | ||
| 27 | 0x30, 0x10, 0x02, 0x04, 0x7f, 0xff, 0xff, 0xff, | ||
| 28 | 0x04, 0x08, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, | ||
| 29 | 0x06, 0x07, | ||
| 30 | }; | ||
| 31 | |||
| 32 | unsigned char test_octetstring[] = { | ||
| 33 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static void | ||
| 37 | hexdump(const unsigned char *buf, size_t len) | ||
| 38 | { | ||
| 39 | size_t i; | ||
| 40 | |||
| 41 | for (i = 1; i <= len; i++) | ||
| 42 | fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n"); | ||
| 43 | |||
| 44 | fprintf(stderr, "\n"); | ||
| 45 | } | ||
| 46 | |||
| 47 | static int | ||
| 48 | compare_data(const char *label, const unsigned char *d1, size_t d1_len, | ||
| 49 | const unsigned char *d2, size_t d2_len) | ||
| 50 | { | ||
| 51 | if (d1_len != d2_len) { | ||
| 52 | fprintf(stderr, "FAIL: got %s with length %zu, want %zu\n", | ||
| 53 | label, d1_len, d2_len); | ||
| 54 | return -1; | ||
| 55 | } | ||
| 56 | if (memcmp(d1, d2, d1_len) != 0) { | ||
| 57 | fprintf(stderr, "FAIL: %s differs\n", label); | ||
| 58 | fprintf(stderr, "got:\n"); | ||
| 59 | hexdump(d1, d1_len); | ||
| 60 | fprintf(stderr, "want:\n"); | ||
| 61 | hexdump(d2, d2_len); | ||
| 62 | return -1; | ||
| 63 | } | ||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | |||
| 67 | int | ||
| 68 | main(int argc, char **argv) | ||
| 69 | { | ||
| 70 | unsigned char data[16]; | ||
| 71 | long num = TEST_NUM; | ||
| 72 | int failed = 1; | ||
| 73 | ASN1_TYPE at; | ||
| 74 | int len; | ||
| 75 | |||
| 76 | memset(&at, 0, sizeof(at)); | ||
| 77 | |||
| 78 | if (!ASN1_TYPE_set_int_octetstring(&at, num, test_octetstring, | ||
| 79 | sizeof(test_octetstring))) { | ||
| 80 | fprintf(stderr, "FAIL: ASN1_TYPE_set_int_octetstring failed\n"); | ||
| 81 | goto done; | ||
| 82 | } | ||
| 83 | if (at.type != V_ASN1_SEQUENCE) { | ||
| 84 | fprintf(stderr, "FAIL: not a V_ASN1_SEQUENCE (%i != %i)\n", | ||
| 85 | at.type, V_ASN1_SEQUENCE); | ||
| 86 | goto done; | ||
| 87 | } | ||
| 88 | if (at.value.sequence->type != V_ASN1_OCTET_STRING) { | ||
| 89 | fprintf(stderr, "FAIL: not a V_ASN1_OCTET_STRING (%i != %i)\n", | ||
| 90 | at.type, V_ASN1_OCTET_STRING); | ||
| 91 | goto done; | ||
| 92 | } | ||
| 93 | if (compare_data("sequence", at.value.sequence->data, | ||
| 94 | at.value.sequence->length, asn1_atios, sizeof(asn1_atios)) == -1) | ||
| 95 | goto done; | ||
| 96 | |||
| 97 | memset(&data, 0, sizeof(data)); | ||
| 98 | num = 0; | ||
| 99 | |||
| 100 | if ((len = ASN1_TYPE_get_int_octetstring(&at, &num, data, | ||
| 101 | sizeof(data))) < 0) { | ||
| 102 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); | ||
| 103 | goto done; | ||
| 104 | } | ||
| 105 | if (num != TEST_NUM) { | ||
| 106 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); | ||
| 107 | goto done; | ||
| 108 | } | ||
| 109 | if (compare_data("octet string", data, len, | ||
| 110 | test_octetstring, sizeof(test_octetstring)) == -1) | ||
| 111 | goto done; | ||
| 112 | if (data[len] != 0) { | ||
| 113 | fprintf(stderr, "FAIL: octet string overflowed buffer\n"); | ||
| 114 | goto done; | ||
| 115 | } | ||
| 116 | |||
| 117 | memset(&data, 0, sizeof(data)); | ||
| 118 | num = 0; | ||
| 119 | |||
| 120 | /* With a limit buffer, the output should be truncated... */ | ||
| 121 | if ((len = ASN1_TYPE_get_int_octetstring(&at, &num, data, 4)) < 0) { | ||
| 122 | fprintf(stderr, "FAIL: ASN1_TYPE_get_int_octetstring failed\n"); | ||
| 123 | goto done; | ||
| 124 | } | ||
| 125 | if (num != TEST_NUM) { | ||
| 126 | fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); | ||
| 127 | goto done; | ||
| 128 | } | ||
| 129 | if (len != sizeof(test_octetstring)) { | ||
| 130 | fprintf(stderr, "FAIL: got length mismatch (%i != %zu)\n", | ||
| 131 | len, sizeof(test_octetstring)); | ||
| 132 | goto done; | ||
| 133 | } | ||
| 134 | if (compare_data("octet string", data, 4, test_octetstring, 4) == -1) | ||
| 135 | goto done; | ||
| 136 | if (data[4] != 0) { | ||
| 137 | fprintf(stderr, "FAIL: octet string overflowed buffer\n"); | ||
| 138 | goto done; | ||
| 139 | } | ||
| 140 | |||
| 141 | failed = 0; | ||
| 142 | |||
| 143 | done: | ||
| 144 | return failed; | ||
| 145 | } | ||
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c deleted file mode 100644 index 6a3921bd9c..0000000000 --- a/src/regress/lib/libcrypto/asn1/asn1time.c +++ /dev/null | |||
| @@ -1,428 +0,0 @@ | |||
| 1 | /* $OpenBSD: asn1time.c,v 1.8 2015/12/28 14:18:38 bcook Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/asn1.h> | ||
| 19 | |||
| 20 | #include <err.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <string.h> | ||
| 23 | |||
| 24 | struct asn1_time_test { | ||
| 25 | const char *str; | ||
| 26 | const char *data; | ||
| 27 | const unsigned char der[32]; | ||
| 28 | time_t time; | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct asn1_time_test asn1_invtime_tests[] = { | ||
| 32 | { | ||
| 33 | .str = "", | ||
| 34 | }, | ||
| 35 | { | ||
| 36 | .str = "2015", | ||
| 37 | }, | ||
| 38 | { | ||
| 39 | .str = "201509", | ||
| 40 | }, | ||
| 41 | { | ||
| 42 | .str = "20150923", | ||
| 43 | }, | ||
| 44 | { | ||
| 45 | .str = "20150923032700", | ||
| 46 | }, | ||
| 47 | { | ||
| 48 | .str = "20150923032700.Z", | ||
| 49 | }, | ||
| 50 | { | ||
| 51 | .str = "20150923032700.123", | ||
| 52 | }, | ||
| 53 | { | ||
| 54 | .str = "20150923032700+1.09", | ||
| 55 | }, | ||
| 56 | { | ||
| 57 | .str = "20150923032700+1100Z", | ||
| 58 | }, | ||
| 59 | { | ||
| 60 | .str = "20150923032700-11001", | ||
| 61 | }, | ||
| 62 | { | ||
| 63 | /* UTC time cannot have fractional seconds. */ | ||
| 64 | .str = "150923032700.123Z", | ||
| 65 | }, | ||
| 66 | { | ||
| 67 | .str = "aaaaaaaaaaaaaaZ", | ||
| 68 | }, | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct asn1_time_test asn1_gentime_tests[] = { | ||
| 72 | { | ||
| 73 | .str = "19700101000000Z", | ||
| 74 | .data = "19700101000000Z", | ||
| 75 | .time = 0, | ||
| 76 | .der = { | ||
| 77 | 0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, | ||
| 78 | 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, | ||
| 79 | 0x5a, | ||
| 80 | }, | ||
| 81 | }, | ||
| 82 | { | ||
| 83 | .str = "20150923032700Z", | ||
| 84 | .data = "20150923032700Z", | ||
| 85 | .time = 1442978820, | ||
| 86 | .der = { | ||
| 87 | 0x18, 0x0f, 0x32, 0x30, 0x31, 0x35, 0x30, 0x39, | ||
| 88 | 0x32, 0x33, 0x30, 0x33, 0x32, 0x37, 0x30, 0x30, | ||
| 89 | 0x5a, | ||
| 90 | }, | ||
| 91 | }, | ||
| 92 | }; | ||
| 93 | |||
| 94 | struct asn1_time_test asn1_utctime_tests[] = { | ||
| 95 | { | ||
| 96 | .str = "700101000000Z", | ||
| 97 | .data = "700101000000Z", | ||
| 98 | .time = 0, | ||
| 99 | .der = { | ||
| 100 | 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x31, | ||
| 101 | 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, | ||
| 102 | }, | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | .str = "150923032700Z", | ||
| 106 | .data = "150923032700Z", | ||
| 107 | .time = 1442978820, | ||
| 108 | .der = { | ||
| 109 | 0x17, 0x0d, 0x31, 0x35, 0x30, 0x39, 0x32, 0x33, | ||
| 110 | 0x30, 0x33, 0x32, 0x37, 0x30, 0x30, 0x5a, | ||
| 111 | }, | ||
| 112 | }, | ||
| 113 | { | ||
| 114 | .str = "140524144512Z", | ||
| 115 | .data = "140524144512Z", | ||
| 116 | .time = 1400942712, | ||
| 117 | .der = { | ||
| 118 | 0x17, 0x0d, 0x31, 0x34, 0x30, 0x35, 0x32, 0x34, | ||
| 119 | 0x31, 0x34, 0x34, 0x35, 0x31, 0x32, 0x5a, | ||
| 120 | }, | ||
| 121 | }, | ||
| 122 | { | ||
| 123 | .str = "240401144512Z", | ||
| 124 | .data = "240401144512Z", | ||
| 125 | .time = 1711982712, | ||
| 126 | .der = { | ||
| 127 | 0x17, 0x0d, 0x32, 0x34, 0x30, 0x34, 0x30, 0x31, | ||
| 128 | 0x31, 0x34, 0x34, 0x35, 0x31, 0x32, 0x5a | ||
| 129 | }, | ||
| 130 | }, | ||
| 131 | }; | ||
| 132 | |||
| 133 | #define N_INVTIME_TESTS \ | ||
| 134 | (sizeof(asn1_invtime_tests) / sizeof(*asn1_invtime_tests)) | ||
| 135 | #define N_GENTIME_TESTS \ | ||
| 136 | (sizeof(asn1_gentime_tests) / sizeof(*asn1_gentime_tests)) | ||
| 137 | #define N_UTCTIME_TESTS \ | ||
| 138 | (sizeof(asn1_utctime_tests) / sizeof(*asn1_utctime_tests)) | ||
| 139 | |||
| 140 | static void | ||
| 141 | hexdump(const unsigned char *buf, size_t len) | ||
| 142 | { | ||
| 143 | size_t i; | ||
| 144 | |||
| 145 | for (i = 1; i <= len; i++) | ||
| 146 | fprintf(stderr, " 0x%02hhx,%s", buf[i - 1], i % 8 ? "" : "\n"); | ||
| 147 | |||
| 148 | fprintf(stderr, "\n"); | ||
| 149 | } | ||
| 150 | |||
| 151 | static int | ||
| 152 | asn1_compare_bytes(int test_no, const unsigned char *d1, | ||
| 153 | const unsigned char *d2, int len1, int len2) | ||
| 154 | { | ||
| 155 | if (len1 != len2) { | ||
| 156 | fprintf(stderr, "FAIL: test %i - byte lengths differ " | ||
| 157 | "(%i != %i)\n", test_no, len1, len2); | ||
| 158 | return (1); | ||
| 159 | } | ||
| 160 | if (memcmp(d1, d2, len1) != 0) { | ||
| 161 | fprintf(stderr, "FAIL: test %i - bytes differ\n", test_no); | ||
| 162 | fprintf(stderr, "Got:\n"); | ||
| 163 | hexdump(d1, len1); | ||
| 164 | fprintf(stderr, "Want:\n"); | ||
| 165 | hexdump(d2, len2); | ||
| 166 | } | ||
| 167 | return (0); | ||
| 168 | } | ||
| 169 | |||
| 170 | static int | ||
| 171 | asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str) | ||
| 172 | { | ||
| 173 | int length = strlen(str); | ||
| 174 | |||
| 175 | if (asn1str->length != length) { | ||
| 176 | fprintf(stderr, "FAIL: test %i - string lengths differ " | ||
| 177 | "(%i != %i)\n", test_no, asn1str->length, length); | ||
| 178 | return (1); | ||
| 179 | } | ||
| 180 | if (strncmp(asn1str->data, str, length) != 0) { | ||
| 181 | fprintf(stderr, "FAIL: test %i - strings differ " | ||
| 182 | "('%s' != '%s')\n", test_no, asn1str->data, str); | ||
| 183 | return (1); | ||
| 184 | } | ||
| 185 | |||
| 186 | return (0); | ||
| 187 | } | ||
| 188 | |||
| 189 | static int | ||
| 190 | asn1_invtime_test(int test_no, struct asn1_time_test *att) | ||
| 191 | { | ||
| 192 | ASN1_GENERALIZEDTIME *gt = NULL; | ||
| 193 | ASN1_UTCTIME *ut = NULL; | ||
| 194 | ASN1_TIME *t = NULL; | ||
| 195 | int failure = 1; | ||
| 196 | |||
| 197 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) | ||
| 198 | goto done; | ||
| 199 | if ((ut = ASN1_UTCTIME_new()) == NULL) | ||
| 200 | goto done; | ||
| 201 | if ((t = ASN1_TIME_new()) == NULL) | ||
| 202 | goto done; | ||
| 203 | |||
| 204 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) { | ||
| 205 | fprintf(stderr, "FAIL: test %i - successfully set " | ||
| 206 | "GENERALIZEDTIME string '%s'\n", test_no, att->str); | ||
| 207 | goto done; | ||
| 208 | } | ||
| 209 | if (ASN1_UTCTIME_set_string(ut, att->str) != 0) { | ||
| 210 | fprintf(stderr, "FAIL: test %i - successfully set UTCTIME " | ||
| 211 | "string '%s'\n", test_no, att->str); | ||
| 212 | goto done; | ||
| 213 | } | ||
| 214 | if (ASN1_TIME_set_string(t, att->str) != 0) { | ||
| 215 | fprintf(stderr, "FAIL: test %i - successfully set TIME " | ||
| 216 | "string '%s'\n", test_no, att->str); | ||
| 217 | goto done; | ||
| 218 | } | ||
| 219 | |||
| 220 | failure = 0; | ||
| 221 | |||
| 222 | done: | ||
| 223 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 224 | ASN1_UTCTIME_free(ut); | ||
| 225 | ASN1_TIME_free(t); | ||
| 226 | |||
| 227 | return (failure); | ||
| 228 | } | ||
| 229 | |||
| 230 | static int | ||
| 231 | asn1_gentime_test(int test_no, struct asn1_time_test *att) | ||
| 232 | { | ||
| 233 | const unsigned char *der; | ||
| 234 | unsigned char *p = NULL; | ||
| 235 | ASN1_GENERALIZEDTIME *gt = NULL; | ||
| 236 | int failure = 1; | ||
| 237 | int len; | ||
| 238 | |||
| 239 | if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) { | ||
| 240 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 241 | test_no, att->str); | ||
| 242 | goto done; | ||
| 243 | } | ||
| 244 | |||
| 245 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) | ||
| 246 | goto done; | ||
| 247 | |||
| 248 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) { | ||
| 249 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 250 | test_no, att->str); | ||
| 251 | goto done; | ||
| 252 | } | ||
| 253 | if (asn1_compare_str(test_no, gt, att->str) != 0) | ||
| 254 | goto done; | ||
| 255 | |||
| 256 | if ((len = i2d_ASN1_GENERALIZEDTIME(gt, &p)) <= 0) { | ||
| 257 | fprintf(stderr, "FAIL: test %i - i2d_ASN1_GENERALIZEDTIME " | ||
| 258 | "failed\n", test_no); | ||
| 259 | goto done; | ||
| 260 | } | ||
| 261 | der = att->der; | ||
| 262 | if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0) | ||
| 263 | goto done; | ||
| 264 | |||
| 265 | len = strlen(att->der); | ||
| 266 | if (d2i_ASN1_GENERALIZEDTIME(>, &der, len) == NULL) { | ||
| 267 | fprintf(stderr, "FAIL: test %i - d2i_ASN1_GENERALIZEDTIME " | ||
| 268 | "failed\n", test_no); | ||
| 269 | goto done; | ||
| 270 | } | ||
| 271 | if (asn1_compare_str(test_no, gt, att->str) != 0) | ||
| 272 | goto done; | ||
| 273 | |||
| 274 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 275 | |||
| 276 | if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) { | ||
| 277 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | ||
| 278 | test_no, (long long)att->time); | ||
| 279 | goto done; | ||
| 280 | } | ||
| 281 | if (asn1_compare_str(test_no, gt, att->data) != 0) | ||
| 282 | goto done; | ||
| 283 | |||
| 284 | failure = 0; | ||
| 285 | |||
| 286 | done: | ||
| 287 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 288 | free(p); | ||
| 289 | |||
| 290 | return (failure); | ||
| 291 | } | ||
| 292 | |||
| 293 | static int | ||
| 294 | asn1_utctime_test(int test_no, struct asn1_time_test *att) | ||
| 295 | { | ||
| 296 | const unsigned char *der; | ||
| 297 | unsigned char *p = NULL; | ||
| 298 | ASN1_UTCTIME *ut = NULL; | ||
| 299 | int failure = 1; | ||
| 300 | int len; | ||
| 301 | |||
| 302 | if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) { | ||
| 303 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 304 | test_no, att->str); | ||
| 305 | goto done; | ||
| 306 | } | ||
| 307 | |||
| 308 | if ((ut = ASN1_UTCTIME_new()) == NULL) | ||
| 309 | goto done; | ||
| 310 | |||
| 311 | if (ASN1_UTCTIME_set_string(ut, att->str) != 1) { | ||
| 312 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 313 | test_no, att->str); | ||
| 314 | goto done; | ||
| 315 | } | ||
| 316 | if (asn1_compare_str(test_no, ut, att->str) != 0) | ||
| 317 | goto done; | ||
| 318 | |||
| 319 | if ((len = i2d_ASN1_UTCTIME(ut, &p)) <= 0) { | ||
| 320 | fprintf(stderr, "FAIL: test %i - i2d_ASN1_UTCTIME failed\n", | ||
| 321 | test_no); | ||
| 322 | goto done; | ||
| 323 | } | ||
| 324 | der = att->der; | ||
| 325 | if (asn1_compare_bytes(test_no, p, der, len, strlen(der)) != 0) | ||
| 326 | goto done; | ||
| 327 | |||
| 328 | len = strlen(att->der); | ||
| 329 | if (d2i_ASN1_UTCTIME(&ut, &der, len) == NULL) { | ||
| 330 | fprintf(stderr, "FAIL: test %i - d2i_ASN1_UTCTIME failed\n", | ||
| 331 | test_no); | ||
| 332 | goto done; | ||
| 333 | } | ||
| 334 | if (asn1_compare_str(test_no, ut, att->str) != 0) | ||
| 335 | goto done; | ||
| 336 | |||
| 337 | ASN1_UTCTIME_free(ut); | ||
| 338 | |||
| 339 | if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) { | ||
| 340 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | ||
| 341 | test_no, (long long)att->time); | ||
| 342 | goto done; | ||
| 343 | } | ||
| 344 | if (asn1_compare_str(test_no, ut, att->data) != 0) | ||
| 345 | goto done; | ||
| 346 | |||
| 347 | failure = 0; | ||
| 348 | |||
| 349 | done: | ||
| 350 | ASN1_UTCTIME_free(ut); | ||
| 351 | free(p); | ||
| 352 | |||
| 353 | return (failure); | ||
| 354 | } | ||
| 355 | |||
| 356 | static int | ||
| 357 | asn1_time_test(int test_no, struct asn1_time_test *att, int type) | ||
| 358 | { | ||
| 359 | ASN1_TIME *t = NULL; | ||
| 360 | int failure = 1; | ||
| 361 | |||
| 362 | if (ASN1_TIME_set_string(NULL, att->str) != 1) { | ||
| 363 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 364 | test_no, att->str); | ||
| 365 | goto done; | ||
| 366 | } | ||
| 367 | |||
| 368 | if ((t = ASN1_TIME_new()) == NULL) | ||
| 369 | goto done; | ||
| 370 | |||
| 371 | if (ASN1_TIME_set_string(t, att->str) != 1) { | ||
| 372 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 373 | test_no, att->str); | ||
| 374 | goto done; | ||
| 375 | } | ||
| 376 | |||
| 377 | if (t->type != type) { | ||
| 378 | fprintf(stderr, "FAIL: test %i - got type %i, want %i\n", | ||
| 379 | test_no, t->type, type); | ||
| 380 | goto done; | ||
| 381 | } | ||
| 382 | |||
| 383 | failure = 0; | ||
| 384 | |||
| 385 | done: | ||
| 386 | |||
| 387 | ASN1_TIME_free(t); | ||
| 388 | |||
| 389 | return (failure); | ||
| 390 | } | ||
| 391 | |||
| 392 | int | ||
| 393 | main(int argc, char **argv) | ||
| 394 | { | ||
| 395 | struct asn1_time_test *att; | ||
| 396 | int failed = 0; | ||
| 397 | size_t i; | ||
| 398 | |||
| 399 | fprintf(stderr, "Invalid time tests...\n"); | ||
| 400 | for (i = 0; i < N_INVTIME_TESTS; i++) { | ||
| 401 | att = &asn1_invtime_tests[i]; | ||
| 402 | failed |= asn1_invtime_test(i, att); | ||
| 403 | } | ||
| 404 | |||
| 405 | fprintf(stderr, "GENERALIZEDTIME tests...\n"); | ||
| 406 | for (i = 0; i < N_GENTIME_TESTS; i++) { | ||
| 407 | att = &asn1_gentime_tests[i]; | ||
| 408 | failed |= asn1_gentime_test(i, att); | ||
| 409 | } | ||
| 410 | |||
| 411 | fprintf(stderr, "UTCTIME tests...\n"); | ||
| 412 | for (i = 0; i < N_UTCTIME_TESTS; i++) { | ||
| 413 | att = &asn1_utctime_tests[i]; | ||
| 414 | failed |= asn1_utctime_test(i, att); | ||
| 415 | } | ||
| 416 | |||
| 417 | fprintf(stderr, "TIME tests...\n"); | ||
| 418 | for (i = 0; i < N_UTCTIME_TESTS; i++) { | ||
| 419 | att = &asn1_utctime_tests[i]; | ||
| 420 | failed |= asn1_time_test(i, att, V_ASN1_UTCTIME); | ||
| 421 | } | ||
| 422 | for (i = 0; i < N_GENTIME_TESTS; i++) { | ||
| 423 | att = &asn1_gentime_tests[i]; | ||
| 424 | failed |= asn1_time_test(i, att, V_ASN1_GENERALIZEDTIME); | ||
| 425 | } | ||
| 426 | |||
| 427 | return (failed); | ||
| 428 | } | ||
diff --git a/src/regress/lib/libcrypto/asn1/rfc5280time.c b/src/regress/lib/libcrypto/asn1/rfc5280time.c deleted file mode 100644 index 34e40439dc..0000000000 --- a/src/regress/lib/libcrypto/asn1/rfc5280time.c +++ /dev/null | |||
| @@ -1,384 +0,0 @@ | |||
| 1 | /* $OpenBSD: rfc5280time.c,v 1.4 2015/10/30 15:52:55 miod Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | ||
| 4 | * Copyright (c) 2015 Bob Beck <beck@opebsd.org> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <openssl/asn1.h> | ||
| 20 | #include <openssl/x509.h> | ||
| 21 | |||
| 22 | #include <err.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <string.h> | ||
| 25 | |||
| 26 | struct rfc5280_time_test { | ||
| 27 | const char *str; | ||
| 28 | const char *data; | ||
| 29 | time_t time; | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct rfc5280_time_test rfc5280_invtime_tests[] = { | ||
| 33 | { | ||
| 34 | .str = "", | ||
| 35 | }, | ||
| 36 | { | ||
| 37 | .str = "2015", | ||
| 38 | }, | ||
| 39 | { | ||
| 40 | .str = "201509", | ||
| 41 | }, | ||
| 42 | { | ||
| 43 | .str = "20150923", | ||
| 44 | }, | ||
| 45 | { | ||
| 46 | .str = "20150923032700", | ||
| 47 | }, | ||
| 48 | { | ||
| 49 | /* UTC time must have seconds */ | ||
| 50 | .str = "7001010000Z", | ||
| 51 | }, | ||
| 52 | { | ||
| 53 | .str = "201509230327Z", | ||
| 54 | }, | ||
| 55 | { | ||
| 56 | .str = "20150923032700.Z", | ||
| 57 | }, | ||
| 58 | { | ||
| 59 | .str = "20150923032700.123", | ||
| 60 | }, | ||
| 61 | { | ||
| 62 | .str = "20150923032700+1100Z", | ||
| 63 | }, | ||
| 64 | { | ||
| 65 | .str = "20150923032700-11001", | ||
| 66 | }, | ||
| 67 | { | ||
| 68 | /* UTC time cannot have fractional seconds. */ | ||
| 69 | .str = "150923032700.123Z", | ||
| 70 | }, | ||
| 71 | { | ||
| 72 | /* Gen time cannot have +- TZ. */ | ||
| 73 | .str = "20150923032712+1115", | ||
| 74 | }, | ||
| 75 | { | ||
| 76 | /* Gen time cannot have fractional seconds */ | ||
| 77 | .str = "20150923032712.123Z", | ||
| 78 | }, | ||
| 79 | { | ||
| 80 | .str = "aaaaaaaaaaaaaaZ", | ||
| 81 | }, | ||
| 82 | { | ||
| 83 | /* Must be a UTC time per RFC 5280 */ | ||
| 84 | .str = "19700101000000Z", | ||
| 85 | .data = "19700101000000Z", | ||
| 86 | .time = 0, | ||
| 87 | }, | ||
| 88 | { | ||
| 89 | /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */ | ||
| 90 | .str = "20150923032700Z", | ||
| 91 | .data = "20150923032700Z", | ||
| 92 | .time = 1442978820, | ||
| 93 | }, | ||
| 94 | { | ||
| 95 | /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */ | ||
| 96 | .str = "00000101000000Z", | ||
| 97 | .data = "00000101000000Z", | ||
| 98 | .time = -62167219200LL, | ||
| 99 | }, | ||
| 100 | { | ||
| 101 | /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */ | ||
| 102 | .str = "20491231235959Z", | ||
| 103 | .data = "20491231235959Z", | ||
| 104 | .time = 2524607999LL, | ||
| 105 | }, | ||
| 106 | { | ||
| 107 | /* (times before 2050 must be UTCTIME) Per RFC 5280 4.1.2.5 */ | ||
| 108 | .str = "19500101000000Z", | ||
| 109 | .data = "19500101000000Z", | ||
| 110 | .time = -631152000LL, | ||
| 111 | }, | ||
| 112 | }; | ||
| 113 | |||
| 114 | struct rfc5280_time_test rfc5280_gentime_tests[] = { | ||
| 115 | { | ||
| 116 | /* Biggest RFC 5280 time */ | ||
| 117 | .str = "99991231235959Z", | ||
| 118 | .data = "99991231235959Z", | ||
| 119 | .time = 253402300799LL, | ||
| 120 | }, | ||
| 121 | { | ||
| 122 | .str = "21600218104000Z", | ||
| 123 | .data = "21600218104000Z", | ||
| 124 | .time = 6000000000LL, | ||
| 125 | }, | ||
| 126 | { | ||
| 127 | /* Smallest RFC 5280 gen time */ | ||
| 128 | .str = "20500101000000Z", | ||
| 129 | .data = "20500101000000Z", | ||
| 130 | .time = 2524608000LL, | ||
| 131 | }, | ||
| 132 | }; | ||
| 133 | struct rfc5280_time_test rfc5280_utctime_tests[] = { | ||
| 134 | { | ||
| 135 | .str = "500101000000Z", | ||
| 136 | .data = "500101000000Z", | ||
| 137 | .time = -631152000, | ||
| 138 | }, | ||
| 139 | { | ||
| 140 | .str = "540226230640Z", | ||
| 141 | .data = "540226230640Z", | ||
| 142 | .time = -500000000, | ||
| 143 | }, | ||
| 144 | { | ||
| 145 | .str = "491231235959Z", | ||
| 146 | .data = "491231235959Z", | ||
| 147 | .time = 2524607999LL, | ||
| 148 | }, | ||
| 149 | { | ||
| 150 | .str = "700101000000Z", | ||
| 151 | .data = "700101000000Z", | ||
| 152 | .time = 0, | ||
| 153 | }, | ||
| 154 | { | ||
| 155 | .str = "150923032700Z", | ||
| 156 | .data = "150923032700Z", | ||
| 157 | .time = 1442978820, | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | .str = "150923102700Z", | ||
| 161 | .data = "150923102700Z", | ||
| 162 | .time = 1443004020, | ||
| 163 | }, | ||
| 164 | { | ||
| 165 | .str = "150922162712Z", | ||
| 166 | .data = "150922162712Z", | ||
| 167 | .time = 1442939232, | ||
| 168 | }, | ||
| 169 | { | ||
| 170 | .str = "140524144512Z", | ||
| 171 | .data = "140524144512Z", | ||
| 172 | .time = 1400942712, | ||
| 173 | }, | ||
| 174 | { | ||
| 175 | .str = "240401144512Z", | ||
| 176 | .data = "240401144512Z", | ||
| 177 | .time = 1711982712, | ||
| 178 | }, | ||
| 179 | }; | ||
| 180 | |||
| 181 | #define N_INVTIME_TESTS \ | ||
| 182 | (sizeof(rfc5280_invtime_tests) / sizeof(*rfc5280_invtime_tests)) | ||
| 183 | #define N_GENTIME_TESTS \ | ||
| 184 | (sizeof(rfc5280_gentime_tests) / sizeof(*rfc5280_gentime_tests)) | ||
| 185 | #define N_UTCTIME_TESTS \ | ||
| 186 | (sizeof(rfc5280_utctime_tests) / sizeof(*rfc5280_utctime_tests)) | ||
| 187 | |||
| 188 | static int | ||
| 189 | asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str) | ||
| 190 | { | ||
| 191 | int length = strlen(str); | ||
| 192 | |||
| 193 | if (asn1str->length != length) { | ||
| 194 | fprintf(stderr, "FAIL: test %i - string lengths differ " | ||
| 195 | "(%i != %i)\n", test_no, asn1str->length, length); | ||
| 196 | return (1); | ||
| 197 | } | ||
| 198 | if (strncmp(asn1str->data, str, length) != 0) { | ||
| 199 | fprintf(stderr, "FAIL: test %i - strings differ " | ||
| 200 | "('%s' != '%s')\n", test_no, asn1str->data, str); | ||
| 201 | return (1); | ||
| 202 | } | ||
| 203 | |||
| 204 | return (0); | ||
| 205 | } | ||
| 206 | |||
| 207 | static int | ||
| 208 | rfc5280_invtime_test(int test_no, struct rfc5280_time_test *att) | ||
| 209 | { | ||
| 210 | ASN1_GENERALIZEDTIME *gt = NULL; | ||
| 211 | ASN1_UTCTIME *ut = NULL; | ||
| 212 | ASN1_TIME *t = NULL; | ||
| 213 | int failure = 1; | ||
| 214 | time_t now = time(NULL); | ||
| 215 | |||
| 216 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) | ||
| 217 | goto done; | ||
| 218 | if ((ut = ASN1_UTCTIME_new()) == NULL) | ||
| 219 | goto done; | ||
| 220 | if ((t = ASN1_TIME_new()) == NULL) | ||
| 221 | goto done; | ||
| 222 | |||
| 223 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) { | ||
| 224 | if (X509_cmp_time(gt, &now) != 0) { | ||
| 225 | fprintf(stderr, "FAIL: test %i - successfully parsed as GENTIME " | ||
| 226 | "string '%s'\n", test_no, att->str); | ||
| 227 | goto done; | ||
| 228 | } | ||
| 229 | } | ||
| 230 | if (ASN1_UTCTIME_set_string(ut, att->str) != 0) { | ||
| 231 | if (X509_cmp_time(ut, &now) != 0) { | ||
| 232 | fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME " | ||
| 233 | "string '%s'\n", test_no, att->str); | ||
| 234 | goto done; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | if (ASN1_TIME_set_string(t, att->str) != 0) { | ||
| 238 | if (X509_cmp_time(t, &now) != 0) { | ||
| 239 | fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME " | ||
| 240 | "string '%s'\n", test_no, att->str); | ||
| 241 | goto done; | ||
| 242 | } | ||
| 243 | } | ||
| 244 | |||
| 245 | failure = 0; | ||
| 246 | |||
| 247 | done: | ||
| 248 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 249 | ASN1_UTCTIME_free(ut); | ||
| 250 | ASN1_TIME_free(t); | ||
| 251 | |||
| 252 | return (failure); | ||
| 253 | } | ||
| 254 | |||
| 255 | static int | ||
| 256 | rfc5280_gentime_test(int test_no, struct rfc5280_time_test *att) | ||
| 257 | { | ||
| 258 | unsigned char *p = NULL; | ||
| 259 | ASN1_GENERALIZEDTIME *gt; | ||
| 260 | int failure = 1; | ||
| 261 | int i; | ||
| 262 | |||
| 263 | if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL) | ||
| 264 | goto done; | ||
| 265 | |||
| 266 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) { | ||
| 267 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 268 | test_no, att->str); | ||
| 269 | goto done; | ||
| 270 | } | ||
| 271 | if (asn1_compare_str(test_no, gt, att->str) != 0) | ||
| 272 | goto done; | ||
| 273 | |||
| 274 | if ((i = X509_cmp_time(gt, &att->time)) != -1) { | ||
| 275 | fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n", | ||
| 276 | test_no, i, att->time); | ||
| 277 | goto done; | ||
| 278 | } | ||
| 279 | |||
| 280 | att->time--; | ||
| 281 | if ((i = X509_cmp_time(gt, &att->time)) != 1) { | ||
| 282 | fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n", | ||
| 283 | test_no, i, att->time); | ||
| 284 | goto done; | ||
| 285 | } | ||
| 286 | att->time++; | ||
| 287 | |||
| 288 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 289 | |||
| 290 | if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) { | ||
| 291 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | ||
| 292 | test_no, (long long)att->time); | ||
| 293 | goto done; | ||
| 294 | } | ||
| 295 | if (asn1_compare_str(test_no, gt, att->data) != 0) | ||
| 296 | goto done; | ||
| 297 | |||
| 298 | failure = 0; | ||
| 299 | |||
| 300 | done: | ||
| 301 | ASN1_GENERALIZEDTIME_free(gt); | ||
| 302 | free(p); | ||
| 303 | |||
| 304 | return (failure); | ||
| 305 | } | ||
| 306 | |||
| 307 | static int | ||
| 308 | rfc5280_utctime_test(int test_no, struct rfc5280_time_test *att) | ||
| 309 | { | ||
| 310 | unsigned char *p = NULL; | ||
| 311 | ASN1_UTCTIME *ut; | ||
| 312 | int failure = 1; | ||
| 313 | int i; | ||
| 314 | |||
| 315 | if ((ut = ASN1_UTCTIME_new()) == NULL) | ||
| 316 | goto done; | ||
| 317 | |||
| 318 | if (ASN1_UTCTIME_set_string(ut, att->str) != 1) { | ||
| 319 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | ||
| 320 | test_no, att->str); | ||
| 321 | goto done; | ||
| 322 | } | ||
| 323 | if (asn1_compare_str(test_no, ut, att->str) != 0) | ||
| 324 | goto done; | ||
| 325 | |||
| 326 | if ((i = X509_cmp_time(ut, &att->time)) != -1) { | ||
| 327 | fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n", | ||
| 328 | test_no, i, att->time); | ||
| 329 | goto done; | ||
| 330 | } | ||
| 331 | |||
| 332 | att->time--; | ||
| 333 | if ((i = X509_cmp_time(ut, &att->time)) != 1) { | ||
| 334 | fprintf(stderr, "FAIL: test %i - X509_cmp_time failed - returned %d compared to %lld\n", | ||
| 335 | test_no, i, att->time); | ||
| 336 | goto done; | ||
| 337 | } | ||
| 338 | att->time++; | ||
| 339 | |||
| 340 | ASN1_UTCTIME_free(ut); | ||
| 341 | |||
| 342 | if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) { | ||
| 343 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | ||
| 344 | test_no, (long long)att->time); | ||
| 345 | goto done; | ||
| 346 | } | ||
| 347 | if (asn1_compare_str(test_no, ut, att->data) != 0) | ||
| 348 | goto done; | ||
| 349 | |||
| 350 | failure = 0; | ||
| 351 | |||
| 352 | done: | ||
| 353 | ASN1_UTCTIME_free(ut); | ||
| 354 | free(p); | ||
| 355 | |||
| 356 | return (failure); | ||
| 357 | } | ||
| 358 | |||
| 359 | int | ||
| 360 | main(int argc, char **argv) | ||
| 361 | { | ||
| 362 | struct rfc5280_time_test *att; | ||
| 363 | int failed = 0; | ||
| 364 | size_t i; | ||
| 365 | |||
| 366 | fprintf(stderr, "RFC5280 Invalid time tests...\n"); | ||
| 367 | for (i = 0; i < N_INVTIME_TESTS; i++) { | ||
| 368 | att = &rfc5280_invtime_tests[i]; | ||
| 369 | failed |= rfc5280_invtime_test(i, att); | ||
| 370 | } | ||
| 371 | |||
| 372 | fprintf(stderr, "RFC5280 GENERALIZEDTIME tests...\n"); | ||
| 373 | for (i = 0; i < N_GENTIME_TESTS; i++) { | ||
| 374 | att = &rfc5280_gentime_tests[i]; | ||
| 375 | failed |= rfc5280_gentime_test(i, att); | ||
| 376 | } | ||
| 377 | |||
| 378 | fprintf(stderr, "RFC5280 UTCTIME tests...\n"); | ||
| 379 | for (i = 0; i < N_UTCTIME_TESTS; i++) { | ||
| 380 | att = &rfc5280_utctime_tests[i]; | ||
| 381 | failed |= rfc5280_utctime_test(i, att); | ||
| 382 | } | ||
| 383 | return (failed); | ||
| 384 | } | ||
