summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libssl/asn1/asn1test.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/regress/lib/libssl/asn1/asn1test.c b/src/regress/lib/libssl/asn1/asn1test.c
index 4feeff9e2f..4cb905a86e 100644
--- a/src/regress/lib/libssl/asn1/asn1test.c
+++ b/src/regress/lib/libssl/asn1/asn1test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1test.c,v 1.10 2022/01/11 19:08:08 jsing Exp $ */ 1/* $OpenBSD: asn1test.c,v 1.11 2022/06/07 18:00:51 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014, 2016 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -272,18 +272,18 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
272{ 272{
273 /* Compare the ASN.1 encoded values from two sessions. */ 273 /* Compare the ASN.1 encoded values from two sessions. */
274 if (s1->ssl_version != s2->ssl_version) { 274 if (s1->ssl_version != s2->ssl_version) {
275 fprintf(stderr, "ssl_version differs: %i != %i\n", 275 fprintf(stderr, "ssl_version differs: %d != %d\n",
276 s1->ssl_version, s2->ssl_version); 276 s1->ssl_version, s2->ssl_version);
277 return (1); 277 return (1);
278 } 278 }
279 if (s1->cipher_id != s2->cipher_id) { 279 if (s1->cipher_id != s2->cipher_id) {
280 fprintf(stderr, "cipher_id differs: %li != %li\n", 280 fprintf(stderr, "cipher_id differs: %ld != %ld\n",
281 s1->cipher_id, s2->cipher_id); 281 s1->cipher_id, s2->cipher_id);
282 return (1); 282 return (1);
283 } 283 }
284 284
285 if (s1->master_key_length != s2->master_key_length) { 285 if (s1->master_key_length != s2->master_key_length) {
286 fprintf(stderr, "master_key_length differs: %i != %i\n", 286 fprintf(stderr, "master_key_length differs: %zu != %zu\n",
287 s1->master_key_length, s2->master_key_length); 287 s1->master_key_length, s2->master_key_length);
288 return (1); 288 return (1);
289 } 289 }
@@ -294,7 +294,7 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
294 } 294 }
295 295
296 if (s1->session_id_length != s2->session_id_length) { 296 if (s1->session_id_length != s2->session_id_length) {
297 fprintf(stderr, "session_id_length differs: %i != %i\n", 297 fprintf(stderr, "session_id_length differs: %zu != %zu\n",
298 s1->session_id_length, s2->session_id_length); 298 s1->session_id_length, s2->session_id_length);
299 return (1); 299 return (1);
300 } 300 }
@@ -305,7 +305,7 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
305 } 305 }
306 306
307 if (s1->sid_ctx_length != s2->sid_ctx_length) { 307 if (s1->sid_ctx_length != s2->sid_ctx_length) {
308 fprintf(stderr, "sid_ctx_length differs: %i != %i\n", 308 fprintf(stderr, "sid_ctx_length differs: %zu != %zu\n",
309 s1->sid_ctx_length, s2->sid_ctx_length); 309 s1->sid_ctx_length, s2->sid_ctx_length);
310 return (1); 310 return (1);
311 } 311 }
@@ -317,14 +317,14 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
317 317
318 /* d2i_SSL_SESSION uses the current time if decoding a zero value. */ 318 /* d2i_SSL_SESSION uses the current time if decoding a zero value. */
319 if ((s1->time != s2->time) && s1->time != 0 && s2->time != 0) { 319 if ((s1->time != s2->time) && s1->time != 0 && s2->time != 0) {
320 fprintf(stderr, "time differs: %lli != %lli\n", 320 fprintf(stderr, "time differs: %lld != %lld\n",
321 (long long)s1->time, (long long)s2->time); 321 (long long)s1->time, (long long)s2->time);
322 return (1); 322 return (1);
323 } 323 }
324 /* d2i_SSL_SESSION uses a timeout of 3 if decoding a zero value. */ 324 /* d2i_SSL_SESSION uses a timeout of 3 if decoding a zero value. */
325 if ((s1->timeout != s2->timeout) && 325 if ((s1->timeout != s2->timeout) &&
326 s1->timeout != 3 && s2->timeout != 3) { 326 s1->timeout != 3 && s2->timeout != 3) {
327 fprintf(stderr, "timeout differs: %li != %li\n", 327 fprintf(stderr, "timeout differs: %ld != %ld\n",
328 s1->timeout, s2->timeout); 328 s1->timeout, s2->timeout);
329 return (1); 329 return (1);
330 } 330 }
@@ -338,7 +338,7 @@ session_cmp(SSL_SESSION *s1, SSL_SESSION *s2)
338 } 338 }
339 339
340 if (s1->verify_result != s2->verify_result) { 340 if (s1->verify_result != s2->verify_result) {
341 fprintf(stderr, "verify_result differs: %li != %li\n", 341 fprintf(stderr, "verify_result differs: %ld != %ld\n",
342 s1->verify_result, s2->verify_result); 342 s1->verify_result, s2->verify_result);
343 return (1); 343 return (1);
344 } 344 }
@@ -381,8 +381,8 @@ do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat)
381 381
382 len = i2d_SSL_SESSION(&sat->session, NULL); 382 len = i2d_SSL_SESSION(&sat->session, NULL);
383 if (len != sat->asn1_len) { 383 if (len != sat->asn1_len) {
384 fprintf(stderr, "FAIL: test %i returned ASN1 length %i, " 384 fprintf(stderr, "FAIL: test %d returned ASN1 length %d, "
385 "want %i\n", test_no, len, sat->asn1_len); 385 "want %d\n", test_no, len, sat->asn1_len);
386 goto failed; 386 goto failed;
387 } 387 }
388 388
@@ -398,19 +398,19 @@ do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat)
398 398
399 /* Check the length again since the code path is different. */ 399 /* Check the length again since the code path is different. */
400 if (len != sat->asn1_len) { 400 if (len != sat->asn1_len) {
401 fprintf(stderr, "FAIL: test %i returned ASN1 length %i, " 401 fprintf(stderr, "FAIL: test %d returned ASN1 length %d, "
402 "want %i\n", test_no, len, sat->asn1_len); 402 "want %d\n", test_no, len, sat->asn1_len);
403 goto failed; 403 goto failed;
404 } 404 }
405 /* ap should now point at the end of the buffer. */ 405 /* ap should now point at the end of the buffer. */
406 if (ap - asn1 != len) { 406 if (ap - asn1 != len) {
407 fprintf(stderr, "FAIL: test %i pointer increment does not " 407 fprintf(stderr, "FAIL: test %d pointer increment does not "
408 "match length (%i != %i)\n", test_no, (int)(ap - asn1), len); 408 "match length (%d != %d)\n", test_no, (int)(ap - asn1), len);
409 goto failed; 409 goto failed;
410 } 410 }
411 411
412 if (memcmp(asn1, &sat->asn1, len) != 0) { 412 if (memcmp(asn1, &sat->asn1, len) != 0) {
413 fprintf(stderr, "FAIL: test %i - encoding differs:\n", test_no); 413 fprintf(stderr, "FAIL: test %d - encoding differs:\n", test_no);
414 fprintf(stderr, "encoding:\n"); 414 fprintf(stderr, "encoding:\n");
415 for (i = 1; i <= len; i++) { 415 for (i = 1; i <= len; i++) {
416 fprintf(stderr, " 0x%02hhx,", asn1[i - 1]); 416 fprintf(stderr, " 0x%02hhx,", asn1[i - 1]);
@@ -431,12 +431,12 @@ do_ssl_asn1_test(int test_no, struct ssl_asn1_test *sat)
431 pp = sat->asn1; 431 pp = sat->asn1;
432 432
433 if ((sp = d2i_SSL_SESSION(NULL, &pp, sat->asn1_len)) == NULL) { 433 if ((sp = d2i_SSL_SESSION(NULL, &pp, sat->asn1_len)) == NULL) {
434 fprintf(stderr, "FAIL: test %i - decoding failed\n", test_no); 434 fprintf(stderr, "FAIL: test %d - decoding failed\n", test_no);
435 goto failed; 435 goto failed;
436 } 436 }
437 437
438 if (session_cmp(sp, &sat->session) != 0) { 438 if (session_cmp(sp, &sat->session) != 0) {
439 fprintf(stderr, "FAIL: test %i - decoding differs\n", test_no); 439 fprintf(stderr, "FAIL: test %d - decoding differs\n", test_no);
440 goto failed; 440 goto failed;
441 } 441 }
442 442