summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libcrypto/asn1')
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1basic.c4
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1complex.c4
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1evp.c12
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1object.c4
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1time.c58
-rw-r--r--src/regress/lib/libcrypto/asn1/rfc5280time.c30
6 files changed, 56 insertions, 56 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1basic.c b/src/regress/lib/libcrypto/asn1/asn1basic.c
index 6ce27a2706..45f61ed859 100644
--- a/src/regress/lib/libcrypto/asn1/asn1basic.c
+++ b/src/regress/lib/libcrypto/asn1/asn1basic.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1basic.c,v 1.11 2022/09/03 18:54:36 jsing Exp $ */ 1/* $OpenBSD: asn1basic.c,v 1.12 2022/09/05 21:06:31 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -41,7 +41,7 @@ asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
41{ 41{
42 if (len1 != len2) { 42 if (len1 != len2) {
43 fprintf(stderr, "FAIL: %s - byte lengths differ " 43 fprintf(stderr, "FAIL: %s - byte lengths differ "
44 "(%i != %i)\n", label, len1, len2); 44 "(%d != %d)\n", label, len1, len2);
45 fprintf(stderr, "Got:\n"); 45 fprintf(stderr, "Got:\n");
46 hexdump(d1, len1); 46 hexdump(d1, len1);
47 fprintf(stderr, "Want:\n"); 47 fprintf(stderr, "Want:\n");
diff --git a/src/regress/lib/libcrypto/asn1/asn1complex.c b/src/regress/lib/libcrypto/asn1/asn1complex.c
index e75ebc753e..6f34154b7f 100644
--- a/src/regress/lib/libcrypto/asn1/asn1complex.c
+++ b/src/regress/lib/libcrypto/asn1/asn1complex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1complex.c,v 1.3 2022/04/28 18:36:38 jsing Exp $ */ 1/* $OpenBSD: asn1complex.c,v 1.4 2022/09/05 21:06:31 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2021 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -40,7 +40,7 @@ asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
40{ 40{
41 if (len1 != len2) { 41 if (len1 != len2) {
42 fprintf(stderr, "FAIL: %s - byte lengths differ " 42 fprintf(stderr, "FAIL: %s - byte lengths differ "
43 "(%i != %i)\n", label, len1, len2); 43 "(%d != %d)\n", label, len1, len2);
44 return 0; 44 return 0;
45 } 45 }
46 if (memcmp(d1, d2, len1) != 0) { 46 if (memcmp(d1, d2, len1) != 0) {
diff --git a/src/regress/lib/libcrypto/asn1/asn1evp.c b/src/regress/lib/libcrypto/asn1/asn1evp.c
index 7e290d5db8..0bf0a5fb9e 100644
--- a/src/regress/lib/libcrypto/asn1/asn1evp.c
+++ b/src/regress/lib/libcrypto/asn1/asn1evp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1evp.c,v 1.4 2021/04/06 16:30:27 tb Exp $ */ 1/* $OpenBSD: asn1evp.c,v 1.5 2022/09/05 21:06:31 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -84,12 +84,12 @@ main(int argc, char **argv)
84 goto done; 84 goto done;
85 } 85 }
86 if (at->type != V_ASN1_SEQUENCE) { 86 if (at->type != V_ASN1_SEQUENCE) {
87 fprintf(stderr, "FAIL: not a V_ASN1_SEQUENCE (%i != %i)\n", 87 fprintf(stderr, "FAIL: not a V_ASN1_SEQUENCE (%d != %d)\n",
88 at->type, V_ASN1_SEQUENCE); 88 at->type, V_ASN1_SEQUENCE);
89 goto done; 89 goto done;
90 } 90 }
91 if (at->value.sequence->type != V_ASN1_OCTET_STRING) { 91 if (at->value.sequence->type != V_ASN1_OCTET_STRING) {
92 fprintf(stderr, "FAIL: not a V_ASN1_OCTET_STRING (%i != %i)\n", 92 fprintf(stderr, "FAIL: not a V_ASN1_OCTET_STRING (%d != %d)\n",
93 at->type, V_ASN1_OCTET_STRING); 93 at->type, V_ASN1_OCTET_STRING);
94 goto done; 94 goto done;
95 } 95 }
@@ -106,7 +106,7 @@ main(int argc, char **argv)
106 goto done; 106 goto done;
107 } 107 }
108 if (num != TEST_NUM) { 108 if (num != TEST_NUM) {
109 fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); 109 fprintf(stderr, "FAIL: got num %ld, want %ld\n", num, TEST_NUM);
110 goto done; 110 goto done;
111 } 111 }
112 if (compare_data("octet string", data, len, 112 if (compare_data("octet string", data, len,
@@ -126,11 +126,11 @@ main(int argc, char **argv)
126 goto done; 126 goto done;
127 } 127 }
128 if (num != TEST_NUM) { 128 if (num != TEST_NUM) {
129 fprintf(stderr, "FAIL: got num %li, want %li\n", num, TEST_NUM); 129 fprintf(stderr, "FAIL: got num %ld, want %ld\n", num, TEST_NUM);
130 goto done; 130 goto done;
131 } 131 }
132 if (len != sizeof(test_octetstring)) { 132 if (len != sizeof(test_octetstring)) {
133 fprintf(stderr, "FAIL: got length mismatch (%i != %zu)\n", 133 fprintf(stderr, "FAIL: got length mismatch (%d != %zu)\n",
134 len, sizeof(test_octetstring)); 134 len, sizeof(test_octetstring));
135 goto done; 135 goto done;
136 } 136 }
diff --git a/src/regress/lib/libcrypto/asn1/asn1object.c b/src/regress/lib/libcrypto/asn1/asn1object.c
index dee7c2410a..3452a713a0 100644
--- a/src/regress/lib/libcrypto/asn1/asn1object.c
+++ b/src/regress/lib/libcrypto/asn1/asn1object.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1object.c,v 1.8 2022/06/22 09:54:19 tb Exp $ */ 1/* $OpenBSD: asn1object.c,v 1.9 2022/09/05 21:06:31 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2017, 2021, 2022 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017, 2021, 2022 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -41,7 +41,7 @@ asn1_compare_bytes(const char *label, const unsigned char *d1, int len1,
41{ 41{
42 if (len1 != len2) { 42 if (len1 != len2) {
43 fprintf(stderr, "FAIL: %s - byte lengths differ " 43 fprintf(stderr, "FAIL: %s - byte lengths differ "
44 "(%i != %i)\n", label, len1, len2); 44 "(%d != %d)\n", label, len1, len2);
45 fprintf(stderr, "Got:\n"); 45 fprintf(stderr, "Got:\n");
46 hexdump(d1, len1); 46 hexdump(d1, len1);
47 fprintf(stderr, "Want:\n"); 47 fprintf(stderr, "Want:\n");
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(&gt, &der, len) == NULL) { 336 if (d2i_ASN1_GENERALIZEDTIME(&gt, &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 }
diff --git a/src/regress/lib/libcrypto/asn1/rfc5280time.c b/src/regress/lib/libcrypto/asn1/rfc5280time.c
index 34e40439dc..f9b561e5c9 100644
--- a/src/regress/lib/libcrypto/asn1/rfc5280time.c
+++ b/src/regress/lib/libcrypto/asn1/rfc5280time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rfc5280time.c,v 1.4 2015/10/30 15:52:55 miod Exp $ */ 1/* $OpenBSD: rfc5280time.c,v 1.5 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 * Copyright (c) 2015 Bob Beck <beck@opebsd.org> 4 * Copyright (c) 2015 Bob Beck <beck@opebsd.org>
@@ -191,12 +191,12 @@ asn1_compare_str(int test_no, struct asn1_string_st *asn1str, const char *str)
191 int length = strlen(str); 191 int length = strlen(str);
192 192
193 if (asn1str->length != length) { 193 if (asn1str->length != length) {
194 fprintf(stderr, "FAIL: test %i - string lengths differ " 194 fprintf(stderr, "FAIL: test %d - string lengths differ "
195 "(%i != %i)\n", test_no, asn1str->length, length); 195 "(%d != %d)\n", test_no, asn1str->length, length);
196 return (1); 196 return (1);
197 } 197 }
198 if (strncmp(asn1str->data, str, length) != 0) { 198 if (strncmp(asn1str->data, str, length) != 0) {
199 fprintf(stderr, "FAIL: test %i - strings differ " 199 fprintf(stderr, "FAIL: test %d - strings differ "
200 "('%s' != '%s')\n", test_no, asn1str->data, str); 200 "('%s' != '%s')\n", test_no, asn1str->data, str);
201 return (1); 201 return (1);
202 } 202 }
@@ -222,21 +222,21 @@ rfc5280_invtime_test(int test_no, struct rfc5280_time_test *att)
222 222
223 if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) { 223 if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 0) {
224 if (X509_cmp_time(gt, &now) != 0) { 224 if (X509_cmp_time(gt, &now) != 0) {
225 fprintf(stderr, "FAIL: test %i - successfully parsed as GENTIME " 225 fprintf(stderr, "FAIL: test %d - successfully parsed as GENTIME "
226 "string '%s'\n", test_no, att->str); 226 "string '%s'\n", test_no, att->str);
227 goto done; 227 goto done;
228 } 228 }
229 } 229 }
230 if (ASN1_UTCTIME_set_string(ut, att->str) != 0) { 230 if (ASN1_UTCTIME_set_string(ut, att->str) != 0) {
231 if (X509_cmp_time(ut, &now) != 0) { 231 if (X509_cmp_time(ut, &now) != 0) {
232 fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME " 232 fprintf(stderr, "FAIL: test %d - successfully parsed as UTCTIME "
233 "string '%s'\n", test_no, att->str); 233 "string '%s'\n", test_no, att->str);
234 goto done; 234 goto done;
235 } 235 }
236 } 236 }
237 if (ASN1_TIME_set_string(t, att->str) != 0) { 237 if (ASN1_TIME_set_string(t, att->str) != 0) {
238 if (X509_cmp_time(t, &now) != 0) { 238 if (X509_cmp_time(t, &now) != 0) {
239 fprintf(stderr, "FAIL: test %i - successfully parsed as UTCTIME " 239 fprintf(stderr, "FAIL: test %d - successfully parsed as UTCTIME "
240 "string '%s'\n", test_no, att->str); 240 "string '%s'\n", test_no, att->str);
241 goto done; 241 goto done;
242 } 242 }
@@ -264,7 +264,7 @@ rfc5280_gentime_test(int test_no, struct rfc5280_time_test *att)
264 goto done; 264 goto done;
265 265
266 if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) { 266 if (ASN1_GENERALIZEDTIME_set_string(gt, att->str) != 1) {
267 fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", 267 fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
268 test_no, att->str); 268 test_no, att->str);
269 goto done; 269 goto done;
270 } 270 }
@@ -272,14 +272,14 @@ rfc5280_gentime_test(int test_no, struct rfc5280_time_test *att)
272 goto done; 272 goto done;
273 273
274 if ((i = X509_cmp_time(gt, &att->time)) != -1) { 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", 275 fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
276 test_no, i, att->time); 276 test_no, i, att->time);
277 goto done; 277 goto done;
278 } 278 }
279 279
280 att->time--; 280 att->time--;
281 if ((i = X509_cmp_time(gt, &att->time)) != 1) { 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", 282 fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
283 test_no, i, att->time); 283 test_no, i, att->time);
284 goto done; 284 goto done;
285 } 285 }
@@ -288,7 +288,7 @@ rfc5280_gentime_test(int test_no, struct rfc5280_time_test *att)
288 ASN1_GENERALIZEDTIME_free(gt); 288 ASN1_GENERALIZEDTIME_free(gt);
289 289
290 if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) { 290 if ((gt = ASN1_GENERALIZEDTIME_set(NULL, att->time)) == NULL) {
291 fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", 291 fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
292 test_no, (long long)att->time); 292 test_no, (long long)att->time);
293 goto done; 293 goto done;
294 } 294 }
@@ -316,7 +316,7 @@ rfc5280_utctime_test(int test_no, struct rfc5280_time_test *att)
316 goto done; 316 goto done;
317 317
318 if (ASN1_UTCTIME_set_string(ut, att->str) != 1) { 318 if (ASN1_UTCTIME_set_string(ut, att->str) != 1) {
319 fprintf(stderr, "FAIL: test %i - failed to set string '%s'\n", 319 fprintf(stderr, "FAIL: test %d - failed to set string '%s'\n",
320 test_no, att->str); 320 test_no, att->str);
321 goto done; 321 goto done;
322 } 322 }
@@ -324,14 +324,14 @@ rfc5280_utctime_test(int test_no, struct rfc5280_time_test *att)
324 goto done; 324 goto done;
325 325
326 if ((i = X509_cmp_time(ut, &att->time)) != -1) { 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", 327 fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
328 test_no, i, att->time); 328 test_no, i, att->time);
329 goto done; 329 goto done;
330 } 330 }
331 331
332 att->time--; 332 att->time--;
333 if ((i = X509_cmp_time(ut, &att->time)) != 1) { 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", 334 fprintf(stderr, "FAIL: test %d - X509_cmp_time failed - returned %d compared to %lld\n",
335 test_no, i, att->time); 335 test_no, i, att->time);
336 goto done; 336 goto done;
337 } 337 }
@@ -340,7 +340,7 @@ rfc5280_utctime_test(int test_no, struct rfc5280_time_test *att)
340 ASN1_UTCTIME_free(ut); 340 ASN1_UTCTIME_free(ut);
341 341
342 if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) { 342 if ((ut = ASN1_UTCTIME_set(NULL, att->time)) == NULL) {
343 fprintf(stderr, "FAIL: test %i - failed to set time %lli\n", 343 fprintf(stderr, "FAIL: test %d - failed to set time %lld\n",
344 test_no, (long long)att->time); 344 test_no, (long long)att->time);
345 goto done; 345 goto done;
346 } 346 }