diff options
author | tb <> | 2020-05-24 15:10:06 +0000 |
---|---|---|
committer | tb <> | 2020-05-24 15:10:06 +0000 |
commit | 2cf326c9539514d11a4cad4647b09d1c3e8e1d48 (patch) | |
tree | 033e8aa6b30e8c138a6adcd23cf62283913f69b4 | |
parent | b3f91ed9f62967ca942230fe244f1403cbe05a2b (diff) | |
download | openbsd-2cf326c9539514d11a4cad4647b09d1c3e8e1d48.tar.gz openbsd-2cf326c9539514d11a4cad4647b09d1c3e8e1d48.tar.bz2 openbsd-2cf326c9539514d11a4cad4647b09d1c3e8e1d48.zip |
include newlines in FAIL messages
-rw-r--r-- | src/regress/lib/libssl/tlsext/tlsexttest.c | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c index 7c61ec40dd..171c77580f 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.38 2020/05/24 14:35:26 tb Exp $ */ | 1 | /* $OpenBSD: tlsexttest.c,v 1.39 2020/05/24 15:10:06 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> |
@@ -141,7 +141,7 @@ test_tlsext_alpn_client(void) | |||
141 | 141 | ||
142 | /* By default, we don't need this */ | 142 | /* By default, we don't need this */ |
143 | if (tlsext_alpn_client_needs(ssl)) { | 143 | if (tlsext_alpn_client_needs(ssl)) { |
144 | FAIL("client should not need ALPN by default"); | 144 | FAIL("client should not need ALPN by default\n"); |
145 | goto err; | 145 | goto err; |
146 | } | 146 | } |
147 | 147 | ||
@@ -154,11 +154,11 @@ test_tlsext_alpn_client(void) | |||
154 | */ | 154 | */ |
155 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val, | 155 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val, |
156 | sizeof(tlsext_alpn_single_proto_val)) != 0) { | 156 | sizeof(tlsext_alpn_single_proto_val)) != 0) { |
157 | FAIL("should be able to set ALPN to http/1.1"); | 157 | FAIL("should be able to set ALPN to http/1.1\n"); |
158 | goto err; | 158 | goto err; |
159 | } | 159 | } |
160 | if (!tlsext_alpn_client_needs(ssl)) { | 160 | if (!tlsext_alpn_client_needs(ssl)) { |
161 | FAIL("client should need ALPN by now"); | 161 | FAIL("client should need ALPN by now\n"); |
162 | goto err; | 162 | goto err; |
163 | } | 163 | } |
164 | 164 | ||
@@ -169,7 +169,7 @@ test_tlsext_alpn_client(void) | |||
169 | goto err; | 169 | goto err; |
170 | } | 170 | } |
171 | if (!CBB_finish(&cbb, &data, &dlen)) | 171 | if (!CBB_finish(&cbb, &data, &dlen)) |
172 | errx(1, "failed to finish CBB"); | 172 | errx(1, "failed to finish CBB\n"); |
173 | 173 | ||
174 | if (dlen != sizeof(tlsext_alpn_single_proto)) { | 174 | if (dlen != sizeof(tlsext_alpn_single_proto)) { |
175 | FAIL("got client ALPN with length %zu, " | 175 | FAIL("got client ALPN with length %zu, " |
@@ -196,11 +196,11 @@ test_tlsext_alpn_client(void) | |||
196 | CBS_init(&cbs, tlsext_alpn_single_proto, | 196 | CBS_init(&cbs, tlsext_alpn_single_proto, |
197 | sizeof(tlsext_alpn_single_proto)); | 197 | sizeof(tlsext_alpn_single_proto)); |
198 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { | 198 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { |
199 | FAIL("failed to parse ALPN"); | 199 | FAIL("failed to parse ALPN\n"); |
200 | goto err; | 200 | goto err; |
201 | } | 201 | } |
202 | if (CBS_len(&cbs) != 0) { | 202 | if (CBS_len(&cbs) != 0) { |
203 | FAIL("extension data remaining"); | 203 | FAIL("extension data remaining\n"); |
204 | goto err; | 204 | goto err; |
205 | } | 205 | } |
206 | 206 | ||
@@ -228,11 +228,11 @@ test_tlsext_alpn_client(void) | |||
228 | 228 | ||
229 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_multiple_protos_val, | 229 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_multiple_protos_val, |
230 | sizeof(tlsext_alpn_multiple_protos_val)) != 0) { | 230 | sizeof(tlsext_alpn_multiple_protos_val)) != 0) { |
231 | FAIL("should be able to set ALPN to http/1.1"); | 231 | FAIL("should be able to set ALPN to http/1.1\n"); |
232 | goto err; | 232 | goto err; |
233 | } | 233 | } |
234 | if (!tlsext_alpn_client_needs(ssl)) { | 234 | if (!tlsext_alpn_client_needs(ssl)) { |
235 | FAIL("client should need ALPN by now"); | 235 | FAIL("client should need ALPN by now\n"); |
236 | goto err; | 236 | goto err; |
237 | } | 237 | } |
238 | 238 | ||
@@ -241,7 +241,7 @@ test_tlsext_alpn_client(void) | |||
241 | goto err; | 241 | goto err; |
242 | } | 242 | } |
243 | if (!CBB_finish(&cbb, &data, &dlen)) | 243 | if (!CBB_finish(&cbb, &data, &dlen)) |
244 | errx(1, "failed to finish CBB"); | 244 | errx(1, "failed to finish CBB\n"); |
245 | 245 | ||
246 | if (dlen != sizeof(tlsext_alpn_multiple_protos)) { | 246 | if (dlen != sizeof(tlsext_alpn_multiple_protos)) { |
247 | FAIL("got client ALPN with length %zu, " | 247 | FAIL("got client ALPN with length %zu, " |
@@ -263,11 +263,11 @@ test_tlsext_alpn_client(void) | |||
263 | CBS_init(&cbs, tlsext_alpn_multiple_protos, | 263 | CBS_init(&cbs, tlsext_alpn_multiple_protos, |
264 | sizeof(tlsext_alpn_multiple_protos)); | 264 | sizeof(tlsext_alpn_multiple_protos)); |
265 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { | 265 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { |
266 | FAIL("failed to parse ALPN"); | 266 | FAIL("failed to parse ALPN\n"); |
267 | goto err; | 267 | goto err; |
268 | } | 268 | } |
269 | if (CBS_len(&cbs) != 0) { | 269 | if (CBS_len(&cbs) != 0) { |
270 | FAIL("extension data remaining"); | 270 | FAIL("extension data remaining\n"); |
271 | goto err; | 271 | goto err; |
272 | } | 272 | } |
273 | 273 | ||
@@ -298,7 +298,7 @@ test_tlsext_alpn_client(void) | |||
298 | ssl->internal->alpn_client_proto_list_len = 0; | 298 | ssl->internal->alpn_client_proto_list_len = 0; |
299 | 299 | ||
300 | if (tlsext_alpn_client_needs(ssl)) { | 300 | if (tlsext_alpn_client_needs(ssl)) { |
301 | FAIL("client should need ALPN by default"); | 301 | FAIL("client should need ALPN by default\n"); |
302 | goto err; | 302 | goto err; |
303 | } | 303 | } |
304 | 304 | ||
@@ -360,11 +360,11 @@ test_tlsext_alpn_server(void) | |||
360 | /* Make sure we can build a server with one protocol */ | 360 | /* Make sure we can build a server with one protocol */ |
361 | 361 | ||
362 | if (!tlsext_alpn_server_build(ssl, &cbb)) { | 362 | if (!tlsext_alpn_server_build(ssl, &cbb)) { |
363 | FAIL("server should be able to build a response"); | 363 | FAIL("server should be able to build a response\n"); |
364 | goto err; | 364 | goto err; |
365 | } | 365 | } |
366 | if (!CBB_finish(&cbb, &data, &dlen)) | 366 | if (!CBB_finish(&cbb, &data, &dlen)) |
367 | errx(1, "failed to finish CBB"); | 367 | errx(1, "failed to finish CBB\n"); |
368 | 368 | ||
369 | if (dlen != sizeof(tlsext_alpn_single_proto)) { | 369 | if (dlen != sizeof(tlsext_alpn_single_proto)) { |
370 | FAIL("got client ALPN with length %zu, " | 370 | FAIL("got client ALPN with length %zu, " |
@@ -393,22 +393,22 @@ test_tlsext_alpn_server(void) | |||
393 | 393 | ||
394 | /* Shouldn't be able to parse without requesting */ | 394 | /* Shouldn't be able to parse without requesting */ |
395 | if (tlsext_alpn_client_parse(ssl, &cbs, &alert)) { | 395 | if (tlsext_alpn_client_parse(ssl, &cbs, &alert)) { |
396 | FAIL("Should only parse server if we requested it"); | 396 | FAIL("Should only parse server if we requested it\n"); |
397 | goto err; | 397 | goto err; |
398 | } | 398 | } |
399 | 399 | ||
400 | /* Should be able to parse once requested. */ | 400 | /* Should be able to parse once requested. */ |
401 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val, | 401 | if (SSL_set_alpn_protos(ssl, tlsext_alpn_single_proto_val, |
402 | sizeof(tlsext_alpn_single_proto_val)) != 0) { | 402 | sizeof(tlsext_alpn_single_proto_val)) != 0) { |
403 | FAIL("should be able to set ALPN to http/1.1"); | 403 | FAIL("should be able to set ALPN to http/1.1\n"); |
404 | goto err; | 404 | goto err; |
405 | } | 405 | } |
406 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { | 406 | if (!tlsext_alpn_server_parse(ssl, &cbs, &alert)) { |
407 | FAIL("Should be able to parse server when we request it"); | 407 | FAIL("Should be able to parse server when we request it\n"); |
408 | goto err; | 408 | goto err; |
409 | } | 409 | } |
410 | if (CBS_len(&cbs) != 0) { | 410 | if (CBS_len(&cbs) != 0) { |
411 | FAIL("extension data remaining"); | 411 | FAIL("extension data remaining\n"); |
412 | goto err; | 412 | goto err; |
413 | } | 413 | } |
414 | 414 | ||
@@ -447,7 +447,7 @@ test_tlsext_alpn_server(void) | |||
447 | S3I(ssl)->alpn_selected_len = 0; | 447 | S3I(ssl)->alpn_selected_len = 0; |
448 | 448 | ||
449 | if (tlsext_alpn_server_needs(ssl)) { | 449 | if (tlsext_alpn_server_needs(ssl)) { |
450 | FAIL("server should need ALPN by default"); | 450 | FAIL("server should need ALPN by default\n"); |
451 | goto err; | 451 | goto err; |
452 | } | 452 | } |
453 | 453 | ||
@@ -574,7 +574,7 @@ test_tlsext_supportedgroups_client(void) | |||
574 | } | 574 | } |
575 | 575 | ||
576 | if (!CBB_finish(&cbb, &data, &dlen)) | 576 | if (!CBB_finish(&cbb, &data, &dlen)) |
577 | errx(1, "failed to finish CBB"); | 577 | errx(1, "failed to finish CBB\n"); |
578 | 578 | ||
579 | if (dlen != sizeof(tlsext_supportedgroups_client_default)) { | 579 | if (dlen != sizeof(tlsext_supportedgroups_client_default)) { |
580 | FAIL("got client Ellipticcurves with length %zu, " | 580 | FAIL("got client Ellipticcurves with length %zu, " |
@@ -611,7 +611,7 @@ test_tlsext_supportedgroups_client(void) | |||
611 | goto err; | 611 | goto err; |
612 | } | 612 | } |
613 | if (CBS_len(&cbs) != 0) { | 613 | if (CBS_len(&cbs) != 0) { |
614 | FAIL("extension data remaining"); | 614 | FAIL("extension data remaining\n"); |
615 | goto err; | 615 | goto err; |
616 | } | 616 | } |
617 | 617 | ||
@@ -663,7 +663,7 @@ test_tlsext_supportedgroups_client(void) | |||
663 | } | 663 | } |
664 | 664 | ||
665 | if (!CBB_finish(&cbb, &data, &dlen)) | 665 | if (!CBB_finish(&cbb, &data, &dlen)) |
666 | errx(1, "failed to finish CBB"); | 666 | errx(1, "failed to finish CBB\n"); |
667 | 667 | ||
668 | if (dlen != sizeof(tlsext_supportedgroups_client_nistp192and224)) { | 668 | if (dlen != sizeof(tlsext_supportedgroups_client_nistp192and224)) { |
669 | FAIL("got client Ellipticcurves with length %zu, " | 669 | FAIL("got client Ellipticcurves with length %zu, " |
@@ -711,7 +711,7 @@ test_tlsext_supportedgroups_client(void) | |||
711 | goto err; | 711 | goto err; |
712 | } | 712 | } |
713 | if (CBS_len(&cbs) != 0) { | 713 | if (CBS_len(&cbs) != 0) { |
714 | FAIL("extension data remaining"); | 714 | FAIL("extension data remaining\n"); |
715 | goto err; | 715 | goto err; |
716 | } | 716 | } |
717 | 717 | ||
@@ -879,7 +879,7 @@ test_tlsext_ecpf_client(void) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | if (!CBB_finish(&cbb, &data, &dlen)) | 881 | if (!CBB_finish(&cbb, &data, &dlen)) |
882 | errx(1, "failed to finish CBB"); | 882 | errx(1, "failed to finish CBB\n"); |
883 | 883 | ||
884 | if (dlen != sizeof(tlsext_ecpf_hello_uncompressed)) { | 884 | if (dlen != sizeof(tlsext_ecpf_hello_uncompressed)) { |
885 | FAIL("got client ECPointFormats with length %zu, " | 885 | FAIL("got client ECPointFormats with length %zu, " |
@@ -916,7 +916,7 @@ test_tlsext_ecpf_client(void) | |||
916 | goto err; | 916 | goto err; |
917 | } | 917 | } |
918 | if (CBS_len(&cbs) != 0) { | 918 | if (CBS_len(&cbs) != 0) { |
919 | FAIL("extension data remaining"); | 919 | FAIL("extension data remaining\n"); |
920 | goto err; | 920 | goto err; |
921 | } | 921 | } |
922 | 922 | ||
@@ -967,7 +967,7 @@ test_tlsext_ecpf_client(void) | |||
967 | } | 967 | } |
968 | 968 | ||
969 | if (!CBB_finish(&cbb, &data, &dlen)) | 969 | if (!CBB_finish(&cbb, &data, &dlen)) |
970 | errx(1, "failed to finish CBB"); | 970 | errx(1, "failed to finish CBB\n"); |
971 | 971 | ||
972 | if (dlen != sizeof(tlsext_ecpf_hello_prefer_order)) { | 972 | if (dlen != sizeof(tlsext_ecpf_hello_prefer_order)) { |
973 | FAIL("got client ECPointFormats with length %zu, " | 973 | FAIL("got client ECPointFormats with length %zu, " |
@@ -1009,7 +1009,7 @@ test_tlsext_ecpf_client(void) | |||
1009 | goto err; | 1009 | goto err; |
1010 | } | 1010 | } |
1011 | if (CBS_len(&cbs) != 0) { | 1011 | if (CBS_len(&cbs) != 0) { |
1012 | FAIL("extension data remaining"); | 1012 | FAIL("extension data remaining\n"); |
1013 | goto err; | 1013 | goto err; |
1014 | } | 1014 | } |
1015 | 1015 | ||
@@ -1092,7 +1092,7 @@ test_tlsext_ecpf_server(void) | |||
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | if (!CBB_finish(&cbb, &data, &dlen)) | 1094 | if (!CBB_finish(&cbb, &data, &dlen)) |
1095 | errx(1, "failed to finish CBB"); | 1095 | errx(1, "failed to finish CBB\n"); |
1096 | 1096 | ||
1097 | if (dlen != sizeof(tlsext_ecpf_hello_uncompressed)) { | 1097 | if (dlen != sizeof(tlsext_ecpf_hello_uncompressed)) { |
1098 | FAIL("got server ECPointFormats with length %zu, " | 1098 | FAIL("got server ECPointFormats with length %zu, " |
@@ -1129,7 +1129,7 @@ test_tlsext_ecpf_server(void) | |||
1129 | goto err; | 1129 | goto err; |
1130 | } | 1130 | } |
1131 | if (CBS_len(&cbs) != 0) { | 1131 | if (CBS_len(&cbs) != 0) { |
1132 | FAIL("extension data remaining"); | 1132 | FAIL("extension data remaining\n"); |
1133 | goto err; | 1133 | goto err; |
1134 | } | 1134 | } |
1135 | 1135 | ||
@@ -1175,7 +1175,7 @@ test_tlsext_ecpf_server(void) | |||
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | if (!CBB_finish(&cbb, &data, &dlen)) | 1177 | if (!CBB_finish(&cbb, &data, &dlen)) |
1178 | errx(1, "failed to finish CBB"); | 1178 | errx(1, "failed to finish CBB\n"); |
1179 | 1179 | ||
1180 | if (dlen != sizeof(tlsext_ecpf_hello_prefer_order)) { | 1180 | if (dlen != sizeof(tlsext_ecpf_hello_prefer_order)) { |
1181 | FAIL("got server ECPointFormats with length %zu, " | 1181 | FAIL("got server ECPointFormats with length %zu, " |
@@ -1217,7 +1217,7 @@ test_tlsext_ecpf_server(void) | |||
1217 | goto err; | 1217 | goto err; |
1218 | } | 1218 | } |
1219 | if (CBS_len(&cbs) != 0) { | 1219 | if (CBS_len(&cbs) != 0) { |
1220 | FAIL("extension data remaining"); | 1220 | FAIL("extension data remaining\n"); |
1221 | goto err; | 1221 | goto err; |
1222 | } | 1222 | } |
1223 | 1223 | ||
@@ -1322,7 +1322,7 @@ test_tlsext_ri_client(void) | |||
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | if (!CBB_finish(&cbb, &data, &dlen)) | 1324 | if (!CBB_finish(&cbb, &data, &dlen)) |
1325 | errx(1, "failed to finish CBB"); | 1325 | errx(1, "failed to finish CBB\n"); |
1326 | 1326 | ||
1327 | if (dlen != sizeof(tlsext_ri_client)) { | 1327 | if (dlen != sizeof(tlsext_ri_client)) { |
1328 | FAIL("got client RI with length %zu, " | 1328 | FAIL("got client RI with length %zu, " |
@@ -1345,7 +1345,7 @@ test_tlsext_ri_client(void) | |||
1345 | goto err; | 1345 | goto err; |
1346 | } | 1346 | } |
1347 | if (CBS_len(&cbs) != 0) { | 1347 | if (CBS_len(&cbs) != 0) { |
1348 | FAIL("extension data remaining"); | 1348 | FAIL("extension data remaining\n"); |
1349 | goto err; | 1349 | goto err; |
1350 | } | 1350 | } |
1351 | 1351 | ||
@@ -1436,7 +1436,7 @@ test_tlsext_ri_server(void) | |||
1436 | } | 1436 | } |
1437 | 1437 | ||
1438 | if (!CBB_finish(&cbb, &data, &dlen)) | 1438 | if (!CBB_finish(&cbb, &data, &dlen)) |
1439 | errx(1, "failed to finish CBB"); | 1439 | errx(1, "failed to finish CBB\n"); |
1440 | 1440 | ||
1441 | if (dlen != sizeof(tlsext_ri_server)) { | 1441 | if (dlen != sizeof(tlsext_ri_server)) { |
1442 | FAIL("got server RI with length %zu, " | 1442 | FAIL("got server RI with length %zu, " |
@@ -1459,7 +1459,7 @@ test_tlsext_ri_server(void) | |||
1459 | goto err; | 1459 | goto err; |
1460 | } | 1460 | } |
1461 | if (CBS_len(&cbs) != 0) { | 1461 | if (CBS_len(&cbs) != 0) { |
1462 | FAIL("extension data remaining"); | 1462 | FAIL("extension data remaining\n"); |
1463 | goto err; | 1463 | goto err; |
1464 | } | 1464 | } |
1465 | 1465 | ||
@@ -1553,7 +1553,7 @@ test_tlsext_sigalgs_client(void) | |||
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | if (!CBB_finish(&cbb, &data, &dlen)) | 1555 | if (!CBB_finish(&cbb, &data, &dlen)) |
1556 | errx(1, "failed to finish CBB"); | 1556 | errx(1, "failed to finish CBB\n"); |
1557 | 1557 | ||
1558 | if (dlen != sizeof(tlsext_sigalgs_client)) { | 1558 | if (dlen != sizeof(tlsext_sigalgs_client)) { |
1559 | fprintf(stderr, "FAIL: got client sigalgs with length %zu, " | 1559 | fprintf(stderr, "FAIL: got client sigalgs with length %zu, " |
@@ -1579,7 +1579,7 @@ test_tlsext_sigalgs_client(void) | |||
1579 | goto done; | 1579 | goto done; |
1580 | } | 1580 | } |
1581 | if (CBS_len(&cbs) != 0) { | 1581 | if (CBS_len(&cbs) != 0) { |
1582 | FAIL("extension data remaining"); | 1582 | FAIL("extension data remaining\n"); |
1583 | goto done; | 1583 | goto done; |
1584 | } | 1584 | } |
1585 | 1585 | ||
@@ -1625,7 +1625,7 @@ test_tlsext_sigalgs_server(void) | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | if (!CBB_finish(&cbb, &data, &dlen)) | 1627 | if (!CBB_finish(&cbb, &data, &dlen)) |
1628 | errx(1, "failed to finish CBB"); | 1628 | errx(1, "failed to finish CBB\n"); |
1629 | 1629 | ||
1630 | CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client)); | 1630 | CBS_init(&cbs, tlsext_sigalgs_client, sizeof(tlsext_sigalgs_client)); |
1631 | if (tlsext_sigalgs_client_parse(ssl, &cbs, &alert)) { | 1631 | if (tlsext_sigalgs_client_parse(ssl, &cbs, &alert)) { |
@@ -1701,7 +1701,7 @@ test_tlsext_sni_client(void) | |||
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | if (!CBB_finish(&cbb, &data, &dlen)) | 1703 | if (!CBB_finish(&cbb, &data, &dlen)) |
1704 | errx(1, "failed to finish CBB"); | 1704 | errx(1, "failed to finish CBB\n"); |
1705 | 1705 | ||
1706 | if (dlen != sizeof(tlsext_sni_client)) { | 1706 | if (dlen != sizeof(tlsext_sni_client)) { |
1707 | FAIL("got client SNI with length %zu, " | 1707 | FAIL("got client SNI with length %zu, " |
@@ -1729,7 +1729,7 @@ test_tlsext_sni_client(void) | |||
1729 | goto err; | 1729 | goto err; |
1730 | } | 1730 | } |
1731 | if (CBS_len(&cbs) != 0) { | 1731 | if (CBS_len(&cbs) != 0) { |
1732 | FAIL("extension data remaining"); | 1732 | FAIL("extension data remaining\n"); |
1733 | goto err; | 1733 | goto err; |
1734 | } | 1734 | } |
1735 | 1735 | ||
@@ -1818,7 +1818,7 @@ test_tlsext_sni_server(void) | |||
1818 | } | 1818 | } |
1819 | 1819 | ||
1820 | if (!CBB_finish(&cbb, &data, &dlen)) | 1820 | if (!CBB_finish(&cbb, &data, &dlen)) |
1821 | errx(1, "failed to finish CBB"); | 1821 | errx(1, "failed to finish CBB\n"); |
1822 | 1822 | ||
1823 | if (dlen != sizeof(tlsext_sni_server)) { | 1823 | if (dlen != sizeof(tlsext_sni_server)) { |
1824 | FAIL("got server SNI with length %zu, " | 1824 | FAIL("got server SNI with length %zu, " |
@@ -1844,7 +1844,7 @@ test_tlsext_sni_server(void) | |||
1844 | goto err; | 1844 | goto err; |
1845 | } | 1845 | } |
1846 | if (CBS_len(&cbs) != 0) { | 1846 | if (CBS_len(&cbs) != 0) { |
1847 | FAIL("extension data remaining"); | 1847 | FAIL("extension data remaining\n"); |
1848 | goto err; | 1848 | goto err; |
1849 | } | 1849 | } |
1850 | 1850 | ||
@@ -1912,7 +1912,7 @@ test_tlsext_ocsp_client(void) | |||
1912 | goto err; | 1912 | goto err; |
1913 | } | 1913 | } |
1914 | if (!CBB_finish(&cbb, &data, &dlen)) | 1914 | if (!CBB_finish(&cbb, &data, &dlen)) |
1915 | errx(1, "failed to finish CBB"); | 1915 | errx(1, "failed to finish CBB\n"); |
1916 | 1916 | ||
1917 | if (dlen != sizeof(tls_ocsp_client_default)) { | 1917 | if (dlen != sizeof(tls_ocsp_client_default)) { |
1918 | FAIL("got ocsp client with length %zu, " | 1918 | FAIL("got ocsp client with length %zu, " |
@@ -1936,7 +1936,7 @@ test_tlsext_ocsp_client(void) | |||
1936 | goto err; | 1936 | goto err; |
1937 | } | 1937 | } |
1938 | if (CBS_len(&cbs) != 0) { | 1938 | if (CBS_len(&cbs) != 0) { |
1939 | FAIL("extension data remaining"); | 1939 | FAIL("extension data remaining\n"); |
1940 | goto err; | 1940 | goto err; |
1941 | } | 1941 | } |
1942 | 1942 | ||
@@ -1987,7 +1987,7 @@ test_tlsext_ocsp_server(void) | |||
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | if (!CBB_finish(&cbb, &data, &dlen)) | 1989 | if (!CBB_finish(&cbb, &data, &dlen)) |
1990 | errx(1, "failed to finish CBB"); | 1990 | errx(1, "failed to finish CBB\n"); |
1991 | 1991 | ||
1992 | failure = 0; | 1992 | failure = 0; |
1993 | 1993 | ||
@@ -2045,31 +2045,31 @@ test_tlsext_sessionticket_client(void) | |||
2045 | 2045 | ||
2046 | /* Test disabling tickets. */ | 2046 | /* Test disabling tickets. */ |
2047 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { | 2047 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { |
2048 | FAIL("Cannot disable tickets in the TLS connection"); | 2048 | FAIL("Cannot disable tickets in the TLS connection\n"); |
2049 | return 0; | 2049 | return 0; |
2050 | } | 2050 | } |
2051 | if (tlsext_sessionticket_client_needs(ssl)) { | 2051 | if (tlsext_sessionticket_client_needs(ssl)) { |
2052 | FAIL("client should not need SessionTicket if it was disabled"); | 2052 | FAIL("client should not need SessionTicket if it was disabled\n"); |
2053 | goto err; | 2053 | goto err; |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | /* Test re-enabling tickets. */ | 2056 | /* Test re-enabling tickets. */ |
2057 | if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) { | 2057 | if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) { |
2058 | FAIL("Cannot re-enable tickets in the TLS connection"); | 2058 | FAIL("Cannot re-enable tickets in the TLS connection\n"); |
2059 | return 0; | 2059 | return 0; |
2060 | } | 2060 | } |
2061 | if (!tlsext_sessionticket_client_needs(ssl)) { | 2061 | if (!tlsext_sessionticket_client_needs(ssl)) { |
2062 | FAIL("client should need SessionTicket if it was disabled"); | 2062 | FAIL("client should need SessionTicket if it was disabled\n"); |
2063 | goto err; | 2063 | goto err; |
2064 | } | 2064 | } |
2065 | 2065 | ||
2066 | /* Since we don't have a session, we should build an empty ticket. */ | 2066 | /* Since we don't have a session, we should build an empty ticket. */ |
2067 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { | 2067 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { |
2068 | FAIL("Cannot build a ticket"); | 2068 | FAIL("Cannot build a ticket\n"); |
2069 | goto err; | 2069 | goto err; |
2070 | } | 2070 | } |
2071 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2071 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2072 | FAIL("Cannot finish CBB"); | 2072 | FAIL("Cannot finish CBB\n"); |
2073 | goto err; | 2073 | goto err; |
2074 | } | 2074 | } |
2075 | if (dlen != 0) { | 2075 | if (dlen != 0) { |
@@ -2086,15 +2086,15 @@ test_tlsext_sessionticket_client(void) | |||
2086 | if ((ssl->session = SSL_SESSION_new()) == NULL) | 2086 | if ((ssl->session = SSL_SESSION_new()) == NULL) |
2087 | errx(1, "failed to create session"); | 2087 | errx(1, "failed to create session"); |
2088 | if (!tlsext_sessionticket_client_needs(ssl)) { | 2088 | if (!tlsext_sessionticket_client_needs(ssl)) { |
2089 | FAIL("Should still want a session ticket with a new session"); | 2089 | FAIL("Should still want a session ticket with a new session\n"); |
2090 | goto err; | 2090 | goto err; |
2091 | } | 2091 | } |
2092 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { | 2092 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { |
2093 | FAIL("Cannot build a ticket"); | 2093 | FAIL("Cannot build a ticket\n"); |
2094 | goto err; | 2094 | goto err; |
2095 | } | 2095 | } |
2096 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2096 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2097 | FAIL("Cannot finish CBB"); | 2097 | FAIL("Cannot finish CBB\n"); |
2098 | goto err; | 2098 | goto err; |
2099 | } | 2099 | } |
2100 | if (dlen != 0) { | 2100 | if (dlen != 0) { |
@@ -2120,15 +2120,15 @@ test_tlsext_sessionticket_client(void) | |||
2120 | ssl->session->tlsext_ticklen = sizeof(dummy); | 2120 | ssl->session->tlsext_ticklen = sizeof(dummy); |
2121 | 2121 | ||
2122 | if (!tlsext_sessionticket_client_needs(ssl)) { | 2122 | if (!tlsext_sessionticket_client_needs(ssl)) { |
2123 | FAIL("Should still want a session ticket with a new session"); | 2123 | FAIL("Should still want a session ticket with a new session\n"); |
2124 | goto err; | 2124 | goto err; |
2125 | } | 2125 | } |
2126 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { | 2126 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { |
2127 | FAIL("Cannot build a ticket"); | 2127 | FAIL("Cannot build a ticket\n"); |
2128 | goto err; | 2128 | goto err; |
2129 | } | 2129 | } |
2130 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2130 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2131 | FAIL("Cannot finish CBB"); | 2131 | FAIL("Cannot finish CBB\n"); |
2132 | goto err; | 2132 | goto err; |
2133 | } | 2133 | } |
2134 | if (dlen != sizeof(dummy)) { | 2134 | if (dlen != sizeof(dummy)) { |
@@ -2155,12 +2155,12 @@ test_tlsext_sessionticket_client(void) | |||
2155 | * through SSL_set_options(). | 2155 | * through SSL_set_options(). |
2156 | */ | 2156 | */ |
2157 | if (!SSL_set_session_ticket_ext(ssl, NULL, 0)) { | 2157 | if (!SSL_set_session_ticket_ext(ssl, NULL, 0)) { |
2158 | FAIL("Could not set a NULL custom ticket"); | 2158 | FAIL("Could not set a NULL custom ticket\n"); |
2159 | goto err; | 2159 | goto err; |
2160 | } | 2160 | } |
2161 | /* Should not need a ticket in this case */ | 2161 | /* Should not need a ticket in this case */ |
2162 | if (tlsext_sessionticket_client_needs(ssl)) { | 2162 | if (tlsext_sessionticket_client_needs(ssl)) { |
2163 | FAIL("Should not want to use session tickets with a NULL custom"); | 2163 | FAIL("Should not want to use session tickets with a NULL custom\n"); |
2164 | goto err; | 2164 | goto err; |
2165 | } | 2165 | } |
2166 | 2166 | ||
@@ -2172,26 +2172,26 @@ test_tlsext_sessionticket_client(void) | |||
2172 | ssl->internal->tlsext_session_ticket = NULL; | 2172 | ssl->internal->tlsext_session_ticket = NULL; |
2173 | 2173 | ||
2174 | if (!tlsext_sessionticket_client_needs(ssl)) { | 2174 | if (!tlsext_sessionticket_client_needs(ssl)) { |
2175 | FAIL("Should need a session ticket again when the custom one is removed"); | 2175 | FAIL("Should need a session ticket again when the custom one is removed\n"); |
2176 | goto err; | 2176 | goto err; |
2177 | } | 2177 | } |
2178 | 2178 | ||
2179 | /* Test a custom session ticket (not recommended in practice) */ | 2179 | /* Test a custom session ticket (not recommended in practice) */ |
2180 | if (!SSL_set_session_ticket_ext(ssl, tlsext_sessionticket_hello_max, | 2180 | if (!SSL_set_session_ticket_ext(ssl, tlsext_sessionticket_hello_max, |
2181 | sizeof(tlsext_sessionticket_hello_max))) { | 2181 | sizeof(tlsext_sessionticket_hello_max))) { |
2182 | FAIL("Should be able to set a custom ticket"); | 2182 | FAIL("Should be able to set a custom ticket\n"); |
2183 | goto err; | 2183 | goto err; |
2184 | } | 2184 | } |
2185 | if (!tlsext_sessionticket_client_needs(ssl)) { | 2185 | if (!tlsext_sessionticket_client_needs(ssl)) { |
2186 | FAIL("Should need a session ticket again when the custom one is not empty"); | 2186 | FAIL("Should need a session ticket again when the custom one is not empty\n"); |
2187 | goto err; | 2187 | goto err; |
2188 | } | 2188 | } |
2189 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { | 2189 | if (!tlsext_sessionticket_client_build(ssl, &cbb)) { |
2190 | FAIL("Cannot build a ticket with a max length random payload"); | 2190 | FAIL("Cannot build a ticket with a max length random payload\n"); |
2191 | goto err; | 2191 | goto err; |
2192 | } | 2192 | } |
2193 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2193 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2194 | FAIL("Cannot finish CBB"); | 2194 | FAIL("Cannot finish CBB\n"); |
2195 | goto err; | 2195 | goto err; |
2196 | } | 2196 | } |
2197 | if (dlen != sizeof(tlsext_sessionticket_hello_max)) { | 2197 | if (dlen != sizeof(tlsext_sessionticket_hello_max)) { |
@@ -2201,7 +2201,7 @@ test_tlsext_sessionticket_client(void) | |||
2201 | } | 2201 | } |
2202 | if (memcmp(data, tlsext_sessionticket_hello_max, | 2202 | if (memcmp(data, tlsext_sessionticket_hello_max, |
2203 | sizeof(tlsext_sessionticket_hello_max)) != 0) { | 2203 | sizeof(tlsext_sessionticket_hello_max)) != 0) { |
2204 | FAIL("Expected to get what we passed in"); | 2204 | FAIL("Expected to get what we passed in\n"); |
2205 | compare_data(data, dlen, | 2205 | compare_data(data, dlen, |
2206 | tlsext_sessionticket_hello_max, | 2206 | tlsext_sessionticket_hello_max, |
2207 | sizeof(tlsext_sessionticket_hello_max)); | 2207 | sizeof(tlsext_sessionticket_hello_max)); |
@@ -2250,38 +2250,38 @@ test_tlsext_sessionticket_server(void) | |||
2250 | 2250 | ||
2251 | /* Test disabling tickets. */ | 2251 | /* Test disabling tickets. */ |
2252 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { | 2252 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { |
2253 | FAIL("Cannot disable tickets in the TLS connection"); | 2253 | FAIL("Cannot disable tickets in the TLS connection\n"); |
2254 | return 0; | 2254 | return 0; |
2255 | } | 2255 | } |
2256 | if (tlsext_sessionticket_server_needs(ssl)) { | 2256 | if (tlsext_sessionticket_server_needs(ssl)) { |
2257 | FAIL("server should not need SessionTicket if it was disabled"); | 2257 | FAIL("server should not need SessionTicket if it was disabled\n"); |
2258 | goto err; | 2258 | goto err; |
2259 | } | 2259 | } |
2260 | 2260 | ||
2261 | /* Test re-enabling tickets. */ | 2261 | /* Test re-enabling tickets. */ |
2262 | if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) { | 2262 | if ((SSL_clear_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) != 0) { |
2263 | FAIL("Cannot re-enable tickets in the TLS connection"); | 2263 | FAIL("Cannot re-enable tickets in the TLS connection\n"); |
2264 | return 0; | 2264 | return 0; |
2265 | } | 2265 | } |
2266 | if (tlsext_sessionticket_server_needs(ssl)) { | 2266 | if (tlsext_sessionticket_server_needs(ssl)) { |
2267 | FAIL("server should not need SessionTicket yet"); | 2267 | FAIL("server should not need SessionTicket yet\n"); |
2268 | goto err; | 2268 | goto err; |
2269 | } | 2269 | } |
2270 | 2270 | ||
2271 | /* Set expected to require it. */ | 2271 | /* Set expected to require it. */ |
2272 | ssl->internal->tlsext_ticket_expected = 1; | 2272 | ssl->internal->tlsext_ticket_expected = 1; |
2273 | if (!tlsext_sessionticket_server_needs(ssl)) { | 2273 | if (!tlsext_sessionticket_server_needs(ssl)) { |
2274 | FAIL("server should now be required for SessionTicket"); | 2274 | FAIL("server should now be required for SessionTicket\n"); |
2275 | goto err; | 2275 | goto err; |
2276 | } | 2276 | } |
2277 | 2277 | ||
2278 | /* server hello's session ticket should always be 0 length payload. */ | 2278 | /* server hello's session ticket should always be 0 length payload. */ |
2279 | if (!tlsext_sessionticket_server_build(ssl, &cbb)) { | 2279 | if (!tlsext_sessionticket_server_build(ssl, &cbb)) { |
2280 | FAIL("Cannot build a ticket with a max length random payload"); | 2280 | FAIL("Cannot build a ticket with a max length random payload\n"); |
2281 | goto err; | 2281 | goto err; |
2282 | } | 2282 | } |
2283 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2283 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2284 | FAIL("Cannot finish CBB"); | 2284 | FAIL("Cannot finish CBB\n"); |
2285 | goto err; | 2285 | goto err; |
2286 | } | 2286 | } |
2287 | if (dlen != 0) { | 2287 | if (dlen != 0) { |
@@ -2392,7 +2392,7 @@ test_tlsext_srtp_client(void) | |||
2392 | goto err; | 2392 | goto err; |
2393 | } | 2393 | } |
2394 | if (!CBB_finish(&cbb, &data, &dlen)) | 2394 | if (!CBB_finish(&cbb, &data, &dlen)) |
2395 | errx(1, "failed to finish CBB"); | 2395 | errx(1, "failed to finish CBB\n"); |
2396 | 2396 | ||
2397 | if (dlen != sizeof(tlsext_srtp_single)) { | 2397 | if (dlen != sizeof(tlsext_srtp_single)) { |
2398 | FAIL("got client SRTP with length %zu, " | 2398 | FAIL("got client SRTP with length %zu, " |
@@ -2427,7 +2427,7 @@ test_tlsext_srtp_client(void) | |||
2427 | goto err; | 2427 | goto err; |
2428 | } | 2428 | } |
2429 | if (CBS_len(&cbs) != 0) { | 2429 | if (CBS_len(&cbs) != 0) { |
2430 | FAIL("extension data remaining"); | 2430 | FAIL("extension data remaining\n"); |
2431 | goto err; | 2431 | goto err; |
2432 | } | 2432 | } |
2433 | 2433 | ||
@@ -2461,7 +2461,7 @@ test_tlsext_srtp_client(void) | |||
2461 | goto err; | 2461 | goto err; |
2462 | } | 2462 | } |
2463 | if (!CBB_finish(&cbb, &data, &dlen)) | 2463 | if (!CBB_finish(&cbb, &data, &dlen)) |
2464 | errx(1, "failed to finish CBB"); | 2464 | errx(1, "failed to finish CBB\n"); |
2465 | 2465 | ||
2466 | if (dlen != sizeof(tlsext_srtp_multiple)) { | 2466 | if (dlen != sizeof(tlsext_srtp_multiple)) { |
2467 | FAIL("got client SRTP with length %zu, " | 2467 | FAIL("got client SRTP with length %zu, " |
@@ -2494,7 +2494,7 @@ test_tlsext_srtp_client(void) | |||
2494 | goto err; | 2494 | goto err; |
2495 | } | 2495 | } |
2496 | if (CBS_len(&cbs) != 0) { | 2496 | if (CBS_len(&cbs) != 0) { |
2497 | FAIL("extension data remaining"); | 2497 | FAIL("extension data remaining\n"); |
2498 | goto err; | 2498 | goto err; |
2499 | } | 2499 | } |
2500 | 2500 | ||
@@ -2525,7 +2525,7 @@ test_tlsext_srtp_client(void) | |||
2525 | goto err; | 2525 | goto err; |
2526 | } | 2526 | } |
2527 | if (CBS_len(&cbs) != 0) { | 2527 | if (CBS_len(&cbs) != 0) { |
2528 | FAIL("extension data remaining"); | 2528 | FAIL("extension data remaining\n"); |
2529 | goto err; | 2529 | goto err; |
2530 | } | 2530 | } |
2531 | 2531 | ||
@@ -2554,7 +2554,7 @@ test_tlsext_srtp_client(void) | |||
2554 | goto err; | 2554 | goto err; |
2555 | } | 2555 | } |
2556 | if (CBS_len(&cbs) != 0) { | 2556 | if (CBS_len(&cbs) != 0) { |
2557 | FAIL("extension data remaining"); | 2557 | FAIL("extension data remaining\n"); |
2558 | goto err; | 2558 | goto err; |
2559 | } | 2559 | } |
2560 | 2560 | ||
@@ -2625,7 +2625,7 @@ test_tlsext_srtp_server(void) | |||
2625 | goto err; | 2625 | goto err; |
2626 | } | 2626 | } |
2627 | if (!CBB_finish(&cbb, &data, &dlen)) | 2627 | if (!CBB_finish(&cbb, &data, &dlen)) |
2628 | errx(1, "failed to finish CBB"); | 2628 | errx(1, "failed to finish CBB\n"); |
2629 | 2629 | ||
2630 | if (dlen != sizeof(tlsext_srtp_single)) { | 2630 | if (dlen != sizeof(tlsext_srtp_single)) { |
2631 | FAIL("got server SRTP with length %zu, " | 2631 | FAIL("got server SRTP with length %zu, " |
@@ -2667,7 +2667,7 @@ test_tlsext_srtp_server(void) | |||
2667 | goto err; | 2667 | goto err; |
2668 | } | 2668 | } |
2669 | if (CBS_len(&cbs) != 0) { | 2669 | if (CBS_len(&cbs) != 0) { |
2670 | FAIL("extension data remaining"); | 2670 | FAIL("extension data remaining\n"); |
2671 | goto err; | 2671 | goto err; |
2672 | } | 2672 | } |
2673 | 2673 | ||
@@ -2749,7 +2749,7 @@ test_tlsext_clienthello_build(void) | |||
2749 | goto err; | 2749 | goto err; |
2750 | } | 2750 | } |
2751 | if (!CBB_finish(&cbb, &data, &dlen)) | 2751 | if (!CBB_finish(&cbb, &data, &dlen)) |
2752 | errx(1, "failed to finish CBB"); | 2752 | errx(1, "failed to finish CBB\n"); |
2753 | 2753 | ||
2754 | if (dlen != sizeof(tlsext_clienthello_default)) { | 2754 | if (dlen != sizeof(tlsext_clienthello_default)) { |
2755 | FAIL("got clienthello extensions with length %zu, " | 2755 | FAIL("got clienthello extensions with length %zu, " |
@@ -2776,7 +2776,7 @@ test_tlsext_clienthello_build(void) | |||
2776 | goto err; | 2776 | goto err; |
2777 | } | 2777 | } |
2778 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { | 2778 | if ((SSL_set_options(ssl, SSL_OP_NO_TICKET) & SSL_OP_NO_TICKET) == 0) { |
2779 | FAIL("failed to disable session tickets"); | 2779 | FAIL("failed to disable session tickets\n"); |
2780 | return 0; | 2780 | return 0; |
2781 | } | 2781 | } |
2782 | 2782 | ||
@@ -2785,7 +2785,7 @@ test_tlsext_clienthello_build(void) | |||
2785 | goto err; | 2785 | goto err; |
2786 | } | 2786 | } |
2787 | if (!CBB_finish(&cbb, &data, &dlen)) | 2787 | if (!CBB_finish(&cbb, &data, &dlen)) |
2788 | errx(1, "failed to finish CBB"); | 2788 | errx(1, "failed to finish CBB\n"); |
2789 | 2789 | ||
2790 | if (dlen != sizeof(tlsext_clienthello_disabled)) { | 2790 | if (dlen != sizeof(tlsext_clienthello_disabled)) { |
2791 | FAIL("got clienthello extensions with length %zu, " | 2791 | FAIL("got clienthello extensions with length %zu, " |
@@ -2853,7 +2853,7 @@ test_tlsext_serverhello_build(void) | |||
2853 | goto err; | 2853 | goto err; |
2854 | } | 2854 | } |
2855 | if (!CBB_finish(&cbb, &data, &dlen)) | 2855 | if (!CBB_finish(&cbb, &data, &dlen)) |
2856 | errx(1, "failed to finish CBB"); | 2856 | errx(1, "failed to finish CBB\n"); |
2857 | 2857 | ||
2858 | if (dlen != sizeof(tlsext_serverhello_default)) { | 2858 | if (dlen != sizeof(tlsext_serverhello_default)) { |
2859 | FAIL("got serverhello extensions with length %zu, " | 2859 | FAIL("got serverhello extensions with length %zu, " |
@@ -2890,7 +2890,7 @@ test_tlsext_serverhello_build(void) | |||
2890 | goto err; | 2890 | goto err; |
2891 | } | 2891 | } |
2892 | if (!CBB_finish(&cbb, &data, &dlen)) | 2892 | if (!CBB_finish(&cbb, &data, &dlen)) |
2893 | errx(1, "failed to finish CBB"); | 2893 | errx(1, "failed to finish CBB\n"); |
2894 | 2894 | ||
2895 | if (dlen != sizeof(tlsext_serverhello_enabled)) { | 2895 | if (dlen != sizeof(tlsext_serverhello_enabled)) { |
2896 | FAIL("got serverhello extensions with length %zu, " | 2896 | FAIL("got serverhello extensions with length %zu, " |
@@ -2987,7 +2987,7 @@ test_tlsext_versions_client(void) | |||
2987 | } | 2987 | } |
2988 | 2988 | ||
2989 | if (!CBB_finish(&cbb, &data, &dlen)) { | 2989 | if (!CBB_finish(&cbb, &data, &dlen)) { |
2990 | FAIL("failed to finish CBB"); | 2990 | FAIL("failed to finish CBB\n"); |
2991 | failure = 1; | 2991 | failure = 1; |
2992 | goto done; | 2992 | goto done; |
2993 | } | 2993 | } |
@@ -3006,7 +3006,7 @@ test_tlsext_versions_client(void) | |||
3006 | goto done; | 3006 | goto done; |
3007 | } | 3007 | } |
3008 | if (CBS_len(&cbs) != 0) { | 3008 | if (CBS_len(&cbs) != 0) { |
3009 | FAIL("extension data remaining"); | 3009 | FAIL("extension data remaining\n"); |
3010 | failure = 1; | 3010 | failure = 1; |
3011 | goto done; | 3011 | goto done; |
3012 | } | 3012 | } |
@@ -3062,7 +3062,7 @@ test_tlsext_versions_server(void) | |||
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | if (!CBB_finish(&cbb, &data, &dlen)) { | 3064 | if (!CBB_finish(&cbb, &data, &dlen)) { |
3065 | FAIL("failed to finish CBB"); | 3065 | FAIL("failed to finish CBB\n"); |
3066 | failure = 1; | 3066 | failure = 1; |
3067 | goto done; | 3067 | goto done; |
3068 | } | 3068 | } |
@@ -3081,7 +3081,7 @@ test_tlsext_versions_server(void) | |||
3081 | goto done; | 3081 | goto done; |
3082 | } | 3082 | } |
3083 | if (CBS_len(&cbs) != 0) { | 3083 | if (CBS_len(&cbs) != 0) { |
3084 | FAIL("extension data remaining"); | 3084 | FAIL("extension data remaining\n"); |
3085 | failure = 1; | 3085 | failure = 1; |
3086 | goto done; | 3086 | goto done; |
3087 | } | 3087 | } |
@@ -3165,7 +3165,7 @@ test_tlsext_keyshare_client(void) | |||
3165 | } | 3165 | } |
3166 | 3166 | ||
3167 | if (!CBB_finish(&cbb, &data, &dlen)) { | 3167 | if (!CBB_finish(&cbb, &data, &dlen)) { |
3168 | FAIL("failed to finish CBB"); | 3168 | FAIL("failed to finish CBB\n"); |
3169 | failure = 1; | 3169 | failure = 1; |
3170 | goto done; | 3170 | goto done; |
3171 | } | 3171 | } |
@@ -3187,7 +3187,7 @@ test_tlsext_keyshare_client(void) | |||
3187 | } | 3187 | } |
3188 | 3188 | ||
3189 | if (CBS_len(&cbs) != 0) { | 3189 | if (CBS_len(&cbs) != 0) { |
3190 | FAIL("extension data remaining"); | 3190 | FAIL("extension data remaining\n"); |
3191 | failure = 1; | 3191 | failure = 1; |
3192 | goto done; | 3192 | goto done; |
3193 | } | 3193 | } |
@@ -3249,20 +3249,20 @@ test_tlsext_keyshare_server(void) | |||
3249 | } | 3249 | } |
3250 | 3250 | ||
3251 | if (tls_extension_find(TLSEXT_TYPE_key_share, &idx) == NULL) { | 3251 | if (tls_extension_find(TLSEXT_TYPE_key_share, &idx) == NULL) { |
3252 | FAIL("failed to find keyshare extension"); | 3252 | FAIL("failed to find keyshare extension\n"); |
3253 | failure = 1; | 3253 | failure = 1; |
3254 | goto done; | 3254 | goto done; |
3255 | } | 3255 | } |
3256 | S3I(ssl)->hs.extensions_seen |= (1 << idx); | 3256 | S3I(ssl)->hs.extensions_seen |= (1 << idx); |
3257 | 3257 | ||
3258 | if (!tlsext_keyshare_server_needs(ssl)) { | 3258 | if (!tlsext_keyshare_server_needs(ssl)) { |
3259 | FAIL("server should need keyshare"); | 3259 | FAIL("server should need keyshare\n"); |
3260 | failure = 1; | 3260 | failure = 1; |
3261 | goto done; | 3261 | goto done; |
3262 | } | 3262 | } |
3263 | 3263 | ||
3264 | if (tlsext_keyshare_server_build(ssl, &cbb)) { | 3264 | if (tlsext_keyshare_server_build(ssl, &cbb)) { |
3265 | FAIL("server should not have built a keyshare response"); | 3265 | FAIL("server should not have built a keyshare response\n"); |
3266 | failure = 1; | 3266 | failure = 1; |
3267 | goto done; | 3267 | goto done; |
3268 | } | 3268 | } |
@@ -3276,19 +3276,19 @@ test_tlsext_keyshare_server(void) | |||
3276 | CBS_init(&cbs, bogokey, sizeof(bogokey)); | 3276 | CBS_init(&cbs, bogokey, sizeof(bogokey)); |
3277 | if (!tls13_key_share_peer_public(S3I(ssl)->hs_tls13.key_share, | 3277 | if (!tls13_key_share_peer_public(S3I(ssl)->hs_tls13.key_share, |
3278 | 0x001d, &cbs)) { | 3278 | 0x001d, &cbs)) { |
3279 | FAIL("failed to load peer public key"); | 3279 | FAIL("failed to load peer public key\n"); |
3280 | failure = 1; | 3280 | failure = 1; |
3281 | goto done; | 3281 | goto done; |
3282 | } | 3282 | } |
3283 | 3283 | ||
3284 | if (!tlsext_keyshare_server_build(ssl, &cbb)) { | 3284 | if (!tlsext_keyshare_server_build(ssl, &cbb)) { |
3285 | FAIL("server should be able to build a keyshare response"); | 3285 | FAIL("server should be able to build a keyshare response\n"); |
3286 | failure = 1; | 3286 | failure = 1; |
3287 | goto done; | 3287 | goto done; |
3288 | } | 3288 | } |
3289 | 3289 | ||
3290 | if (!CBB_finish(&cbb, &data, &dlen)) { | 3290 | if (!CBB_finish(&cbb, &data, &dlen)) { |
3291 | FAIL("failed to finish CBB"); | 3291 | FAIL("failed to finish CBB\n"); |
3292 | failure = 1; | 3292 | failure = 1; |
3293 | goto done; | 3293 | goto done; |
3294 | } | 3294 | } |
@@ -3315,7 +3315,7 @@ test_tlsext_keyshare_server(void) | |||
3315 | } | 3315 | } |
3316 | 3316 | ||
3317 | if (CBS_len(&cbs) != 0) { | 3317 | if (CBS_len(&cbs) != 0) { |
3318 | FAIL("extension data remaining"); | 3318 | FAIL("extension data remaining\n"); |
3319 | failure = 1; | 3319 | failure = 1; |
3320 | goto done; | 3320 | goto done; |
3321 | } | 3321 | } |
@@ -3384,19 +3384,19 @@ test_tlsext_cookie_client(void) | |||
3384 | S3I(ssl)->hs_tls13.cookie_len = strlen(cookie); | 3384 | S3I(ssl)->hs_tls13.cookie_len = strlen(cookie); |
3385 | 3385 | ||
3386 | if (!tlsext_cookie_client_needs(ssl)) { | 3386 | if (!tlsext_cookie_client_needs(ssl)) { |
3387 | FAIL("client should need cookie"); | 3387 | FAIL("client should need cookie\n"); |
3388 | failure = 1; | 3388 | failure = 1; |
3389 | goto done; | 3389 | goto done; |
3390 | } | 3390 | } |
3391 | 3391 | ||
3392 | if (!tlsext_cookie_client_build(ssl, &cbb)) { | 3392 | if (!tlsext_cookie_client_build(ssl, &cbb)) { |
3393 | FAIL("client should have built a cookie response"); | 3393 | FAIL("client should have built a cookie response\n"); |
3394 | failure = 1; | 3394 | failure = 1; |
3395 | goto done; | 3395 | goto done; |
3396 | } | 3396 | } |
3397 | 3397 | ||
3398 | if (!CBB_finish(&cbb, &data, &dlen)) { | 3398 | if (!CBB_finish(&cbb, &data, &dlen)) { |
3399 | FAIL("failed to finish CBB"); | 3399 | FAIL("failed to finish CBB\n"); |
3400 | failure = 1; | 3400 | failure = 1; |
3401 | goto done; | 3401 | goto done; |
3402 | } | 3402 | } |
@@ -3419,7 +3419,7 @@ test_tlsext_cookie_client(void) | |||
3419 | } | 3419 | } |
3420 | 3420 | ||
3421 | if (CBS_len(&cbs) != 0) { | 3421 | if (CBS_len(&cbs) != 0) { |
3422 | FAIL("extension data remaining"); | 3422 | FAIL("extension data remaining\n"); |
3423 | failure = 1; | 3423 | failure = 1; |
3424 | goto done; | 3424 | goto done; |
3425 | } | 3425 | } |
@@ -3479,19 +3479,19 @@ test_tlsext_cookie_server(void) | |||
3479 | S3I(ssl)->hs_tls13.cookie_len = strlen(cookie); | 3479 | S3I(ssl)->hs_tls13.cookie_len = strlen(cookie); |
3480 | 3480 | ||
3481 | if (!tlsext_cookie_server_needs(ssl)) { | 3481 | if (!tlsext_cookie_server_needs(ssl)) { |
3482 | FAIL("server should need cookie"); | 3482 | FAIL("server should need cookie\n"); |
3483 | failure = 1; | 3483 | failure = 1; |
3484 | goto done; | 3484 | goto done; |
3485 | } | 3485 | } |
3486 | 3486 | ||
3487 | if (!tlsext_cookie_server_build(ssl, &cbb)) { | 3487 | if (!tlsext_cookie_server_build(ssl, &cbb)) { |
3488 | FAIL("server have built a cookie response"); | 3488 | FAIL("server have built a cookie response\n"); |
3489 | failure = 1; | 3489 | failure = 1; |
3490 | goto done; | 3490 | goto done; |
3491 | } | 3491 | } |
3492 | 3492 | ||
3493 | if (!CBB_finish(&cbb, &data, &dlen)) { | 3493 | if (!CBB_finish(&cbb, &data, &dlen)) { |
3494 | FAIL("failed to finish CBB"); | 3494 | FAIL("failed to finish CBB\n"); |
3495 | failure = 1; | 3495 | failure = 1; |
3496 | goto done; | 3496 | goto done; |
3497 | } | 3497 | } |
@@ -3530,7 +3530,7 @@ test_tlsext_cookie_server(void) | |||
3530 | } | 3530 | } |
3531 | 3531 | ||
3532 | if (CBS_len(&cbs) != 0) { | 3532 | if (CBS_len(&cbs) != 0) { |
3533 | FAIL("extension data remaining"); | 3533 | FAIL("extension data remaining\n"); |
3534 | failure = 1; | 3534 | failure = 1; |
3535 | goto done; | 3535 | goto done; |
3536 | } | 3536 | } |
@@ -3615,7 +3615,7 @@ test_tlsext_invalid_hostnames(void) | |||
3615 | CBS_init(&cbs, valid_hostnames[0], | 3615 | CBS_init(&cbs, valid_hostnames[0], |
3616 | strlen(valid_hostnames[0]) + 1); | 3616 | strlen(valid_hostnames[0]) + 1); |
3617 | if (tlsext_sni_is_valid_hostname(&cbs)) { | 3617 | if (tlsext_sni_is_valid_hostname(&cbs)) { |
3618 | FAIL("hostname with NUL byte accepted"); | 3618 | FAIL("hostname with NUL byte accepted\n"); |
3619 | failure = 1; | 3619 | failure = 1; |
3620 | goto done; | 3620 | goto done; |
3621 | } | 3621 | } |