diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libssl/tlsext/tlsexttest.c | 134 |
1 files changed, 89 insertions, 45 deletions
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c index e441aeb8f6..7522085f5a 100644 --- a/src/regress/lib/libssl/tlsext/tlsexttest.c +++ b/src/regress/lib/libssl/tlsext/tlsexttest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tlsexttest.c,v 1.68 2022/08/05 08:51:35 tb Exp $ */ | 1 | /* $OpenBSD: tlsexttest.c,v 1.69 2022/08/05 16:51:11 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
| @@ -166,7 +166,8 @@ test_tlsext_alpn_client(void) | |||
| 166 | int failure, alert; | 166 | int failure, alert; |
| 167 | size_t dlen; | 167 | size_t dlen; |
| 168 | 168 | ||
| 169 | CBB_init(&cbb, 0); | 169 | if (!CBB_init(&cbb, 0)) |
| 170 | errx(1, "Failed to create CBB"); | ||
| 170 | 171 | ||
| 171 | failure = 1; | 172 | failure = 1; |
| 172 | 173 | ||
| @@ -226,7 +227,8 @@ test_tlsext_alpn_client(void) | |||
| 226 | } | 227 | } |
| 227 | 228 | ||
| 228 | CBB_cleanup(&cbb); | 229 | CBB_cleanup(&cbb); |
| 229 | CBB_init(&cbb, 0); | 230 | if (!CBB_init(&cbb, 0)) |
| 231 | errx(1, "Failed to create CBB"); | ||
| 230 | free(data); | 232 | free(data); |
| 231 | data = NULL; | 233 | data = NULL; |
| 232 | 234 | ||
| @@ -365,7 +367,8 @@ test_tlsext_alpn_server(void) | |||
| 365 | int failure, alert; | 367 | int failure, alert; |
| 366 | size_t dlen; | 368 | size_t dlen; |
| 367 | 369 | ||
| 368 | CBB_init(&cbb, 0); | 370 | if (!CBB_init(&cbb, 0)) |
| 371 | errx(1, "Failed to create CBB"); | ||
| 369 | 372 | ||
| 370 | failure = 1; | 373 | failure = 1; |
| 371 | 374 | ||
| @@ -426,7 +429,8 @@ test_tlsext_alpn_server(void) | |||
| 426 | } | 429 | } |
| 427 | 430 | ||
| 428 | CBB_cleanup(&cbb); | 431 | CBB_cleanup(&cbb); |
| 429 | CBB_init(&cbb, 0); | 432 | if (!CBB_init(&cbb, 0)) |
| 433 | errx(1, "Failed to create CBB"); | ||
| 430 | free(data); | 434 | free(data); |
| 431 | data = NULL; | 435 | data = NULL; |
| 432 | 436 | ||
| @@ -649,7 +653,8 @@ test_tlsext_supportedgroups_client(void) | |||
| 649 | * Test parsing secp384r1 | 653 | * Test parsing secp384r1 |
| 650 | */ | 654 | */ |
| 651 | CBB_cleanup(&cbb); | 655 | CBB_cleanup(&cbb); |
| 652 | CBB_init(&cbb, 0); | 656 | if (!CBB_init(&cbb, 0)) |
| 657 | errx(1, "Failed to create CBB"); | ||
| 653 | free(data); | 658 | free(data); |
| 654 | data = NULL; | 659 | data = NULL; |
| 655 | 660 | ||
| @@ -691,7 +696,8 @@ test_tlsext_supportedgroups_client(void) | |||
| 691 | * Use a custom order. | 696 | * Use a custom order. |
| 692 | */ | 697 | */ |
| 693 | CBB_cleanup(&cbb); | 698 | CBB_cleanup(&cbb); |
| 694 | CBB_init(&cbb, 0); | 699 | if (!CBB_init(&cbb, 0)) |
| 700 | errx(1, "Failed to create CBB"); | ||
| 695 | 701 | ||
| 696 | SSL_SESSION_free(ssl->session); | 702 | SSL_SESSION_free(ssl->session); |
| 697 | if ((ssl->session = SSL_SESSION_new()) == NULL) | 703 | if ((ssl->session = SSL_SESSION_new()) == NULL) |
| @@ -748,7 +754,8 @@ test_tlsext_supportedgroups_client(void) | |||
| 748 | * Parse non-default curves to session. | 754 | * Parse non-default curves to session. |
| 749 | */ | 755 | */ |
| 750 | CBB_cleanup(&cbb); | 756 | CBB_cleanup(&cbb); |
| 751 | CBB_init(&cbb, 0); | 757 | if (!CBB_init(&cbb, 0)) |
| 758 | errx(1, "Failed to create CBB"); | ||
| 752 | free(data); | 759 | free(data); |
| 753 | data = NULL; | 760 | data = NULL; |
| 754 | 761 | ||
| @@ -892,7 +899,8 @@ test_tlsext_ecpf_client(void) | |||
| 892 | 899 | ||
| 893 | failure = 1; | 900 | failure = 1; |
| 894 | 901 | ||
| 895 | CBB_init(&cbb, 0); | 902 | if (!CBB_init(&cbb, 0)) |
| 903 | errx(1, "Failed to create CBB"); | ||
| 896 | 904 | ||
| 897 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 905 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 898 | errx(1, "failed to create SSL_CTX"); | 906 | errx(1, "failed to create SSL_CTX"); |
| @@ -970,7 +978,8 @@ test_tlsext_ecpf_client(void) | |||
| 970 | * Make sure we can parse the default. | 978 | * Make sure we can parse the default. |
| 971 | */ | 979 | */ |
| 972 | CBB_cleanup(&cbb); | 980 | CBB_cleanup(&cbb); |
| 973 | CBB_init(&cbb, 0); | 981 | if (!CBB_init(&cbb, 0)) |
| 982 | errx(1, "Failed to create CBB"); | ||
| 974 | free(data); | 983 | free(data); |
| 975 | data = NULL; | 984 | data = NULL; |
| 976 | 985 | ||
| @@ -1007,7 +1016,8 @@ test_tlsext_ecpf_client(void) | |||
| 1007 | * Test with a custom order. | 1016 | * Test with a custom order. |
| 1008 | */ | 1017 | */ |
| 1009 | CBB_cleanup(&cbb); | 1018 | CBB_cleanup(&cbb); |
| 1010 | CBB_init(&cbb, 0); | 1019 | if (!CBB_init(&cbb, 0)) |
| 1020 | errx(1, "Failed to create CBB"); | ||
| 1011 | free(data); | 1021 | free(data); |
| 1012 | data = NULL; | 1022 | data = NULL; |
| 1013 | 1023 | ||
| @@ -1058,7 +1068,8 @@ test_tlsext_ecpf_client(void) | |||
| 1058 | * Make sure that we can parse this custom order. | 1068 | * Make sure that we can parse this custom order. |
| 1059 | */ | 1069 | */ |
| 1060 | CBB_cleanup(&cbb); | 1070 | CBB_cleanup(&cbb); |
| 1061 | CBB_init(&cbb, 0); | 1071 | if (!CBB_init(&cbb, 0)) |
| 1072 | errx(1, "Failed to create CBB"); | ||
| 1062 | free(data); | 1073 | free(data); |
| 1063 | data = NULL; | 1074 | data = NULL; |
| 1064 | 1075 | ||
| @@ -1123,7 +1134,8 @@ test_tlsext_ecpf_server(void) | |||
| 1123 | 1134 | ||
| 1124 | failure = 1; | 1135 | failure = 1; |
| 1125 | 1136 | ||
| 1126 | CBB_init(&cbb, 0); | 1137 | if (!CBB_init(&cbb, 0)) |
| 1138 | errx(1, "Failed to create CBB"); | ||
| 1127 | 1139 | ||
| 1128 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) | 1140 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) |
| 1129 | errx(1, "failed to create SSL_CTX"); | 1141 | errx(1, "failed to create SSL_CTX"); |
| @@ -1189,7 +1201,8 @@ test_tlsext_ecpf_server(void) | |||
| 1189 | * Cannot parse a non-default list without at least uncompressed. | 1201 | * Cannot parse a non-default list without at least uncompressed. |
| 1190 | */ | 1202 | */ |
| 1191 | CBB_cleanup(&cbb); | 1203 | CBB_cleanup(&cbb); |
| 1192 | CBB_init(&cbb, 0); | 1204 | if (!CBB_init(&cbb, 0)) |
| 1205 | errx(1, "Failed to create CBB"); | ||
| 1193 | free(data); | 1206 | free(data); |
| 1194 | data = NULL; | 1207 | data = NULL; |
| 1195 | 1208 | ||
| @@ -1212,7 +1225,8 @@ test_tlsext_ecpf_server(void) | |||
| 1212 | * Test with a custom order that replaces the default uncompressed. | 1225 | * Test with a custom order that replaces the default uncompressed. |
| 1213 | */ | 1226 | */ |
| 1214 | CBB_cleanup(&cbb); | 1227 | CBB_cleanup(&cbb); |
| 1215 | CBB_init(&cbb, 0); | 1228 | if (!CBB_init(&cbb, 0)) |
| 1229 | errx(1, "Failed to create CBB"); | ||
| 1216 | free(data); | 1230 | free(data); |
| 1217 | data = NULL; | 1231 | data = NULL; |
| 1218 | 1232 | ||
| @@ -1272,7 +1286,8 @@ test_tlsext_ecpf_server(void) | |||
| 1272 | * Should be able to parse the custom list into a session list. | 1286 | * Should be able to parse the custom list into a session list. |
| 1273 | */ | 1287 | */ |
| 1274 | CBB_cleanup(&cbb); | 1288 | CBB_cleanup(&cbb); |
| 1275 | CBB_init(&cbb, 0); | 1289 | if (!CBB_init(&cbb, 0)) |
| 1290 | errx(1, "Failed to create CBB"); | ||
| 1276 | free(data); | 1291 | free(data); |
| 1277 | data = NULL; | 1292 | data = NULL; |
| 1278 | 1293 | ||
| @@ -1365,7 +1380,8 @@ test_tlsext_ri_client(void) | |||
| 1365 | 1380 | ||
| 1366 | failure = 1; | 1381 | failure = 1; |
| 1367 | 1382 | ||
| 1368 | CBB_init(&cbb, 0); | 1383 | if (!CBB_init(&cbb, 0)) |
| 1384 | errx(1, "Failed to create CBB"); | ||
| 1369 | 1385 | ||
| 1370 | if ((ssl_ctx = SSL_CTX_new(TLSv1_2_client_method())) == NULL) | 1386 | if ((ssl_ctx = SSL_CTX_new(TLSv1_2_client_method())) == NULL) |
| 1371 | errx(1, "failed to create SSL_CTX"); | 1387 | errx(1, "failed to create SSL_CTX"); |
| @@ -1483,7 +1499,8 @@ test_tlsext_ri_server(void) | |||
| 1483 | 1499 | ||
| 1484 | failure = 1; | 1500 | failure = 1; |
| 1485 | 1501 | ||
| 1486 | CBB_init(&cbb, 0); | 1502 | if (!CBB_init(&cbb, 0)) |
| 1503 | errx(1, "Failed to create CBB"); | ||
| 1487 | 1504 | ||
| 1488 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) | 1505 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) |
| 1489 | errx(1, "failed to create SSL_CTX"); | 1506 | errx(1, "failed to create SSL_CTX"); |
| @@ -1612,7 +1629,8 @@ test_tlsext_sigalgs_client(void) | |||
| 1612 | CBB cbb; | 1629 | CBB cbb; |
| 1613 | CBS cbs; | 1630 | CBS cbs; |
| 1614 | 1631 | ||
| 1615 | CBB_init(&cbb, 0); | 1632 | if (!CBB_init(&cbb, 0)) |
| 1633 | errx(1, "Failed to create CBB"); | ||
| 1616 | 1634 | ||
| 1617 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 1635 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 1618 | errx(1, "failed to create SSL_CTX"); | 1636 | errx(1, "failed to create SSL_CTX"); |
| @@ -1700,7 +1718,8 @@ test_tlsext_sigalgs_server(void) | |||
| 1700 | CBB cbb; | 1718 | CBB cbb; |
| 1701 | CBS cbs; | 1719 | CBS cbs; |
| 1702 | 1720 | ||
| 1703 | CBB_init(&cbb, 0); | 1721 | if (!CBB_init(&cbb, 0)) |
| 1722 | errx(1, "Failed to create CBB"); | ||
| 1704 | 1723 | ||
| 1705 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) | 1724 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) |
| 1706 | errx(1, "failed to create SSL_CTX"); | 1725 | errx(1, "failed to create SSL_CTX"); |
| @@ -1784,7 +1803,8 @@ test_tlsext_sni_client(void) | |||
| 1784 | &server_funcs)) | 1803 | &server_funcs)) |
| 1785 | errx(1, "failed to fetch sni funcs"); | 1804 | errx(1, "failed to fetch sni funcs"); |
| 1786 | 1805 | ||
| 1787 | CBB_init(&cbb, 0); | 1806 | if (!CBB_init(&cbb, 0)) |
| 1807 | errx(1, "Failed to create CBB"); | ||
| 1788 | 1808 | ||
| 1789 | if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) { | 1809 | if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) { |
| 1790 | FAIL("client should not need SNI\n"); | 1810 | FAIL("client should not need SNI\n"); |
| @@ -1912,7 +1932,8 @@ test_tlsext_sni_server(void) | |||
| 1912 | 1932 | ||
| 1913 | failure = 1; | 1933 | failure = 1; |
| 1914 | 1934 | ||
| 1915 | CBB_init(&cbb, 0); | 1935 | if (!CBB_init(&cbb, 0)) |
| 1936 | errx(1, "Failed to create CBB"); | ||
| 1916 | 1937 | ||
| 1917 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) | 1938 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) |
| 1918 | errx(1, "failed to create SSL_CTX"); | 1939 | errx(1, "failed to create SSL_CTX"); |
| @@ -2044,7 +2065,8 @@ test_tlsext_quic_transport_parameters_client(void) | |||
| 2044 | &client_funcs, &server_funcs)) | 2065 | &client_funcs, &server_funcs)) |
| 2045 | errx(1, "failed to fetch quic transport parameter funcs"); | 2066 | errx(1, "failed to fetch quic transport parameter funcs"); |
| 2046 | 2067 | ||
| 2047 | CBB_init(&cbb, 0); | 2068 | if (!CBB_init(&cbb, 0)) |
| 2069 | errx(1, "Failed to create CBB"); | ||
| 2048 | 2070 | ||
| 2049 | if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) { | 2071 | if (client_funcs->needs(ssl, SSL_TLSEXT_MSG_CH)) { |
| 2050 | FAIL("client should not need QUIC\n"); | 2072 | FAIL("client should not need QUIC\n"); |
| @@ -2165,7 +2187,8 @@ test_tlsext_quic_transport_parameters_server(void) | |||
| 2165 | 2187 | ||
| 2166 | failure = 1; | 2188 | failure = 1; |
| 2167 | 2189 | ||
| 2168 | CBB_init(&cbb, 0); | 2190 | if (!CBB_init(&cbb, 0)) |
| 2191 | errx(1, "Failed to create CBB"); | ||
| 2169 | 2192 | ||
| 2170 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) | 2193 | if ((ssl_ctx = SSL_CTX_new(TLS_server_method())) == NULL) |
| 2171 | errx(1, "failed to create SSL_CTX"); | 2194 | errx(1, "failed to create SSL_CTX"); |
| @@ -2294,7 +2317,8 @@ test_tlsext_ocsp_client(void) | |||
| 2294 | 2317 | ||
| 2295 | failure = 1; | 2318 | failure = 1; |
| 2296 | 2319 | ||
| 2297 | CBB_init(&cbb, 0); | 2320 | if (!CBB_init(&cbb, 0)) |
| 2321 | errx(1, "Failed to create CBB"); | ||
| 2298 | 2322 | ||
| 2299 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 2323 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 2300 | errx(1, "failed to create SSL_CTX"); | 2324 | errx(1, "failed to create SSL_CTX"); |
| @@ -2373,7 +2397,8 @@ test_tlsext_ocsp_server(void) | |||
| 2373 | 2397 | ||
| 2374 | failure = 1; | 2398 | failure = 1; |
| 2375 | 2399 | ||
| 2376 | CBB_init(&cbb, 0); | 2400 | if (!CBB_init(&cbb, 0)) |
| 2401 | errx(1, "Failed to create CBB"); | ||
| 2377 | 2402 | ||
| 2378 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 2403 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 2379 | errx(1, "failed to create SSL_CTX"); | 2404 | errx(1, "failed to create SSL_CTX"); |
| @@ -2439,7 +2464,8 @@ test_tlsext_sessionticket_client(void) | |||
| 2439 | 2464 | ||
| 2440 | failure = 1; | 2465 | failure = 1; |
| 2441 | 2466 | ||
| 2442 | CBB_init(&cbb, 0); | 2467 | if (!CBB_init(&cbb, 0)) |
| 2468 | errx(1, "Failed to create CBB"); | ||
| 2443 | 2469 | ||
| 2444 | /* Create fake session tickets with random data. */ | 2470 | /* Create fake session tickets with random data. */ |
| 2445 | arc4random_buf(tlsext_sessionticket_hello_min, | 2471 | arc4random_buf(tlsext_sessionticket_hello_min, |
| @@ -2498,7 +2524,8 @@ test_tlsext_sessionticket_client(void) | |||
| 2498 | } | 2524 | } |
| 2499 | 2525 | ||
| 2500 | CBB_cleanup(&cbb); | 2526 | CBB_cleanup(&cbb); |
| 2501 | CBB_init(&cbb, 0); | 2527 | if (!CBB_init(&cbb, 0)) |
| 2528 | errx(1, "Failed to create CBB"); | ||
| 2502 | free(data); | 2529 | free(data); |
| 2503 | data = NULL; | 2530 | data = NULL; |
| 2504 | 2531 | ||
| @@ -2523,7 +2550,8 @@ test_tlsext_sessionticket_client(void) | |||
| 2523 | } | 2550 | } |
| 2524 | 2551 | ||
| 2525 | CBB_cleanup(&cbb); | 2552 | CBB_cleanup(&cbb); |
| 2526 | CBB_init(&cbb, 0); | 2553 | if (!CBB_init(&cbb, 0)) |
| 2554 | errx(1, "Failed to create CBB"); | ||
| 2527 | free(data); | 2555 | free(data); |
| 2528 | data = NULL; | 2556 | data = NULL; |
| 2529 | 2557 | ||
| @@ -2563,7 +2591,8 @@ test_tlsext_sessionticket_client(void) | |||
| 2563 | } | 2591 | } |
| 2564 | 2592 | ||
| 2565 | CBB_cleanup(&cbb); | 2593 | CBB_cleanup(&cbb); |
| 2566 | CBB_init(&cbb, 0); | 2594 | if (!CBB_init(&cbb, 0)) |
| 2595 | errx(1, "Failed to create CBB"); | ||
| 2567 | free(data); | 2596 | free(data); |
| 2568 | data = NULL; | 2597 | data = NULL; |
| 2569 | free(ssl->session->tlsext_tick); | 2598 | free(ssl->session->tlsext_tick); |
| @@ -2652,7 +2681,8 @@ test_tlsext_sessionticket_server(void) | |||
| 2652 | size_t dlen; | 2681 | size_t dlen; |
| 2653 | CBB cbb; | 2682 | CBB cbb; |
| 2654 | 2683 | ||
| 2655 | CBB_init(&cbb, 0); | 2684 | if (!CBB_init(&cbb, 0)) |
| 2685 | errx(1, "Failed to create CBB"); | ||
| 2656 | 2686 | ||
| 2657 | failure = 1; | 2687 | failure = 1; |
| 2658 | 2688 | ||
| @@ -2790,7 +2820,8 @@ test_tlsext_srtp_client(void) | |||
| 2790 | int failure, alert; | 2820 | int failure, alert; |
| 2791 | size_t dlen; | 2821 | size_t dlen; |
| 2792 | 2822 | ||
| 2793 | CBB_init(&cbb, 0); | 2823 | if (!CBB_init(&cbb, 0)) |
| 2824 | errx(1, "Failed to create CBB"); | ||
| 2794 | 2825 | ||
| 2795 | failure = 1; | 2826 | failure = 1; |
| 2796 | 2827 | ||
| @@ -2844,7 +2875,8 @@ test_tlsext_srtp_client(void) | |||
| 2844 | } | 2875 | } |
| 2845 | 2876 | ||
| 2846 | CBB_cleanup(&cbb); | 2877 | CBB_cleanup(&cbb); |
| 2847 | CBB_init(&cbb, 0); | 2878 | if (!CBB_init(&cbb, 0)) |
| 2879 | errx(1, "Failed to create CBB"); | ||
| 2848 | free(data); | 2880 | free(data); |
| 2849 | data = NULL; | 2881 | data = NULL; |
| 2850 | 2882 | ||
| @@ -2913,7 +2945,8 @@ test_tlsext_srtp_client(void) | |||
| 2913 | } | 2945 | } |
| 2914 | 2946 | ||
| 2915 | CBB_cleanup(&cbb); | 2947 | CBB_cleanup(&cbb); |
| 2916 | CBB_init(&cbb, 0); | 2948 | if (!CBB_init(&cbb, 0)) |
| 2949 | errx(1, "Failed to create CBB"); | ||
| 2917 | free(data); | 2950 | free(data); |
| 2918 | data = NULL; | 2951 | data = NULL; |
| 2919 | 2952 | ||
| @@ -3027,7 +3060,8 @@ test_tlsext_srtp_server(void) | |||
| 3027 | int failure, alert; | 3060 | int failure, alert; |
| 3028 | size_t dlen; | 3061 | size_t dlen; |
| 3029 | 3062 | ||
| 3030 | CBB_init(&cbb, 0); | 3063 | if (!CBB_init(&cbb, 0)) |
| 3064 | errx(1, "Failed to create CBB"); | ||
| 3031 | 3065 | ||
| 3032 | failure = 1; | 3066 | failure = 1; |
| 3033 | 3067 | ||
| @@ -3083,7 +3117,8 @@ test_tlsext_srtp_server(void) | |||
| 3083 | } | 3117 | } |
| 3084 | 3118 | ||
| 3085 | CBB_cleanup(&cbb); | 3119 | CBB_cleanup(&cbb); |
| 3086 | CBB_init(&cbb, 0); | 3120 | if (!CBB_init(&cbb, 0)) |
| 3121 | errx(1, "Failed to create CBB"); | ||
| 3087 | free(data); | 3122 | free(data); |
| 3088 | data = NULL; | 3123 | data = NULL; |
| 3089 | 3124 | ||
| @@ -3225,7 +3260,8 @@ test_tlsext_clienthello_build(void) | |||
| 3225 | free(data); | 3260 | free(data); |
| 3226 | data = NULL; | 3261 | data = NULL; |
| 3227 | CBB_cleanup(&cbb); | 3262 | CBB_cleanup(&cbb); |
| 3228 | CBB_init(&cbb, 0); | 3263 | if (!CBB_init(&cbb, 0)) |
| 3264 | errx(1, "Failed to create CBB"); | ||
| 3229 | 3265 | ||
| 3230 | /* Switch to TLSv1.1, disable EC ciphers and session tickets. */ | 3266 | /* Switch to TLSv1.1, disable EC ciphers and session tickets. */ |
| 3231 | ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION; | 3267 | ssl->s3->hs.our_max_tls_version = TLS1_1_VERSION; |
| @@ -3343,7 +3379,8 @@ test_tlsext_serverhello_build(void) | |||
| 3343 | CBB_cleanup(&cbb); | 3379 | CBB_cleanup(&cbb); |
| 3344 | free(data); | 3380 | free(data); |
| 3345 | data = NULL; | 3381 | data = NULL; |
| 3346 | CBB_init(&cbb, 0); | 3382 | if (!CBB_init(&cbb, 0)) |
| 3383 | errx(1, "Failed to create CBB"); | ||
| 3347 | 3384 | ||
| 3348 | /* Turn a few things on so we get extensions... */ | 3385 | /* Turn a few things on so we get extensions... */ |
| 3349 | ssl->s3->send_connection_binding = 1; | 3386 | ssl->s3->send_connection_binding = 1; |
| @@ -3417,7 +3454,8 @@ test_tlsext_versions_client(void) | |||
| 3417 | CBB cbb; | 3454 | CBB cbb; |
| 3418 | CBS cbs; | 3455 | CBS cbs; |
| 3419 | 3456 | ||
| 3420 | CBB_init(&cbb, 0); | 3457 | if (!CBB_init(&cbb, 0)) |
| 3458 | errx(1, "Failed to create CBB"); | ||
| 3421 | 3459 | ||
| 3422 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 3460 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 3423 | errx(1, "failed to create SSL_CTX"); | 3461 | errx(1, "failed to create SSL_CTX"); |
| @@ -3508,7 +3546,8 @@ test_tlsext_versions_server(void) | |||
| 3508 | CBB cbb; | 3546 | CBB cbb; |
| 3509 | CBS cbs; | 3547 | CBS cbs; |
| 3510 | 3548 | ||
| 3511 | CBB_init(&cbb, 0); | 3549 | if (!CBB_init(&cbb, 0)) |
| 3550 | errx(1, "Failed to create CBB"); | ||
| 3512 | 3551 | ||
| 3513 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 3552 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 3514 | errx(1, "failed to create SSL_CTX"); | 3553 | errx(1, "failed to create SSL_CTX"); |
| @@ -3604,7 +3643,8 @@ test_tlsext_keyshare_client(void) | |||
| 3604 | CBB cbb; | 3643 | CBB cbb; |
| 3605 | CBS cbs; | 3644 | CBS cbs; |
| 3606 | 3645 | ||
| 3607 | CBB_init(&cbb, 0); | 3646 | if (!CBB_init(&cbb, 0)) |
| 3647 | errx(1, "Failed to create CBB"); | ||
| 3608 | 3648 | ||
| 3609 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 3649 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 3610 | errx(1, "failed to create SSL_CTX"); | 3650 | errx(1, "failed to create SSL_CTX"); |
| @@ -3710,7 +3750,8 @@ test_tlsext_keyshare_server(void) | |||
| 3710 | &server_funcs)) | 3750 | &server_funcs)) |
| 3711 | errx(1, "failed to fetch keyshare funcs"); | 3751 | errx(1, "failed to fetch keyshare funcs"); |
| 3712 | 3752 | ||
| 3713 | CBB_init(&cbb, 0); | 3753 | if (!CBB_init(&cbb, 0)) |
| 3754 | errx(1, "Failed to create CBB"); | ||
| 3714 | 3755 | ||
| 3715 | ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION; | 3756 | ssl->s3->hs.negotiated_tls_version = TLS1_2_VERSION; |
| 3716 | if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) { | 3757 | if (server_funcs->needs(ssl, SSL_TLSEXT_MSG_SH)) { |
| @@ -3832,7 +3873,8 @@ test_tlsext_cookie_client(void) | |||
| 3832 | CBB cbb; | 3873 | CBB cbb; |
| 3833 | CBS cbs; | 3874 | CBS cbs; |
| 3834 | 3875 | ||
| 3835 | CBB_init(&cbb, 0); | 3876 | if (!CBB_init(&cbb, 0)) |
| 3877 | errx(1, "Failed to create CBB"); | ||
| 3836 | 3878 | ||
| 3837 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 3879 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 3838 | errx(1, "failed to create SSL_CTX"); | 3880 | errx(1, "failed to create SSL_CTX"); |
| @@ -3926,7 +3968,8 @@ test_tlsext_cookie_server(void) | |||
| 3926 | CBB cbb; | 3968 | CBB cbb; |
| 3927 | CBS cbs; | 3969 | CBS cbs; |
| 3928 | 3970 | ||
| 3929 | CBB_init(&cbb, 0); | 3971 | if (!CBB_init(&cbb, 0)) |
| 3972 | errx(1, "Failed to create CBB"); | ||
| 3930 | 3973 | ||
| 3931 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) | 3974 | if ((ssl_ctx = SSL_CTX_new(TLS_client_method())) == NULL) |
| 3932 | errx(1, "failed to create SSL_CTX"); | 3975 | errx(1, "failed to create SSL_CTX"); |
| @@ -4047,7 +4090,8 @@ test_tlsext_psk_modes_client(void) | |||
| 4047 | CBS cbs; | 4090 | CBS cbs; |
| 4048 | int alert; | 4091 | int alert; |
| 4049 | 4092 | ||
| 4050 | CBB_init(&cbb, 0); | 4093 | if (!CBB_init(&cbb, 0)) |
| 4094 | errx(1, "Failed to create CBB"); | ||
| 4051 | 4095 | ||
| 4052 | failure = 1; | 4096 | failure = 1; |
| 4053 | 4097 | ||
