diff options
Diffstat (limited to 'src/regress/lib/libcrypto/asn1/asn1time.c')
-rw-r--r-- | src/regress/lib/libcrypto/asn1/asn1time.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c index 184256d664..0adac08300 100644 --- a/src/regress/lib/libcrypto/asn1/asn1time.c +++ b/src/regress/lib/libcrypto/asn1/asn1time.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1time.c,v 1.15 2022/09/05 20:53:01 tb Exp $ */ | 1 | /* $OpenBSD: asn1time.c,v 1.16 2022/09/05 21:06:31 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -195,12 +195,12 @@ asn1_compare_bytes(int test_no, const unsigned char *d1, | |||
195 | const unsigned char *d2, int len1, int len2) | 195 | const unsigned char *d2, int len1, int len2) |
196 | { | 196 | { |
197 | if (len1 != len2) { | 197 | if (len1 != len2) { |
198 | fprintf(stderr, "FAIL: test %i - byte lengths differ " | 198 | fprintf(stderr, "FAIL: test %d - byte lengths differ " |
199 | "(%i != %i)\n", test_no, len1, len2); | 199 | "(%d != %d)\n", test_no, len1, len2); |
200 | return (1); | 200 | return (1); |
201 | } | 201 | } |
202 | if (memcmp(d1, d2, len1) != 0) { | 202 | if (memcmp(d1, d2, len1) != 0) { |
203 | fprintf(stderr, "FAIL: test %i - bytes differ\n", test_no); | 203 | fprintf(stderr, "FAIL: test %d - bytes differ\n", test_no); |
204 | fprintf(stderr, "Got:\n"); | 204 | fprintf(stderr, "Got:\n"); |
205 | hexdump(d1, len1); | 205 | hexdump(d1, len1); |
206 | fprintf(stderr, "Want:\n"); | 206 | fprintf(stderr, "Want:\n"); |
@@ -216,12 +216,12 @@ asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str) | |||
216 | int length = strlen(str); | 216 | int length = strlen(str); |
217 | 217 | ||
218 | if (asn1str->length != length) { | 218 | if (asn1str->length != length) { |
219 | fprintf(stderr, "FAIL: test %i - string lengths differ " | 219 | fprintf(stderr, "FAIL: test %d - string lengths differ " |
220 | "(%i != %i)\n", test_no, asn1str->length, length); | 220 | "(%d != %d)\n", test_no, asn1str->length, length); |
221 | return (1); | 221 | return (1); |
222 | } | 222 | } |
223 | if (strncmp(asn1str->data, str, length) != 0) { | 223 | if (strncmp(asn1str->data, str, length) != 0) { |
224 | fprintf(stderr, "FAIL: test %i - strings differ " | 224 | fprintf(stderr, "FAIL: test %d - strings differ " |
225 | "('%s' != '%s')\n", test_no, asn1str->data, str); | 225 | "('%s' != '%s')\n", test_no, asn1str->data, str); |
226 | return (1); | 226 | return (1); |
227 | } | 227 | } |
@@ -245,7 +245,7 @@ asn1_invtime_test(int test_no, struct asn1_time_test *att, int gen) | |||
245 | goto done; | 245 | goto done; |
246 | 246 | ||
247 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) { | 247 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) { |
248 | fprintf(stderr, "FAIL: test %i - successfully set " | 248 | fprintf(stderr, "FAIL: test %d - successfully set " |
249 | "GENERALIZEDTIME string '%s'\n", test_no, att->str); | 249 | "GENERALIZEDTIME string '%s'\n", test_no, att->str); |
250 | goto done; | 250 | goto done; |
251 | } | 251 | } |
@@ -256,17 +256,17 @@ asn1_invtime_test(int test_no, struct asn1_time_test *att, int gen) | |||
256 | } | 256 | } |
257 | 257 | ||
258 | if (ASN1_UTCTIME_set_string(ut, att->str) != 0) { | 258 | if (ASN1_UTCTIME_set_string(ut, att->str) != 0) { |
259 | fprintf(stderr, "FAIL: test %i - successfully set UTCTIME " | 259 | fprintf(stderr, "FAIL: test %d - successfully set UTCTIME " |
260 | "string '%s'\n", test_no, att->str); | 260 | "string '%s'\n", test_no, att->str); |
261 | goto done; | 261 | goto done; |
262 | } | 262 | } |
263 | if (ASN1_TIME_set_string(t, att->str) != 0) { | 263 | if (ASN1_TIME_set_string(t, att->str) != 0) { |
264 | fprintf(stderr, "FAIL: test %i - successfully set TIME " | 264 | fprintf(stderr, "FAIL: test %d - successfully set TIME " |
265 | "string '%s'\n", test_no, att->str); | 265 | "string '%s'\n", test_no, att->str); |
266 | goto done; | 266 | goto done; |
267 | } | 267 | } |
268 | if (ASN1_TIME_set_string_X509(t, att->str) != 0) { | 268 | if (ASN1_TIME_set_string_X509(t, att->str) != 0) { |
269 | fprintf(stderr, "FAIL: test %i - successfully set x509 TIME " | 269 | fprintf(stderr, "FAIL: test %d - successfully set x509 TIME " |
270 | "string '%s'\n", test_no, att->str); | 270 | "string '%s'\n", test_no, att->str); |
271 | goto done; | 271 | goto done; |
272 | } | 272 | } |
@@ -292,7 +292,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
292 | struct tm tm; | 292 | struct tm tm; |
293 | 293 | ||
294 | if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) { | 294 | if (ASN1_GENERALIZEDTIME_set_string(NULL, att->str) != 1) { |
295 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 295 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
296 | test_no, att->str); | 296 | test_no, att->str); |
297 | goto done; | 297 | goto done; |
298 | } | 298 | } |
@@ -301,7 +301,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
301 | goto done; | 301 | goto done; |
302 | 302 | ||
303 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) { | 303 | if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) { |
304 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 304 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
305 | test_no, att->str); | 305 | test_no, att->str); |
306 | goto done; | 306 | goto done; |
307 | } | 307 | } |
@@ -309,7 +309,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
309 | goto done; | 309 | goto done; |
310 | 310 | ||
311 | if (ASN1_TIME_to_tm(gt, &tm) == 0) { | 311 | if (ASN1_TIME_to_tm(gt, &tm) == 0) { |
312 | fprintf(stderr, "FAIL: test %i - ASN1_time_to_tm failed '%s'\n", | 312 | fprintf(stderr, "FAIL: test %d - ASN1_time_to_tm failed '%s'\n", |
313 | test_no, att->str); | 313 | test_no, att->str); |
314 | goto done; | 314 | goto done; |
315 | } | 315 | } |
@@ -318,13 +318,13 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
318 | /* things with crappy time_t should die in fire */ | 318 | /* things with crappy time_t should die in fire */ |
319 | int64_t a = timegm(&tm); | 319 | int64_t a = timegm(&tm); |
320 | int64_t b = att->time; | 320 | int64_t b = att->time; |
321 | fprintf(stderr, "FAIL: test %i - times don't match, expected %lld got %lld\n", | 321 | fprintf(stderr, "FAIL: test %d - times don't match, expected %lld got %lld\n", |
322 | test_no, (long long)b, (long long)a); | 322 | test_no, (long long)b, (long long)a); |
323 | goto done; | 323 | goto done; |
324 | } | 324 | } |
325 | 325 | ||
326 | if ((len = i2d_ASN1_GENERALIZEDTIME(gt, &p)) <= 0) { | 326 | if ((len = i2d_ASN1_GENERALIZEDTIME(gt, &p)) <= 0) { |
327 | fprintf(stderr, "FAIL: test %i - i2d_ASN1_GENERALIZEDTIME " | 327 | fprintf(stderr, "FAIL: test %d - i2d_ASN1_GENERALIZEDTIME " |
328 | "failed\n", test_no); | 328 | "failed\n", test_no); |
329 | goto done; | 329 | goto done; |
330 | } | 330 | } |
@@ -334,7 +334,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
334 | 334 | ||
335 | len = strlen(att->der); | 335 | len = strlen(att->der); |
336 | if (d2i_ASN1_GENERALIZEDTIME(>, &der, len) == NULL) { | 336 | if (d2i_ASN1_GENERALIZEDTIME(>, &der, len) == NULL) { |
337 | fprintf(stderr, "FAIL: test %i - d2i_ASN1_GENERALIZEDTIME " | 337 | fprintf(stderr, "FAIL: test %d - d2i_ASN1_GENERALIZEDTIME " |
338 | "failed\n", test_no); | 338 | "failed\n", test_no); |
339 | goto done; | 339 | goto done; |
340 | } | 340 | } |
@@ -344,7 +344,7 @@ asn1_gentime_test(int test_no, struct asn1_time_test *att) | |||
344 | ASN1_GENERALIZEDTIME_free(gt); | 344 | ASN1_GENERALIZEDTIME_free(gt); |
345 | 345 | ||
346 | if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) { | 346 | if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) { |
347 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | 347 | fprintf(stderr, "FAIL: test %d - failed to set time %lld\n", |
348 | test_no, (long long)att->time); | 348 | test_no, (long long)att->time); |
349 | goto done; | 349 | goto done; |
350 | } | 350 | } |
@@ -370,7 +370,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
370 | int len; | 370 | int len; |
371 | 371 | ||
372 | if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) { | 372 | if (ASN1_UTCTIME_set_string(NULL, att->str) != 1) { |
373 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 373 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
374 | test_no, att->str); | 374 | test_no, att->str); |
375 | goto done; | 375 | goto done; |
376 | } | 376 | } |
@@ -379,7 +379,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
379 | goto done; | 379 | goto done; |
380 | 380 | ||
381 | if (ASN1_UTCTIME_set_string(ut, att->str) != 1) { | 381 | if (ASN1_UTCTIME_set_string(ut, att->str) != 1) { |
382 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 382 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
383 | test_no, att->str); | 383 | test_no, att->str); |
384 | goto done; | 384 | goto done; |
385 | } | 385 | } |
@@ -387,7 +387,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
387 | goto done; | 387 | goto done; |
388 | 388 | ||
389 | if ((len = i2d_ASN1_UTCTIME(ut, &p)) <= 0) { | 389 | if ((len = i2d_ASN1_UTCTIME(ut, &p)) <= 0) { |
390 | fprintf(stderr, "FAIL: test %i - i2d_ASN1_UTCTIME failed\n", | 390 | fprintf(stderr, "FAIL: test %d - i2d_ASN1_UTCTIME failed\n", |
391 | test_no); | 391 | test_no); |
392 | goto done; | 392 | goto done; |
393 | } | 393 | } |
@@ -397,7 +397,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
397 | 397 | ||
398 | len = strlen(att->der); | 398 | len = strlen(att->der); |
399 | if (d2i_ASN1_UTCTIME(&ut, &der, len) == NULL) { | 399 | if (d2i_ASN1_UTCTIME(&ut, &der, len) == NULL) { |
400 | fprintf(stderr, "FAIL: test %i - d2i_ASN1_UTCTIME failed\n", | 400 | fprintf(stderr, "FAIL: test %d - d2i_ASN1_UTCTIME failed\n", |
401 | test_no); | 401 | test_no); |
402 | goto done; | 402 | goto done; |
403 | } | 403 | } |
@@ -407,7 +407,7 @@ asn1_utctime_test(int test_no, struct asn1_time_test *att) | |||
407 | ASN1_UTCTIME_free(ut); | 407 | ASN1_UTCTIME_free(ut); |
408 | 408 | ||
409 | if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) { | 409 | if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) { |
410 | fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", | 410 | fprintf(stderr, "FAIL: test %d - failed to set time %lld\n", |
411 | test_no, (long long)att->time); | 411 | test_no, (long long)att->time); |
412 | goto done; | 412 | goto done; |
413 | } | 413 | } |
@@ -430,7 +430,7 @@ asn1_time_test(int test_no, struct asn1_time_test *att, int type) | |||
430 | int failure = 1; | 430 | int failure = 1; |
431 | 431 | ||
432 | if (ASN1_TIME_set_string(NULL, att->str) != 1) { | 432 | if (ASN1_TIME_set_string(NULL, att->str) != 1) { |
433 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 433 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
434 | test_no, att->str); | 434 | test_no, att->str); |
435 | goto done; | 435 | goto done; |
436 | } | 436 | } |
@@ -442,31 +442,31 @@ asn1_time_test(int test_no, struct asn1_time_test *att, int type) | |||
442 | goto done; | 442 | goto done; |
443 | 443 | ||
444 | if (ASN1_TIME_set_string(t, att->str) != 1) { | 444 | if (ASN1_TIME_set_string(t, att->str) != 1) { |
445 | fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", | 445 | fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n", |
446 | test_no, att->str); | 446 | test_no, att->str); |
447 | goto done; | 447 | goto done; |
448 | } | 448 | } |
449 | 449 | ||
450 | if (t->type != type) { | 450 | if (t->type != type) { |
451 | fprintf(stderr, "FAIL: test %i - got type %i, want %i\n", | 451 | fprintf(stderr, "FAIL: test %d - got type %d, want %d\n", |
452 | test_no, t->type, type); | 452 | test_no, t->type, type); |
453 | goto done; | 453 | goto done; |
454 | } | 454 | } |
455 | 455 | ||
456 | if (ASN1_TIME_normalize(t) != 1) { | 456 | if (ASN1_TIME_normalize(t) != 1) { |
457 | fprintf(stderr, "FAIL: test %i - failed to set normalize '%s'\n", | 457 | fprintf(stderr, "FAIL: test %d - failed to set normalize '%s'\n", |
458 | test_no, att->str); | 458 | test_no, att->str); |
459 | goto done; | 459 | goto done; |
460 | } | 460 | } |
461 | 461 | ||
462 | if (ASN1_TIME_set_string_X509(tx509, t->data) != 1) { | 462 | if (ASN1_TIME_set_string_X509(tx509, t->data) != 1) { |
463 | fprintf(stderr, "FAIL: test %i - failed to set string X509 '%s'\n", | 463 | fprintf(stderr, "FAIL: test %d - failed to set string X509 '%s'\n", |
464 | test_no, t->data); | 464 | test_no, t->data); |
465 | goto done; | 465 | goto done; |
466 | } | 466 | } |
467 | 467 | ||
468 | if (t->type != tx509->type) { | 468 | if (t->type != tx509->type) { |
469 | fprintf(stderr, "FAIL: test %i - type %d, different from %d\n", | 469 | fprintf(stderr, "FAIL: test %d - type %d, different from %d\n", |
470 | test_no, t->type, tx509->type); | 470 | test_no, t->type, tx509->type); |
471 | goto done; | 471 | goto done; |
472 | } | 472 | } |