summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_tlsext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_tlsext.c')
-rw-r--r--src/lib/libssl/ssl_tlsext.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c
index a42856264b..647a95e485 100644
--- a/src/lib/libssl/ssl_tlsext.c
+++ b/src/lib/libssl/ssl_tlsext.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_tlsext.c,v 1.129 2022/08/15 10:46:53 tb Exp $ */ 1/* $OpenBSD: ssl_tlsext.c,v 1.130 2022/10/02 16:36:41 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> 4 * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
@@ -40,7 +40,7 @@ static int
40tlsext_alpn_client_needs(SSL *s, uint16_t msg_type) 40tlsext_alpn_client_needs(SSL *s, uint16_t msg_type)
41{ 41{
42 /* ALPN protos have been specified and this is the initial handshake */ 42 /* ALPN protos have been specified and this is the initial handshake */
43 return s->internal->alpn_client_proto_list != NULL && 43 return s->alpn_client_proto_list != NULL &&
44 s->s3->hs.finished_len == 0; 44 s->s3->hs.finished_len == 0;
45} 45}
46 46
@@ -52,8 +52,8 @@ tlsext_alpn_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
52 if (!CBB_add_u16_length_prefixed(cbb, &protolist)) 52 if (!CBB_add_u16_length_prefixed(cbb, &protolist))
53 return 0; 53 return 0;
54 54
55 if (!CBB_add_bytes(&protolist, s->internal->alpn_client_proto_list, 55 if (!CBB_add_bytes(&protolist, s->alpn_client_proto_list,
56 s->internal->alpn_client_proto_list_len)) 56 s->alpn_client_proto_list_len))
57 return 0; 57 return 0;
58 58
59 if (!CBB_flush(cbb)) 59 if (!CBB_flush(cbb))
@@ -97,7 +97,7 @@ tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert)
97 if (!tlsext_alpn_check_format(&alpn)) 97 if (!tlsext_alpn_check_format(&alpn))
98 return 0; 98 return 0;
99 99
100 if (s->ctx->internal->alpn_select_cb == NULL) 100 if (s->ctx->alpn_select_cb == NULL)
101 return 1; 101 return 1;
102 102
103 /* 103 /*
@@ -106,9 +106,9 @@ tlsext_alpn_server_parse(SSL *s, uint16_t msg_types, CBS *cbs, int *alert)
106 * 2. Should the callback be called even if no ALPN extension was sent? 106 * 2. Should the callback be called even if no ALPN extension was sent?
107 * 3. TLSv1.2 and earlier: ensure that SNI has already been processed. 107 * 3. TLSv1.2 and earlier: ensure that SNI has already been processed.
108 */ 108 */
109 r = s->ctx->internal->alpn_select_cb(s, &selected, &selected_len, 109 r = s->ctx->alpn_select_cb(s, &selected, &selected_len,
110 CBS_data(&alpn), CBS_len(&alpn), 110 CBS_data(&alpn), CBS_len(&alpn),
111 s->ctx->internal->alpn_select_cb_arg); 111 s->ctx->alpn_select_cb_arg);
112 112
113 if (r == SSL_TLSEXT_ERR_OK) { 113 if (r == SSL_TLSEXT_ERR_OK) {
114 CBS_init(&selected_cbs, selected, selected_len); 114 CBS_init(&selected_cbs, selected, selected_len);
@@ -164,7 +164,7 @@ tlsext_alpn_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
164{ 164{
165 CBS list, proto; 165 CBS list, proto;
166 166
167 if (s->internal->alpn_client_proto_list == NULL) { 167 if (s->alpn_client_proto_list == NULL) {
168 *alert = SSL_AD_UNSUPPORTED_EXTENSION; 168 *alert = SSL_AD_UNSUPPORTED_EXTENSION;
169 return 0; 169 return 0;
170 } 170 }
@@ -243,7 +243,7 @@ tlsext_supportedgroups_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
243 return 0; 243 return 0;
244 groups_len /= 2; 244 groups_len /= 2;
245 245
246 if (s->internal->hit) 246 if (s->hit)
247 return 1; 247 return 1;
248 248
249 if (s->s3->hs.tls13.hrr) { 249 if (s->s3->hs.tls13.hrr) {
@@ -365,7 +365,7 @@ tlsext_ecpf_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
365 return 0; 365 return 0;
366 } 366 }
367 367
368 if (!s->internal->hit) { 368 if (!s->hit) {
369 if (!CBS_stow(&ecpf, &(s->session->tlsext_ecpointformatlist), 369 if (!CBS_stow(&ecpf, &(s->session->tlsext_ecpointformatlist),
370 &(s->session->tlsext_ecpointformatlist_length))) { 370 &(s->session->tlsext_ecpointformatlist_length))) {
371 *alert = SSL_AD_INTERNAL_ERROR; 371 *alert = SSL_AD_INTERNAL_ERROR;
@@ -418,7 +418,7 @@ tlsext_ecpf_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
418static int 418static int
419tlsext_ri_client_needs(SSL *s, uint16_t msg_type) 419tlsext_ri_client_needs(SSL *s, uint16_t msg_type)
420{ 420{
421 return (s->internal->renegotiate); 421 return (s->renegotiate);
422} 422}
423 423
424static int 424static int
@@ -779,7 +779,7 @@ tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
779 goto err; 779 goto err;
780 } 780 }
781 781
782 if (s->internal->hit || s->s3->hs.tls13.hrr) { 782 if (s->hit || s->s3->hs.tls13.hrr) {
783 if (s->session->tlsext_hostname == NULL) { 783 if (s->session->tlsext_hostname == NULL) {
784 *alert = SSL_AD_UNRECOGNIZED_NAME; 784 *alert = SSL_AD_UNRECOGNIZED_NAME;
785 goto err; 785 goto err;
@@ -817,7 +817,7 @@ tlsext_sni_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
817static int 817static int
818tlsext_sni_server_needs(SSL *s, uint16_t msg_type) 818tlsext_sni_server_needs(SSL *s, uint16_t msg_type)
819{ 819{
820 if (s->internal->hit) 820 if (s->hit)
821 return 0; 821 return 0;
822 822
823 return (s->session->tlsext_hostname != NULL); 823 return (s->session->tlsext_hostname != NULL);
@@ -837,7 +837,7 @@ tlsext_sni_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
837 return 0; 837 return 0;
838 } 838 }
839 839
840 if (s->internal->hit) { 840 if (s->hit) {
841 if (s->session->tlsext_hostname == NULL) { 841 if (s->session->tlsext_hostname == NULL) {
842 *alert = SSL_AD_UNRECOGNIZED_NAME; 842 *alert = SSL_AD_UNRECOGNIZED_NAME;
843 return 0; 843 return 0;
@@ -885,12 +885,12 @@ tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
885 return 0; 885 return 0;
886 if (!CBB_add_u16_length_prefixed(cbb, &respid_list)) 886 if (!CBB_add_u16_length_prefixed(cbb, &respid_list))
887 return 0; 887 return 0;
888 for (i = 0; i < sk_OCSP_RESPID_num(s->internal->tlsext_ocsp_ids); i++) { 888 for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) {
889 unsigned char *respid_data; 889 unsigned char *respid_data;
890 OCSP_RESPID *id; 890 OCSP_RESPID *id;
891 size_t id_len; 891 size_t id_len;
892 892
893 if ((id = sk_OCSP_RESPID_value(s->internal->tlsext_ocsp_ids, 893 if ((id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids,
894 i)) == NULL) 894 i)) == NULL)
895 return 0; 895 return 0;
896 if ((id_len = i2d_OCSP_RESPID(id, NULL)) == -1) 896 if ((id_len = i2d_OCSP_RESPID(id, NULL)) == -1)
@@ -904,12 +904,12 @@ tlsext_ocsp_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
904 } 904 }
905 if (!CBB_add_u16_length_prefixed(cbb, &exts)) 905 if (!CBB_add_u16_length_prefixed(cbb, &exts))
906 return 0; 906 return 0;
907 if ((ext_len = i2d_X509_EXTENSIONS(s->internal->tlsext_ocsp_exts, 907 if ((ext_len = i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts,
908 NULL)) == -1) 908 NULL)) == -1)
909 return 0; 909 return 0;
910 if (!CBB_add_space(&exts, &ext_data, ext_len)) 910 if (!CBB_add_space(&exts, &ext_data, ext_len))
911 return 0; 911 return 0;
912 if ((i2d_X509_EXTENSIONS(s->internal->tlsext_ocsp_exts, &ext_data) != 912 if ((i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &ext_data) !=
913 ext_len)) 913 ext_len))
914 return 0; 914 return 0;
915 if (!CBB_flush(cbb)) 915 if (!CBB_flush(cbb))
@@ -946,11 +946,11 @@ tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
946 goto err; 946 goto err;
947 947
948 /* XXX */ 948 /* XXX */
949 sk_OCSP_RESPID_pop_free(s->internal->tlsext_ocsp_ids, OCSP_RESPID_free); 949 sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
950 s->internal->tlsext_ocsp_ids = NULL; 950 s->tlsext_ocsp_ids = NULL;
951 if (CBS_len(&respid_list) > 0) { 951 if (CBS_len(&respid_list) > 0) {
952 s->internal->tlsext_ocsp_ids = sk_OCSP_RESPID_new_null(); 952 s->tlsext_ocsp_ids = sk_OCSP_RESPID_new_null();
953 if (s->internal->tlsext_ocsp_ids == NULL) { 953 if (s->tlsext_ocsp_ids == NULL) {
954 alert_desc = SSL_AD_INTERNAL_ERROR; 954 alert_desc = SSL_AD_INTERNAL_ERROR;
955 goto err; 955 goto err;
956 } 956 }
@@ -964,7 +964,7 @@ tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
964 p = CBS_data(&respid); 964 p = CBS_data(&respid);
965 if ((id = d2i_OCSP_RESPID(NULL, &p, CBS_len(&respid))) == NULL) 965 if ((id = d2i_OCSP_RESPID(NULL, &p, CBS_len(&respid))) == NULL)
966 goto err; 966 goto err;
967 if (!sk_OCSP_RESPID_push(s->internal->tlsext_ocsp_ids, id)) { 967 if (!sk_OCSP_RESPID_push(s->tlsext_ocsp_ids, id)) {
968 alert_desc = SSL_AD_INTERNAL_ERROR; 968 alert_desc = SSL_AD_INTERNAL_ERROR;
969 OCSP_RESPID_free(id); 969 OCSP_RESPID_free(id);
970 goto err; 970 goto err;
@@ -975,10 +975,10 @@ tlsext_ocsp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
975 if (!CBS_get_u16_length_prefixed(cbs, &exts)) 975 if (!CBS_get_u16_length_prefixed(cbs, &exts))
976 goto err; 976 goto err;
977 if (CBS_len(&exts) > 0) { 977 if (CBS_len(&exts) > 0) {
978 sk_X509_EXTENSION_pop_free(s->internal->tlsext_ocsp_exts, 978 sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
979 X509_EXTENSION_free); 979 X509_EXTENSION_free);
980 p = CBS_data(&exts); 980 p = CBS_data(&exts);
981 if ((s->internal->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL, 981 if ((s->tlsext_ocsp_exts = d2i_X509_EXTENSIONS(NULL,
982 &p, CBS_len(&exts))) == NULL) 982 &p, CBS_len(&exts))) == NULL)
983 goto err; 983 goto err;
984 } 984 }
@@ -995,14 +995,14 @@ tlsext_ocsp_server_needs(SSL *s, uint16_t msg_type)
995{ 995{
996 if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION && 996 if (s->s3->hs.negotiated_tls_version >= TLS1_3_VERSION &&
997 s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp && 997 s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp &&
998 s->ctx->internal->tlsext_status_cb != NULL) { 998 s->ctx->tlsext_status_cb != NULL) {
999 s->internal->tlsext_status_expected = 0; 999 s->tlsext_status_expected = 0;
1000 if (s->ctx->internal->tlsext_status_cb(s, 1000 if (s->ctx->tlsext_status_cb(s,
1001 s->ctx->internal->tlsext_status_arg) == SSL_TLSEXT_ERR_OK && 1001 s->ctx->tlsext_status_arg) == SSL_TLSEXT_ERR_OK &&
1002 s->internal->tlsext_ocsp_resp_len > 0) 1002 s->tlsext_ocsp_resp_len > 0)
1003 s->internal->tlsext_status_expected = 1; 1003 s->tlsext_status_expected = 1;
1004 } 1004 }
1005 return s->internal->tlsext_status_expected; 1005 return s->tlsext_status_expected;
1006} 1006}
1007 1007
1008static int 1008static int
@@ -1016,8 +1016,8 @@ tlsext_ocsp_server_build(SSL *s, uint16_t msg_type, CBB *cbb)
1016 if (!CBB_add_u24_length_prefixed(cbb, &ocsp_response)) 1016 if (!CBB_add_u24_length_prefixed(cbb, &ocsp_response))
1017 return 0; 1017 return 0;
1018 if (!CBB_add_bytes(&ocsp_response, 1018 if (!CBB_add_bytes(&ocsp_response,
1019 s->internal->tlsext_ocsp_resp, 1019 s->tlsext_ocsp_resp,
1020 s->internal->tlsext_ocsp_resp_len)) 1020 s->tlsext_ocsp_resp_len))
1021 return 0; 1021 return 0;
1022 if (!CBB_flush(cbb)) 1022 if (!CBB_flush(cbb))
1023 return 0; 1023 return 0;
@@ -1059,8 +1059,8 @@ tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1059 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG); 1059 SSLerror(s, SSL_R_DATA_LENGTH_TOO_LONG);
1060 return 0; 1060 return 0;
1061 } 1061 }
1062 if (!CBS_stow(&response, &s->internal->tlsext_ocsp_resp, 1062 if (!CBS_stow(&response, &s->tlsext_ocsp_resp,
1063 &s->internal->tlsext_ocsp_resp_len)) { 1063 &s->tlsext_ocsp_resp_len)) {
1064 *alert = SSL_AD_INTERNAL_ERROR; 1064 *alert = SSL_AD_INTERNAL_ERROR;
1065 return 0; 1065 return 0;
1066 } 1066 }
@@ -1070,7 +1070,7 @@ tlsext_ocsp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1070 return 0; 1070 return 0;
1071 } 1071 }
1072 /* Set flag to expect CertificateStatus message */ 1072 /* Set flag to expect CertificateStatus message */
1073 s->internal->tlsext_status_expected = 1; 1073 s->tlsext_status_expected = 1;
1074 } 1074 }
1075 return 1; 1075 return 1;
1076} 1076}
@@ -1092,11 +1092,11 @@ tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type)
1092 if (!ssl_security_tickets(s)) 1092 if (!ssl_security_tickets(s))
1093 return 0; 1093 return 0;
1094 1094
1095 if (s->internal->new_session) 1095 if (s->new_session)
1096 return 1; 1096 return 1;
1097 1097
1098 if (s->internal->tlsext_session_ticket != NULL && 1098 if (s->tlsext_session_ticket != NULL &&
1099 s->internal->tlsext_session_ticket->data == NULL) 1099 s->tlsext_session_ticket->data == NULL)
1100 return 0; 1100 return 0;
1101 1101
1102 return 1; 1102 return 1;
@@ -1109,7 +1109,7 @@ tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
1109 * Signal that we support session tickets by sending an empty 1109 * Signal that we support session tickets by sending an empty
1110 * extension when renegotiating or no session found. 1110 * extension when renegotiating or no session found.
1111 */ 1111 */
1112 if (s->internal->new_session || s->session == NULL) 1112 if (s->new_session || s->session == NULL)
1113 return 1; 1113 return 1;
1114 1114
1115 if (s->session->tlsext_tick != NULL) { 1115 if (s->session->tlsext_tick != NULL) {
@@ -1118,18 +1118,18 @@ tlsext_sessionticket_client_build(SSL *s, uint16_t msg_type, CBB *cbb)
1118 s->session->tlsext_ticklen)) 1118 s->session->tlsext_ticklen))
1119 return 0; 1119 return 0;
1120 1120
1121 } else if (s->internal->tlsext_session_ticket != NULL) { 1121 } else if (s->tlsext_session_ticket != NULL) {
1122 /* 1122 /*
1123 * Attempt to resume with a custom provided session ticket set 1123 * Attempt to resume with a custom provided session ticket set
1124 * by SSL_set_session_ticket_ext(). 1124 * by SSL_set_session_ticket_ext().
1125 */ 1125 */
1126 if (s->internal->tlsext_session_ticket->length > 0) { 1126 if (s->tlsext_session_ticket->length > 0) {
1127 size_t ticklen = s->internal->tlsext_session_ticket->length; 1127 size_t ticklen = s->tlsext_session_ticket->length;
1128 1128
1129 if ((s->session->tlsext_tick = malloc(ticklen)) == NULL) 1129 if ((s->session->tlsext_tick = malloc(ticklen)) == NULL)
1130 return 0; 1130 return 0;
1131 memcpy(s->session->tlsext_tick, 1131 memcpy(s->session->tlsext_tick,
1132 s->internal->tlsext_session_ticket->data, 1132 s->tlsext_session_ticket->data,
1133 ticklen); 1133 ticklen);
1134 s->session->tlsext_ticklen = ticklen; 1134 s->session->tlsext_ticklen = ticklen;
1135 1135
@@ -1149,10 +1149,10 @@ static int
1149tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, 1149tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
1150 int *alert) 1150 int *alert)
1151{ 1151{
1152 if (s->internal->tls_session_ticket_ext_cb) { 1152 if (s->tls_session_ticket_ext_cb) {
1153 if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), 1153 if (!s->tls_session_ticket_ext_cb(s, CBS_data(cbs),
1154 (int)CBS_len(cbs), 1154 (int)CBS_len(cbs),
1155 s->internal->tls_session_ticket_ext_cb_arg)) { 1155 s->tls_session_ticket_ext_cb_arg)) {
1156 *alert = SSL_AD_INTERNAL_ERROR; 1156 *alert = SSL_AD_INTERNAL_ERROR;
1157 return 0; 1157 return 0;
1158 } 1158 }
@@ -1170,7 +1170,7 @@ tlsext_sessionticket_server_parse(SSL *s, uint16_t msg_type, CBS *cbs,
1170static int 1170static int
1171tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type) 1171tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type)
1172{ 1172{
1173 return (s->internal->tlsext_ticket_expected && 1173 return (s->tlsext_ticket_expected &&
1174 !(SSL_get_options(s) & SSL_OP_NO_TICKET) && 1174 !(SSL_get_options(s) & SSL_OP_NO_TICKET) &&
1175 ssl_security_tickets(s)); 1175 ssl_security_tickets(s));
1176} 1176}
@@ -1186,10 +1186,10 @@ static int
1186tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, 1186tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
1187 int *alert) 1187 int *alert)
1188{ 1188{
1189 if (s->internal->tls_session_ticket_ext_cb) { 1189 if (s->tls_session_ticket_ext_cb) {
1190 if (!s->internal->tls_session_ticket_ext_cb(s, CBS_data(cbs), 1190 if (!s->tls_session_ticket_ext_cb(s, CBS_data(cbs),
1191 (int)CBS_len(cbs), 1191 (int)CBS_len(cbs),
1192 s->internal->tls_session_ticket_ext_cb_arg)) { 1192 s->tls_session_ticket_ext_cb_arg)) {
1193 *alert = SSL_AD_INTERNAL_ERROR; 1193 *alert = SSL_AD_INTERNAL_ERROR;
1194 return 0; 1194 return 0;
1195 } 1195 }
@@ -1200,7 +1200,7 @@ tlsext_sessionticket_client_parse(SSL *s, uint16_t msg_type, CBS *cbs,
1200 return 0; 1200 return 0;
1201 } 1201 }
1202 1202
1203 s->internal->tlsext_ticket_expected = 1; 1203 s->tlsext_ticket_expected = 1;
1204 1204
1205 return 1; 1205 return 1;
1206} 1206}
@@ -1310,7 +1310,7 @@ tlsext_srtp_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1310 goto err; 1310 goto err;
1311 1311
1312 if (cprof->id == sprof->id) { 1312 if (cprof->id == sprof->id) {
1313 s->internal->srtp_profile = sprof; 1313 s->srtp_profile = sprof;
1314 ret = 1; 1314 ret = 1;
1315 goto done; 1315 goto done;
1316 } 1316 }
@@ -1397,7 +1397,7 @@ tlsext_srtp_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1397 } 1397 }
1398 1398
1399 if (prof->id == id) { 1399 if (prof->id == id) {
1400 s->internal->srtp_profile = prof; 1400 s->srtp_profile = prof;
1401 return 1; 1401 return 1;
1402 } 1402 }
1403 } 1403 }
@@ -1899,15 +1899,15 @@ tlsext_psk_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert)
1899static int 1899static int
1900tlsext_quic_transport_parameters_client_needs(SSL *s, uint16_t msg_type) 1900tlsext_quic_transport_parameters_client_needs(SSL *s, uint16_t msg_type)
1901{ 1901{
1902 return SSL_is_quic(s) && s->internal->quic_transport_params_len > 0; 1902 return SSL_is_quic(s) && s->quic_transport_params_len > 0;
1903} 1903}
1904 1904
1905static int 1905static int
1906tlsext_quic_transport_parameters_client_build(SSL *s, uint16_t msg_type, 1906tlsext_quic_transport_parameters_client_build(SSL *s, uint16_t msg_type,
1907 CBB *cbb) 1907 CBB *cbb)
1908{ 1908{
1909 if (!CBB_add_bytes(cbb, s->internal->quic_transport_params, 1909 if (!CBB_add_bytes(cbb, s->quic_transport_params,
1910 s->internal->quic_transport_params_len)) 1910 s->quic_transport_params_len))
1911 return 0; 1911 return 0;
1912 1912
1913 return 1; 1913 return 1;
@@ -1934,15 +1934,15 @@ tlsext_quic_transport_parameters_client_parse(SSL *s, uint16_t msg_type,
1934static int 1934static int
1935tlsext_quic_transport_parameters_server_needs(SSL *s, uint16_t msg_type) 1935tlsext_quic_transport_parameters_server_needs(SSL *s, uint16_t msg_type)
1936{ 1936{
1937 return SSL_is_quic(s) && s->internal->quic_transport_params_len > 0; 1937 return SSL_is_quic(s) && s->quic_transport_params_len > 0;
1938} 1938}
1939 1939
1940static int 1940static int
1941tlsext_quic_transport_parameters_server_build(SSL *s, uint16_t msg_type, 1941tlsext_quic_transport_parameters_server_build(SSL *s, uint16_t msg_type,
1942 CBB *cbb) 1942 CBB *cbb)
1943{ 1943{
1944 if (!CBB_add_bytes(cbb, s->internal->quic_transport_params, 1944 if (!CBB_add_bytes(cbb, s->quic_transport_params,
1945 s->internal->quic_transport_params_len)) 1945 s->quic_transport_params_len))
1946 return 0; 1946 return 0;
1947 1947
1948 return 1; 1948 return 1;
@@ -2294,7 +2294,7 @@ tlsext_clienthello_hash_extension(SSL *s, uint16_t type, CBS *cbs)
2294 * RFC 8446 4.1.2. For subsequent CH, early data will be removed, 2294 * RFC 8446 4.1.2. For subsequent CH, early data will be removed,
2295 * cookie may be added, padding may be removed. 2295 * cookie may be added, padding may be removed.
2296 */ 2296 */
2297 struct tls13_ctx *ctx = s->internal->tls13; 2297 struct tls13_ctx *ctx = s->tls13;
2298 2298
2299 if (type == TLSEXT_TYPE_early_data || type == TLSEXT_TYPE_cookie || 2299 if (type == TLSEXT_TYPE_early_data || type == TLSEXT_TYPE_cookie ||
2300 type == TLSEXT_TYPE_padding) 2300 type == TLSEXT_TYPE_padding)
@@ -2344,11 +2344,11 @@ tlsext_parse(SSL *s, int is_server, uint16_t msg_type, CBS *cbs, int *alert)
2344 if (!CBS_get_u16_length_prefixed(&extensions, &extension_data)) 2344 if (!CBS_get_u16_length_prefixed(&extensions, &extension_data))
2345 goto err; 2345 goto err;
2346 2346
2347 if (s->internal->tlsext_debug_cb != NULL) 2347 if (s->tlsext_debug_cb != NULL)
2348 s->internal->tlsext_debug_cb(s, !is_server, type, 2348 s->tlsext_debug_cb(s, !is_server, type,
2349 (unsigned char *)CBS_data(&extension_data), 2349 (unsigned char *)CBS_data(&extension_data),
2350 CBS_len(&extension_data), 2350 CBS_len(&extension_data),
2351 s->internal->tlsext_debug_arg); 2351 s->tlsext_debug_arg);
2352 2352
2353 /* Unknown extensions are ignored. */ 2353 /* Unknown extensions are ignored. */
2354 if ((tlsext = tls_extension_find(type, &idx)) == NULL) 2354 if ((tlsext = tls_extension_find(type, &idx)) == NULL)
@@ -2397,7 +2397,7 @@ tlsext_server_reset_state(SSL *s)
2397 free(s->s3->alpn_selected); 2397 free(s->s3->alpn_selected);
2398 s->s3->alpn_selected = NULL; 2398 s->s3->alpn_selected = NULL;
2399 s->s3->alpn_selected_len = 0; 2399 s->s3->alpn_selected_len = 0;
2400 s->internal->srtp_profile = NULL; 2400 s->srtp_profile = NULL;
2401} 2401}
2402 2402
2403int 2403int