diff options
author | tb <> | 2023-07-11 08:31:34 +0000 |
---|---|---|
committer | tb <> | 2023-07-11 08:31:34 +0000 |
commit | a2eff3821514e61a9ab5969542b9bfa8316dbd06 (patch) | |
tree | 2bb89d77531dfe65ed65b7d43b391b7893a4bb1b /src/regress/lib/libssl/client/clienttest.c | |
parent | 616ecd4507b577ba738ce8be95657a1c38dcdae2 (diff) | |
download | openbsd-a2eff3821514e61a9ab5969542b9bfa8316dbd06.tar.gz openbsd-a2eff3821514e61a9ab5969542b9bfa8316dbd06.tar.bz2 openbsd-a2eff3821514e61a9ab5969542b9bfa8316dbd06.zip |
Fix most of the clienttest. With this only test cases 9 and 13 fail.
Diffstat (limited to 'src/regress/lib/libssl/client/clienttest.c')
-rw-r--r-- | src/regress/lib/libssl/client/clienttest.c | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/src/regress/lib/libssl/client/clienttest.c b/src/regress/lib/libssl/client/clienttest.c index 8ecc54467f..c1c518b08b 100644 --- a/src/regress/lib/libssl/client/clienttest.c +++ b/src/regress/lib/libssl/client/clienttest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clienttest.c,v 1.40 2023/04/23 18:59:41 tb Exp $ */ | 1 | /* $OpenBSD: clienttest.c,v 1.41 2023/07/11 08:31:34 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -36,7 +36,7 @@ | |||
36 | #define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2) | 36 | #define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2) |
37 | #define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34) | 37 | #define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34) |
38 | #define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69) | 38 | #define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69) |
39 | #define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 192) | 39 | #define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 188) |
40 | #define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 98) | 40 | #define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 98) |
41 | 41 | ||
42 | #define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000) | 42 | #define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000) |
@@ -270,8 +270,8 @@ static const uint8_t cipher_list_tls13_chacha[] = { | |||
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const uint8_t client_hello_tls13[] = { | 272 | static const uint8_t client_hello_tls13[] = { |
273 | 0x16, 0x03, 0x01, 0x01, 0x18, 0x01, 0x00, 0x01, | 273 | 0x16, 0x03, 0x03, 0x01, 0x14, 0x01, 0x00, 0x01, |
274 | 0x14, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, | 274 | 0x10, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, |
275 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 275 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
276 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 276 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
277 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 277 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -292,20 +292,20 @@ static const uint8_t client_hello_tls13[] = { | |||
292 | 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11, | 292 | 0x00, 0x2f, 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11, |
293 | 0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, | 293 | 0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08, |
294 | 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, 0x01, 0x00, | 294 | 0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, 0x01, 0x00, |
295 | 0x00, 0x6b, 0x00, 0x2b, 0x00, 0x09, 0x08, 0x03, | 295 | 0x00, 0x67, 0x00, 0x2b, 0x00, 0x05, 0x04, 0x03, |
296 | 0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00, | 296 | 0x04, 0x03, 0x03, 0x00, 0x33, 0x00, 0x26, 0x00, |
297 | 0x33, 0x00, 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00, | 297 | 0x24, 0x00, 0x1d, 0x00, 0x20, 0x00, 0x00, 0x00, |
298 | 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
302 | 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, | 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, |
303 | 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00, | 302 | 0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, |
304 | 0x17, 0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00, | 303 | 0x08, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, |
305 | 0x00, 0x00, 0x0d, 0x00, 0x18, 0x00, 0x16, 0x08, | 304 | 0x19, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, |
306 | 0x06, 0x06, 0x01, 0x06, 0x03, 0x08, 0x05, 0x05, | 305 | 0x18, 0x00, 0x16, 0x08, 0x06, 0x06, 0x01, 0x06, |
307 | 0x01, 0x05, 0x03, 0x08, 0x04, 0x04, 0x01, 0x04, | 306 | 0x03, 0x08, 0x05, 0x05, 0x01, 0x05, 0x03, 0x08, |
308 | 0x03, 0x02, 0x01, 0x02, 0x03, | 307 | 0x04, 0x04, 0x01, 0x04, 0x03, 0x02, 0x01, 0x02, |
308 | 0x03, | ||
309 | }; | 309 | }; |
310 | 310 | ||
311 | static const uint8_t cipher_list_tls13_only_aes[] = { | 311 | static const uint8_t cipher_list_tls13_only_aes[] = { |
@@ -351,6 +351,7 @@ struct client_hello_test { | |||
351 | const size_t key_share_start; | 351 | const size_t key_share_start; |
352 | const SSL_METHOD *(*ssl_method)(void); | 352 | const SSL_METHOD *(*ssl_method)(void); |
353 | const long ssl_options; | 353 | const long ssl_options; |
354 | int connect_fails; | ||
354 | }; | 355 | }; |
355 | 356 | ||
356 | static const struct client_hello_test client_hello_tests[] = { | 357 | static const struct client_hello_test client_hello_tests[] = { |
@@ -359,6 +360,7 @@ static const struct client_hello_test client_hello_tests[] = { | |||
359 | .protocol = DTLS1_VERSION, | 360 | .protocol = DTLS1_VERSION, |
360 | .random_start = DTLS_RANDOM_OFFSET, | 361 | .random_start = DTLS_RANDOM_OFFSET, |
361 | .ssl_method = DTLSv1_client_method, | 362 | .ssl_method = DTLSv1_client_method, |
363 | .connect_fails = 1, | ||
362 | }, | 364 | }, |
363 | { | 365 | { |
364 | .desc = "DTLSv1.2 client method", | 366 | .desc = "DTLSv1.2 client method", |
@@ -378,6 +380,7 @@ static const struct client_hello_test client_hello_tests[] = { | |||
378 | .random_start = DTLS_RANDOM_OFFSET, | 380 | .random_start = DTLS_RANDOM_OFFSET, |
379 | .ssl_method = DTLS_client_method, | 381 | .ssl_method = DTLS_client_method, |
380 | .ssl_options = SSL_OP_NO_DTLSv1_2, | 382 | .ssl_options = SSL_OP_NO_DTLSv1_2, |
383 | .connect_fails = 1, | ||
381 | }, | 384 | }, |
382 | { | 385 | { |
383 | .desc = "DTLS client method (no DTLSv1.0)", | 386 | .desc = "DTLS client method (no DTLSv1.0)", |
@@ -391,12 +394,14 @@ static const struct client_hello_test client_hello_tests[] = { | |||
391 | .protocol = TLS1_VERSION, | 394 | .protocol = TLS1_VERSION, |
392 | .random_start = SSL3_RANDOM_OFFSET, | 395 | .random_start = SSL3_RANDOM_OFFSET, |
393 | .ssl_method = TLSv1_client_method, | 396 | .ssl_method = TLSv1_client_method, |
397 | .connect_fails = 1, | ||
394 | }, | 398 | }, |
395 | { | 399 | { |
396 | .desc = "TLSv1_1 client method", | 400 | .desc = "TLSv1_1 client method", |
397 | .protocol = TLS1_1_VERSION, | 401 | .protocol = TLS1_1_VERSION, |
398 | .random_start = SSL3_RANDOM_OFFSET, | 402 | .random_start = SSL3_RANDOM_OFFSET, |
399 | .ssl_method = TLSv1_1_client_method, | 403 | .ssl_method = TLSv1_1_client_method, |
404 | .connect_fails = 1, | ||
400 | }, | 405 | }, |
401 | { | 406 | { |
402 | .desc = "TLSv1_2 client method", | 407 | .desc = "TLSv1_2 client method", |
@@ -422,15 +427,19 @@ static const struct client_hello_test client_hello_tests[] = { | |||
422 | }, | 427 | }, |
423 | { | 428 | { |
424 | .desc = "SSLv23 (no TLSv1.2)", | 429 | .desc = "SSLv23 (no TLSv1.2)", |
425 | .protocol = TLS1_1_VERSION, | 430 | .protocol = TLS1_3_VERSION_ONLY, |
426 | .random_start = SSL3_RANDOM_OFFSET, | 431 | .random_start = TLS13_RANDOM_OFFSET, |
432 | .session_start = TLS13_SESSION_OFFSET, | ||
433 | .key_share_start = TLS13_ONLY_KEY_SHARE_OFFSET, | ||
427 | .ssl_method = SSLv23_client_method, | 434 | .ssl_method = SSLv23_client_method, |
428 | .ssl_options = SSL_OP_NO_TLSv1_2, | 435 | .ssl_options = SSL_OP_NO_TLSv1_2, |
429 | }, | 436 | }, |
430 | { | 437 | { |
431 | .desc = "SSLv23 (no TLSv1.1)", | 438 | .desc = "SSLv23 (no TLSv1.1)", |
432 | .protocol = TLS1_VERSION, | 439 | .protocol = TLS1_3_VERSION, |
433 | .random_start = SSL3_RANDOM_OFFSET, | 440 | .random_start = TLS13_RANDOM_OFFSET, |
441 | .session_start = TLS13_SESSION_OFFSET, | ||
442 | .key_share_start = TLS13_KEY_SHARE_OFFSET, | ||
434 | .ssl_method = SSLv23_client_method, | 443 | .ssl_method = SSLv23_client_method, |
435 | .ssl_options = SSL_OP_NO_TLSv1_1, | 444 | .ssl_options = SSL_OP_NO_TLSv1_1, |
436 | }, | 445 | }, |
@@ -452,15 +461,19 @@ static const struct client_hello_test client_hello_tests[] = { | |||
452 | }, | 461 | }, |
453 | { | 462 | { |
454 | .desc = "TLS (no TLSv1.2)", | 463 | .desc = "TLS (no TLSv1.2)", |
455 | .protocol = TLS1_1_VERSION, | 464 | .protocol = TLS1_3_VERSION_ONLY, |
456 | .random_start = SSL3_RANDOM_OFFSET, | 465 | .random_start = TLS13_RANDOM_OFFSET, |
466 | .session_start = TLS13_SESSION_OFFSET, | ||
467 | .key_share_start = TLS13_ONLY_KEY_SHARE_OFFSET, | ||
457 | .ssl_method = TLS_client_method, | 468 | .ssl_method = TLS_client_method, |
458 | .ssl_options = SSL_OP_NO_TLSv1_2, | 469 | .ssl_options = SSL_OP_NO_TLSv1_2, |
459 | }, | 470 | }, |
460 | { | 471 | { |
461 | .desc = "TLS (no TLSv1.1)", | 472 | .desc = "TLS (no TLSv1.1)", |
462 | .protocol = TLS1_VERSION, | 473 | .protocol = TLS1_3_VERSION, |
463 | .random_start = SSL3_RANDOM_OFFSET, | 474 | .random_start = TLS13_RANDOM_OFFSET, |
475 | .session_start = TLS13_SESSION_OFFSET, | ||
476 | .key_share_start = TLS13_KEY_SHARE_OFFSET, | ||
464 | .ssl_method = TLS_client_method, | 477 | .ssl_method = TLS_client_method, |
465 | .ssl_options = SSL_OP_NO_TLSv1_1, | 478 | .ssl_options = SSL_OP_NO_TLSv1_1, |
466 | }, | 479 | }, |
@@ -661,6 +674,8 @@ client_hello_test(int testno, const struct client_hello_test *cht) | |||
661 | SSL_set_bio(ssl, rbio, wbio); | 674 | SSL_set_bio(ssl, rbio, wbio); |
662 | 675 | ||
663 | if (SSL_connect(ssl) != 0) { | 676 | if (SSL_connect(ssl) != 0) { |
677 | if (cht->connect_fails) | ||
678 | goto done; | ||
664 | fprintf(stderr, "SSL_connect() returned non-zero\n"); | 679 | fprintf(stderr, "SSL_connect() returned non-zero\n"); |
665 | goto failure; | 680 | goto failure; |
666 | } | 681 | } |
@@ -709,6 +724,7 @@ client_hello_test(int testno, const struct client_hello_test *cht) | |||
709 | goto failure; | 724 | goto failure; |
710 | } | 725 | } |
711 | 726 | ||
727 | done: | ||
712 | ret = 0; | 728 | ret = 0; |
713 | 729 | ||
714 | failure: | 730 | failure: |