summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2021-10-26 06:24:47 +0000
committerjsing <>2021-10-26 06:24:47 +0000
commit9ecdb7b0d743875dc4c14dc28389438c08c73c7d (patch)
tree3720a1d85c74d85a37fd88e70e47726e9e0cb686
parent5af635fbd4db6680a7e2f31959d300dc823c393a (diff)
downloadopenbsd-9ecdb7b0d743875dc4c14dc28389438c08c73c7d.tar.gz
openbsd-9ecdb7b0d743875dc4c14dc28389438c08c73c7d.tar.bz2
openbsd-9ecdb7b0d743875dc4c14dc28389438c08c73c7d.zip
Revise regress for removal of SSL_SESSION_INTERNAL.
-rw-r--r--src/regress/lib/libssl/tlsext/tlsexttest.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/regress/lib/libssl/tlsext/tlsexttest.c b/src/regress/lib/libssl/tlsext/tlsexttest.c
index 4d7d22de8e..3fefeb9fa6 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.49 2021/03/24 21:36:26 tb Exp $ */ 1/* $OpenBSD: tlsexttest.c,v 1.50 2021/10/26 06:24:47 jsing 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>
@@ -556,13 +556,13 @@ test_tlsext_supportedgroups_client(void)
556 if ((ssl->session = SSL_SESSION_new()) == NULL) 556 if ((ssl->session = SSL_SESSION_new()) == NULL)
557 errx(1, "failed to create session"); 557 errx(1, "failed to create session");
558 558
559 if ((SSI(ssl)->tlsext_supportedgroups = malloc(sizeof(uint16_t))) 559 if ((ssl->session->tlsext_supportedgroups = malloc(sizeof(uint16_t)))
560 == NULL) { 560 == NULL) {
561 FAIL("client could not malloc\n"); 561 FAIL("client could not malloc\n");
562 goto err; 562 goto err;
563 } 563 }
564 SSI(ssl)->tlsext_supportedgroups[0] = tls1_ec_nid2curve_id(NID_secp384r1); 564 ssl->session->tlsext_supportedgroups[0] = tls1_ec_nid2curve_id(NID_secp384r1);
565 SSI(ssl)->tlsext_supportedgroups_length = 1; 565 ssl->session->tlsext_supportedgroups_length = 1;
566 566
567 if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) { 567 if (!tlsext_supportedgroups_client_needs(ssl, SSL_TLSEXT_MSG_CH)) {
568 FAIL("client should need Ellipticcurves\n"); 568 FAIL("client should need Ellipticcurves\n");
@@ -616,20 +616,20 @@ test_tlsext_supportedgroups_client(void)
616 goto err; 616 goto err;
617 } 617 }
618 618
619 if (SSI(ssl)->tlsext_supportedgroups_length != 619 if (ssl->session->tlsext_supportedgroups_length !=
620 sizeof(tlsext_supportedgroups_client_secp384r1_val) / sizeof(uint16_t)) { 620 sizeof(tlsext_supportedgroups_client_secp384r1_val) / sizeof(uint16_t)) {
621 FAIL("no tlsext_ellipticcurves from client " 621 FAIL("no tlsext_ellipticcurves from client "
622 "Ellipticcurves\n"); 622 "Ellipticcurves\n");
623 goto err; 623 goto err;
624 } 624 }
625 625
626 if (memcmp(SSI(ssl)->tlsext_supportedgroups, 626 if (memcmp(ssl->session->tlsext_supportedgroups,
627 tlsext_supportedgroups_client_secp384r1_val, 627 tlsext_supportedgroups_client_secp384r1_val,
628 sizeof(tlsext_supportedgroups_client_secp384r1_val)) != 0) { 628 sizeof(tlsext_supportedgroups_client_secp384r1_val)) != 0) {
629 FAIL("client had an incorrect Ellipticcurves " 629 FAIL("client had an incorrect Ellipticcurves "
630 "entry\n"); 630 "entry\n");
631 compare_data2(SSI(ssl)->tlsext_supportedgroups, 631 compare_data2(ssl->session->tlsext_supportedgroups,
632 SSI(ssl)->tlsext_supportedgroups_length * 2, 632 ssl->session->tlsext_supportedgroups_length * 2,
633 tlsext_supportedgroups_client_secp384r1_val, 633 tlsext_supportedgroups_client_secp384r1_val,
634 sizeof(tlsext_supportedgroups_client_secp384r1_val)); 634 sizeof(tlsext_supportedgroups_client_secp384r1_val));
635 goto err; 635 goto err;
@@ -716,18 +716,18 @@ test_tlsext_supportedgroups_client(void)
716 goto err; 716 goto err;
717 } 717 }
718 718
719 if (SSI(ssl)->tlsext_supportedgroups_length != 719 if (ssl->session->tlsext_supportedgroups_length !=
720 sizeof(tlsext_supportedgroups_client_nistp192and224_val) / sizeof(uint16_t)) { 720 sizeof(tlsext_supportedgroups_client_nistp192and224_val) / sizeof(uint16_t)) {
721 FAIL("no tlsext_ellipticcurves from client Ellipticcurves\n"); 721 FAIL("no tlsext_ellipticcurves from client Ellipticcurves\n");
722 goto err; 722 goto err;
723 } 723 }
724 724
725 if (memcmp(SSI(ssl)->tlsext_supportedgroups, 725 if (memcmp(ssl->session->tlsext_supportedgroups,
726 tlsext_supportedgroups_client_nistp192and224_val, 726 tlsext_supportedgroups_client_nistp192and224_val,
727 sizeof(tlsext_supportedgroups_client_nistp192and224_val)) != 0) { 727 sizeof(tlsext_supportedgroups_client_nistp192and224_val)) != 0) {
728 FAIL("client had an incorrect Ellipticcurves entry\n"); 728 FAIL("client had an incorrect Ellipticcurves entry\n");
729 compare_data2(SSI(ssl)->tlsext_supportedgroups, 729 compare_data2(ssl->session->tlsext_supportedgroups,
730 SSI(ssl)->tlsext_supportedgroups_length * 2, 730 ssl->session->tlsext_supportedgroups_length * 2,
731 tlsext_supportedgroups_client_nistp192and224_val, 731 tlsext_supportedgroups_client_nistp192and224_val,
732 sizeof(tlsext_supportedgroups_client_nistp192and224_val)); 732 sizeof(tlsext_supportedgroups_client_nistp192and224_val));
733 goto err; 733 goto err;
@@ -921,14 +921,14 @@ test_tlsext_ecpf_client(void)
921 goto err; 921 goto err;
922 } 922 }
923 923
924 if (SSI(ssl)->tlsext_ecpointformatlist_length != 924 if (ssl->session->tlsext_ecpointformatlist_length !=
925 sizeof(tlsext_ecpf_hello_uncompressed_val)) { 925 sizeof(tlsext_ecpf_hello_uncompressed_val)) {
926 FAIL("no tlsext_ecpointformats from client " 926 FAIL("no tlsext_ecpointformats from client "
927 "ECPointFormats\n"); 927 "ECPointFormats\n");
928 goto err; 928 goto err;
929 } 929 }
930 930
931 if (memcmp(SSI(ssl)->tlsext_ecpointformatlist, 931 if (memcmp(ssl->session->tlsext_ecpointformatlist,
932 tlsext_ecpf_hello_uncompressed_val, 932 tlsext_ecpf_hello_uncompressed_val,
933 sizeof(tlsext_ecpf_hello_uncompressed_val)) != 0) { 933 sizeof(tlsext_ecpf_hello_uncompressed_val)) != 0) {
934 FAIL("client had an incorrect ECPointFormats entry\n"); 934 FAIL("client had an incorrect ECPointFormats entry\n");
@@ -1014,14 +1014,14 @@ test_tlsext_ecpf_client(void)
1014 goto err; 1014 goto err;
1015 } 1015 }
1016 1016
1017 if (SSI(ssl)->tlsext_ecpointformatlist_length != 1017 if (ssl->session->tlsext_ecpointformatlist_length !=
1018 sizeof(tlsext_ecpf_hello_prefer_order_val)) { 1018 sizeof(tlsext_ecpf_hello_prefer_order_val)) {
1019 FAIL("no tlsext_ecpointformats from client " 1019 FAIL("no tlsext_ecpointformats from client "
1020 "ECPointFormats\n"); 1020 "ECPointFormats\n");
1021 goto err; 1021 goto err;
1022 } 1022 }
1023 1023
1024 if (memcmp(SSI(ssl)->tlsext_ecpointformatlist, 1024 if (memcmp(ssl->session->tlsext_ecpointformatlist,
1025 tlsext_ecpf_hello_prefer_order_val, 1025 tlsext_ecpf_hello_prefer_order_val,
1026 sizeof(tlsext_ecpf_hello_prefer_order_val)) != 0) { 1026 sizeof(tlsext_ecpf_hello_prefer_order_val)) != 0) {
1027 FAIL("client had an incorrect ECPointFormats entry\n"); 1027 FAIL("client had an incorrect ECPointFormats entry\n");
@@ -1070,13 +1070,13 @@ test_tlsext_ecpf_server(void)
1070 FAIL("server cannot find cipher\n"); 1070 FAIL("server cannot find cipher\n");
1071 goto err; 1071 goto err;
1072 } 1072 }
1073 if ((SSI(ssl)->tlsext_ecpointformatlist = malloc(sizeof(uint8_t))) 1073 if ((ssl->session->tlsext_ecpointformatlist = malloc(sizeof(uint8_t)))
1074 == NULL) { 1074 == NULL) {
1075 FAIL("server could not malloc\n"); 1075 FAIL("server could not malloc\n");
1076 goto err; 1076 goto err;
1077 } 1077 }
1078 SSI(ssl)->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime; 1078 ssl->session->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime;
1079 SSI(ssl)->tlsext_ecpointformatlist_length = 1; 1079 ssl->session->tlsext_ecpointformatlist_length = 1;
1080 1080
1081 if (!tlsext_ecpf_server_needs(ssl, SSL_TLSEXT_MSG_SH)) { 1081 if (!tlsext_ecpf_server_needs(ssl, SSL_TLSEXT_MSG_SH)) {
1082 FAIL("server should need ECPointFormats now\n"); 1082 FAIL("server should need ECPointFormats now\n");
@@ -1147,13 +1147,13 @@ test_tlsext_ecpf_server(void)
1147 errx(1, "failed to create session"); 1147 errx(1, "failed to create session");
1148 1148
1149 /* Add a session list even though it will be ignored. */ 1149 /* Add a session list even though it will be ignored. */
1150 if ((SSI(ssl)->tlsext_ecpointformatlist = malloc(sizeof(uint8_t))) 1150 if ((ssl->session->tlsext_ecpointformatlist = malloc(sizeof(uint8_t)))
1151 == NULL) { 1151 == NULL) {
1152 FAIL("server could not malloc\n"); 1152 FAIL("server could not malloc\n");
1153 goto err; 1153 goto err;
1154 } 1154 }
1155 SSI(ssl)->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2; 1155 ssl->session->tlsext_ecpointformatlist[0] = TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2;
1156 SSI(ssl)->tlsext_ecpointformatlist_length = 1; 1156 ssl->session->tlsext_ecpointformatlist_length = 1;
1157 1157
1158 /* Replace the default list with a custom one. */ 1158 /* Replace the default list with a custom one. */
1159 if ((ssl->internal->tlsext_ecpointformatlist = malloc(sizeof(uint8_t) * 3)) == NULL) { 1159 if ((ssl->internal->tlsext_ecpointformatlist = malloc(sizeof(uint8_t) * 3)) == NULL) {
@@ -1222,14 +1222,14 @@ test_tlsext_ecpf_server(void)
1222 goto err; 1222 goto err;
1223 } 1223 }
1224 1224
1225 if (SSI(ssl)->tlsext_ecpointformatlist_length != 1225 if (ssl->session->tlsext_ecpointformatlist_length !=
1226 sizeof(tlsext_ecpf_hello_prefer_order_val)) { 1226 sizeof(tlsext_ecpf_hello_prefer_order_val)) {
1227 FAIL("no tlsext_ecpointformats from server " 1227 FAIL("no tlsext_ecpointformats from server "
1228 "ECPointFormats\n"); 1228 "ECPointFormats\n");
1229 goto err; 1229 goto err;
1230 } 1230 }
1231 1231
1232 if (memcmp(SSI(ssl)->tlsext_ecpointformatlist, 1232 if (memcmp(ssl->session->tlsext_ecpointformatlist,
1233 tlsext_ecpf_hello_prefer_order_val, 1233 tlsext_ecpf_hello_prefer_order_val,
1234 sizeof(tlsext_ecpf_hello_prefer_order_val)) != 0) { 1234 sizeof(tlsext_ecpf_hello_prefer_order_val)) != 0) {
1235 FAIL("server had an incorrect ECPointFormats entry\n"); 1235 FAIL("server had an incorrect ECPointFormats entry\n");
@@ -2885,10 +2885,10 @@ test_tlsext_serverhello_build(void)
2885 ssl3_get_cipher_by_id(TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256); 2885 ssl3_get_cipher_by_id(TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256);
2886 ssl->internal->tlsext_status_expected = 1; 2886 ssl->internal->tlsext_status_expected = 1;
2887 ssl->internal->tlsext_ticket_expected = 1; 2887 ssl->internal->tlsext_ticket_expected = 1;
2888 if ((SSI(ssl)->tlsext_ecpointformatlist = malloc(1)) == NULL) 2888 if ((ssl->session->tlsext_ecpointformatlist = malloc(1)) == NULL)
2889 errx(1, "malloc failed"); 2889 errx(1, "malloc failed");
2890 SSI(ssl)->tlsext_ecpointformatlist_length = 1; 2890 ssl->session->tlsext_ecpointformatlist_length = 1;
2891 SSI(ssl)->tlsext_ecpointformatlist[0] = 2891 ssl->session->tlsext_ecpointformatlist[0] =
2892 TLSEXT_ECPOINTFORMAT_uncompressed; 2892 TLSEXT_ECPOINTFORMAT_uncompressed;
2893 2893
2894 if (!tlsext_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) { 2894 if (!tlsext_server_build(ssl, SSL_TLSEXT_MSG_SH, &cbb)) {