OpenCoverage

extensions_clnt.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/statem/extensions_clnt.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <openssl/ocsp.h>-
11#include "../ssl_locl.h"-
12#include "internal/cryptlib.h"-
13#include "statem_locl.h"-
14-
15EXT_RETURN tls_construct_ctos_renegotiate(SSL *s, WPACKET *pkt,-
16 unsigned int context, X509 *x,-
17 size_t chainidx)-
18{-
19 /* Add RI if renegotiating */-
20 if (!s->renegotiate)
!s->renegotiateDescription
TRUEevaluated 4915 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
24-4915
21 return EXT_RETURN_NOT_SENT;
executed 4915 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4915
22-
23 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate)
!WPACKET_put_b..., (0xff01), 2)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
24 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
25 || !WPACKET_sub_memcpy_u8(pkt, s->s3->previous_client_finished,
!WPACKET_sub_m...ished_len), 1)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
26 s->s3->previous_client_finished_len)-
27 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24
28 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE,-
29 ERR_R_INTERNAL_ERROR);-
30 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
31 }-
32-
33 return EXT_RETURN_SENT;
executed 24 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
24
34}-
35-
36EXT_RETURN tls_construct_ctos_server_name(SSL *s, WPACKET *pkt,-
37 unsigned int context, X509 *x,-
38 size_t chainidx)-
39{-
40 if (s->ext.hostname == NULL)
s->ext.hostname == ((void *)0)Description
TRUEevaluated 1723 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
1723-3216
41 return EXT_RETURN_NOT_SENT;
executed 1723 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
1723
42-
43 /* Add TLS extension servername to the Client Hello message */-
44 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
!WPACKET_put_b...(pkt), (0), 2)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
45 /* Sub-packet for server_name extension */-
46 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
47 /* Sub-packet for servername list (always 1 hostname)*/-
48 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
49 || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name)
!WPACKET_put_b...(pkt), (0), 1)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
50 || !WPACKET_sub_memcpy_u16(pkt, s->ext.hostname,
!WPACKET_sub_m...hostname)), 2)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
51 strlen(s->ext.hostname))-
52 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
53 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3216 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3216
54 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME,-
55 ERR_R_INTERNAL_ERROR);-
56 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
57 }-
58-
59 return EXT_RETURN_SENT;
executed 3216 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
3216
60}-
61-
62/* Push a Max Fragment Len extension into ClientHello */-
63EXT_RETURN tls_construct_ctos_maxfragmentlen(SSL *s, WPACKET *pkt,-
64 unsigned int context, X509 *x,-
65 size_t chainidx)-
66{-
67 if (s->ext.max_fragment_len_mode == TLSEXT_max_fragment_length_DISABLED)
s->ext.max_fra..._len_mode == 0Description
TRUEevaluated 4929 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
10-4929
68 return EXT_RETURN_NOT_SENT;
executed 4929 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4929
69-
70 /* Add Max Fragment Length extension if client enabled it. */-
71 /*--
72 * 4 bytes for this extension type and extension length-
73 * 1 byte for the Max Fragment Length code value.-
74 */-
75 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_max_fragment_length)
!WPACKET_put_b...(pkt), (1), 2)Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10
76 /* Sub-packet for Max Fragment Length extension (1 byte) */-
77 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10
78 || !WPACKET_put_bytes_u8(pkt, s->ext.max_fragment_len_mode)
!WPACKET_put_b..._len_mode), 1)Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10
79 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10
80 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
81 SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN, ERR_R_INTERNAL_ERROR);-
82 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
83 }-
84-
85 return EXT_RETURN_SENT;
executed 10 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
10
86}-
87-
88#ifndef OPENSSL_NO_SRP-
89EXT_RETURN tls_construct_ctos_srp(SSL *s, WPACKET *pkt, unsigned int context,-
90 X509 *x, size_t chainidx)-
91{-
92 /* Add SRP username if there is one */-
93 if (s->srp_ctx.login == NULL)
s->srp_ctx.log...== ((void *)0)Description
TRUEevaluated 4928 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
11-4928
94 return EXT_RETURN_NOT_SENT;
executed 4928 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4928
95-
96 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp)
!WPACKET_put_b...pkt), (12), 2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
97 /* Sub-packet for SRP extension */-
98 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
99 || !WPACKET_start_sub_packet_u8(pkt)
!WPACKET_start...en__((pkt), 1)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
100 /* login must not be zero...internal error if so */-
101 || !WPACKET_set_flags(pkt, WPACKET_FLAGS_NON_ZERO_LENGTH)
!WPACKET_set_flags(pkt, 1)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
102 || !WPACKET_memcpy(pkt, s->srp_ctx.login,
!WPACKET_memcp...rp_ctx.login))Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
103 strlen(s->srp_ctx.login))
!WPACKET_memcp...rp_ctx.login))Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
104 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
105 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
106 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_SRP,-
107 ERR_R_INTERNAL_ERROR);-
108 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
109 }-
110-
111 return EXT_RETURN_SENT;
executed 11 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
11
112}-
113#endif-
114-
115#ifndef OPENSSL_NO_EC-
116static int use_ecc(SSL *s)-
117{-
118 int i, end;-
119 unsigned long alg_k, alg_a;-
120 STACK_OF(SSL_CIPHER) *cipher_stack = NULL;-
121-
122 /* See if we support any ECC ciphersuites */-
123 if (s->version == SSL3_VERSION)
s->version == 0x0300Description
TRUEnever evaluated
FALSEevaluated 9878 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9878
124 return 0;
never executed: return 0;
0
125-
126 cipher_stack = SSL_get_ciphers(s);-
127 end = sk_SSL_CIPHER_num(cipher_stack);-
128 for (i = 0; i < end; i++) {
i < endDescription
TRUEevaluated 9878 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 154 times by 1 test
Evaluated by:
  • libssl.so.1.1
154-9878
129 const SSL_CIPHER *c = sk_SSL_CIPHER_value(cipher_stack, i);-
130-
131 alg_k = c->algorithm_mkey;-
132 alg_a = c->algorithm_auth;-
133 if ((alg_k & (SSL_kECDHE | SSL_kECDHEPSK))
(alg_k & (0x00... 0x00000080U))Description
TRUEevaluated 74 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9804 times by 1 test
Evaluated by:
  • libssl.so.1.1
74-9804
134 || (alg_a & SSL_aECDSA)
(alg_a & 0x00000008U)Description
TRUEnever evaluated
FALSEevaluated 9804 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9804
135 || c->min_tls >= TLS1_3_VERSION)
c->min_tls >= 0x0304Description
TRUEevaluated 9650 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 154 times by 1 test
Evaluated by:
  • libssl.so.1.1
154-9650
136 return 1;
executed 9724 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
9724
137 }
executed 154 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
154
138-
139 return 0;
executed 154 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
154
140}-
141-
142EXT_RETURN tls_construct_ctos_ec_pt_formats(SSL *s, WPACKET *pkt,-
143 unsigned int context, X509 *x,-
144 size_t chainidx)-
145{-
146 const unsigned char *pformats;-
147 size_t num_formats;-
148-
149 if (!use_ecc(s))
!use_ecc(s)Description
TRUEevaluated 77 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
77-4862
150 return EXT_RETURN_NOT_SENT;
executed 77 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
77
151-
152 /* Add TLS extension ECPointFormats to the ClientHello message */-
153 tls1_get_formatlist(s, &pformats, &num_formats);-
154-
155 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats)
!WPACKET_put_b...pkt), (11), 2)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
156 /* Sub-packet for formats extension */-
157 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
158 || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats)
!WPACKET_sub_m...m_formats), 1)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
159 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
160 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
161 SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);-
162 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
163 }-
164-
165 return EXT_RETURN_SENT;
executed 4862 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4862
166}-
167-
168EXT_RETURN tls_construct_ctos_supported_groups(SSL *s, WPACKET *pkt,-
169 unsigned int context, X509 *x,-
170 size_t chainidx)-
171{-
172 const uint16_t *pgroups = NULL;-
173 size_t num_groups = 0, i;-
174-
175 if (!use_ecc(s))
!use_ecc(s)Description
TRUEevaluated 77 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
77-4862
176 return EXT_RETURN_NOT_SENT;
executed 77 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
77
177-
178 /*-
179 * Add TLS extension supported_groups to the ClientHello message-
180 */-
181 /* TODO(TLS1.3): Add support for DHE groups */-
182 tls1_get_supported_groups(s, &pgroups, &num_groups);-
183-
184 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_groups)
!WPACKET_put_b...pkt), (10), 2)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
185 /* Sub-packet for supported_groups extension */-
186 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
187 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
188 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
189 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,-
190 ERR_R_INTERNAL_ERROR);-
191 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
192 }-
193 /* Copy curve ID if supported */-
194 for (i = 0; i < num_groups; i++) {
i < num_groupsDescription
TRUEevaluated 24131 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
4862-24131
195 uint16_t ctmp = pgroups[i];-
196-
197 if (tls_curve_allowed(s, ctmp, SSL_SECOP_CURVE_SUPPORTED)) {
tls_curve_allo... | (2 << 16)))Description
TRUEevaluated 24131 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-24131
198 if (!WPACKET_put_bytes_u16(pkt, ctmp)) {
!WPACKET_put_b...t), (ctmp), 2)Description
TRUEnever evaluated
FALSEevaluated 24131 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-24131
199 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
200 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,-
201 ERR_R_INTERNAL_ERROR);-
202 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
203 }-
204 }
executed 24131 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
24131
205 }
executed 24131 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
24131
206 if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 4862 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4862
207 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
208 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS,-
209 ERR_R_INTERNAL_ERROR);-
210 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
211 }-
212-
213 return EXT_RETURN_SENT;
executed 4862 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4862
214}-
215#endif-
216-
217EXT_RETURN tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt,-
218 unsigned int context, X509 *x,-
219 size_t chainidx)-
220{-
221 size_t ticklen;-
222-
223 if (!tls_use_ticket(s))
!tls_use_ticket(s)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4927 times by 1 test
Evaluated by:
  • libssl.so.1.1
12-4927
224 return EXT_RETURN_NOT_SENT;
executed 12 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
12
225-
226 if (!s->new_session && s->session != NULL
!s->new_sessionDescription
TRUEevaluated 4912 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->session != ((void *)0)Description
TRUEevaluated 4912 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-4912
227 && s->session->ext.tick != NULL
s->session->ex...!= ((void *)0)Description
TRUEevaluated 224 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4688 times by 1 test
Evaluated by:
  • libssl.so.1.1
224-4688
228 && s->session->ssl_version != TLS1_3_VERSION) {
s->session->ss...sion != 0x0304Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
81-143
229 ticklen = s->session->ext.ticklen;-
230 } else if (s->session && s->ext.session_ticket != NULL
executed 81 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
s->sessionDescription
TRUEevaluated 4846 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
s->ext.session...!= ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4845 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4846
231 && s->ext.session_ticket->data != NULL) {
s->ext.session...!= ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-1
232 ticklen = s->ext.session_ticket->length;-
233 s->session->ext.tick = OPENSSL_malloc(ticklen);-
234 if (s->session->ext.tick == NULL) {
s->session->ex...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
0-1
235 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
236 SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET,-
237 ERR_R_INTERNAL_ERROR);-
238 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
239 }-
240 memcpy(s->session->ext.tick,-
241 s->ext.session_ticket->data, ticklen);-
242 s->session->ext.ticklen = ticklen;-
243 } else {
executed 1 time by 1 test: end of block
Executed by:
  • libssl.so.1.1
1
244 ticklen = 0;-
245 }
executed 4845 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
4845
246-
247 if (ticklen == 0 && s->ext.session_ticket != NULL &&
ticklen == 0Description
TRUEevaluated 4845 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 82 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->ext.session...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4845 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4845
248 s->ext.session_ticket->data == NULL)
s->ext.session...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
249 return EXT_RETURN_NOT_SENT;
never executed: return EXT_RETURN_NOT_SENT;
0
250-
251 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_session_ticket)
!WPACKET_put_b...pkt), (35), 2)Description
TRUEnever evaluated
FALSEevaluated 4927 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4927
252 || !WPACKET_sub_memcpy_u16(pkt, s->session->ext.tick, ticklen)) {
!WPACKET_sub_m... (ticklen), 2)Description
TRUEnever evaluated
FALSEevaluated 4927 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4927
253 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
254 SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET, ERR_R_INTERNAL_ERROR);-
255 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
256 }-
257-
258 return EXT_RETURN_SENT;
executed 4927 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4927
259}-
260-
261EXT_RETURN tls_construct_ctos_sig_algs(SSL *s, WPACKET *pkt,-
262 unsigned int context, X509 *x,-
263 size_t chainidx)-
264{-
265 size_t salglen;-
266 const uint16_t *salg;-
267-
268 if (!SSL_CLIENT_USE_SIGALGS(s))
((s->client_ve...on) == 0x0100)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 190 times by 1 test
Evaluated by:
  • libssl.so.1.1
((0xFEFD) == 0x0100)Description
TRUEnever evaluated
FALSEevaluated 192 times by 1 test
Evaluated by:
  • libssl.so.1.1
!(s->method->s...c_flags & 0x8)Description
TRUEevaluated 4793 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 192 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->client_version >= 0x0303Description
TRUEevaluated 4503 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 290 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s->method->ss...c_flags & 0x8)Description
TRUEevaluated 192 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 290 times by 1 test
Evaluated by:
  • libssl.so.1.1
((((s->client_...0 : (0xFEFD)))Description
TRUEevaluated 160 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4793
269 return EXT_RETURN_NOT_SENT;
executed 322 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
322
270-
271 salglen = tls12_get_psigalgs(s, 1, &salg);-
272 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signature_algorithms)
!WPACKET_put_b...pkt), (13), 2)Description
TRUEnever evaluated
FALSEevaluated 4663 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4663
273 /* Sub-packet for sig-algs extension */-
274 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 4663 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4663
275 /* Sub-packet for the actual list */-
276 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 4663 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4663
277 || !tls12_copy_sigalgs(s, pkt, salg, salglen)
!tls12_copy_si...salg, salglen)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4662 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-4662
278 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 4662 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4662
279 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 4662 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4662
280 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS,-
281 ERR_R_INTERNAL_ERROR);-
282 return EXT_RETURN_FAIL;
executed 1 time by 1 test: return EXT_RETURN_FAIL;
Executed by:
  • libssl.so.1.1
1
283 }-
284-
285 return EXT_RETURN_SENT;
executed 4662 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4662
286}-
287-
288#ifndef OPENSSL_NO_OCSP-
289EXT_RETURN tls_construct_ctos_status_request(SSL *s, WPACKET *pkt,-
290 unsigned int context, X509 *x,-
291 size_t chainidx)-
292{-
293 int i;-
294-
295 /* This extension isn't defined for client Certificates */-
296 if (x != NULL)
x != ((void *)0)Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4939 times by 1 test
Evaluated by:
  • libssl.so.1.1
34-4939
297 return EXT_RETURN_NOT_SENT;
executed 34 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
34
298-
299 if (s->ext.status_type != TLSEXT_STATUSTYPE_ocsp)
s->ext.status_type != 1Description
TRUEevaluated 4916 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
23-4916
300 return EXT_RETURN_NOT_SENT;
executed 4916 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4916
301-
302 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_status_request)
!WPACKET_put_b...(pkt), (5), 2)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
303 /* Sub-packet for status request extension */-
304 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
305 || !WPACKET_put_bytes_u8(pkt, TLSEXT_STATUSTYPE_ocsp)
!WPACKET_put_b...(pkt), (1), 1)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
306 /* Sub-packet for the ids */-
307 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
308 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
309 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST, ERR_R_INTERNAL_ERROR);-
310 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
311 }-
312 for (i = 0; i < sk_OCSP_RESPID_num(s->ext.ocsp.ids); i++) {
i < sk_OCSP_RE...>ext.ocsp.ids)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-23
313 unsigned char *idbytes;-
314 OCSP_RESPID *id = sk_OCSP_RESPID_value(s->ext.ocsp.ids, i);-
315 int idlen = i2d_OCSP_RESPID(id, NULL);-
316-
317 if (idlen <= 0
idlen <= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
0-1
318 /* Sub-packet for an individual id */-
319 || !WPACKET_sub_allocate_bytes_u16(pkt, idlen, &idbytes)
!WPACKET_sub_a...(&idbytes), 2)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
0-1
320 || i2d_OCSP_RESPID(id, &idbytes) != idlen) {
i2d_OCSP_RESPI...ytes) != idlenDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
0-1
321 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
322 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST,-
323 ERR_R_INTERNAL_ERROR);-
324 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
325 }-
326 }
executed 1 time by 1 test: end of block
Executed by:
  • libssl.so.1.1
1
327 if (!WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
328 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
329 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
330 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST, ERR_R_INTERNAL_ERROR);-
331 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
332 }-
333 if (s->ext.ocsp.exts) {
s->ext.ocsp.extsDescription
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
334 unsigned char *extbytes;-
335 int extlen = i2d_X509_EXTENSIONS(s->ext.ocsp.exts, NULL);-
336-
337 if (extlen < 0) {
extlen < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
338 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
339 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST,-
340 ERR_R_INTERNAL_ERROR);-
341 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
342 }-
343 if (!WPACKET_allocate_bytes(pkt, extlen, &extbytes)
!WPACKET_alloc...en, &extbytes)Description
TRUEnever evaluated
FALSEnever evaluated
0
344 || i2d_X509_EXTENSIONS(s->ext.ocsp.exts, &extbytes)
i2d_X509_EXTEN...tes) != extlenDescription
TRUEnever evaluated
FALSEnever evaluated
0
345 != extlen) {
i2d_X509_EXTEN...tes) != extlenDescription
TRUEnever evaluated
FALSEnever evaluated
0
346 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
347 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST,-
348 ERR_R_INTERNAL_ERROR);-
349 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
350 }-
351 }
never executed: end of block
0
352 if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 23 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-23
353 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
354 SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST, ERR_R_INTERNAL_ERROR);-
355 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
356 }-
357-
358 return EXT_RETURN_SENT;
executed 23 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
23
359}-
360#endif-
361-
362#ifndef OPENSSL_NO_NEXTPROTONEG-
363EXT_RETURN tls_construct_ctos_npn(SSL *s, WPACKET *pkt, unsigned int context,-
364 X509 *x, size_t chainidx)-
365{-
366 if (s->ctx->ext.npn_select_cb == NULL || !SSL_IS_FIRST_HANDSHAKE(s))
s->ctx->ext.np...== ((void *)0)Description
TRUEevaluated 4911 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 28 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->s3->tmp.f...sh_md_len == 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
(s)->s3->tmp.p...sh_md_len == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-4911
367 return EXT_RETURN_NOT_SENT;
executed 4911 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4911
368-
369 /*-
370 * The client advertises an empty extension to indicate its support-
371 * for Next Protocol Negotiation-
372 */-
373 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_next_proto_neg)
!WPACKET_put_b...), (13172), 2)Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-28
374 || !WPACKET_put_bytes_u16(pkt, 0)) {
!WPACKET_put_b...(pkt), (0), 2)Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-28
375 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_NPN,-
376 ERR_R_INTERNAL_ERROR);-
377 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
378 }-
379-
380 return EXT_RETURN_SENT;
executed 28 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
28
381}-
382#endif-
383-
384EXT_RETURN tls_construct_ctos_alpn(SSL *s, WPACKET *pkt, unsigned int context,-
385 X509 *x, size_t chainidx)-
386{-
387 s->s3->alpn_sent = 0;-
388-
389 if (s->ext.alpn == NULL || !SSL_IS_FIRST_HANDSHAKE(s))
s->ext.alpn == ((void *)0)Description
TRUEevaluated 4904 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->s3->tmp.f...sh_md_len == 0Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
(s)->s3->tmp.p...sh_md_len == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-4904
390 return EXT_RETURN_NOT_SENT;
executed 4904 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4904
391-
392 if (!WPACKET_put_bytes_u16(pkt,
!WPACKET_put_b...pkt), (16), 2)Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-35
393 TLSEXT_TYPE_application_layer_protocol_negotiation)-
394 /* Sub-packet ALPN extension */-
395 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-35
396 || !WPACKET_sub_memcpy_u16(pkt, s->ext.alpn, s->ext.alpn_len)
!WPACKET_sub_m....alpn_len), 2)Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-35
397 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-35
398 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_ALPN,-
399 ERR_R_INTERNAL_ERROR);-
400 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
401 }-
402 s->s3->alpn_sent = 1;-
403-
404 return EXT_RETURN_SENT;
executed 35 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
35
405}-
406-
407-
408#ifndef OPENSSL_NO_SRTP-
409EXT_RETURN tls_construct_ctos_use_srtp(SSL *s, WPACKET *pkt,-
410 unsigned int context, X509 *x,-
411 size_t chainidx)-
412{-
413 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = SSL_get_srtp_profiles(s);-
414 int i, end;-
415-
416 if (clnt == NULL)
clnt == ((void *)0)Description
TRUEevaluated 4939 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-4939
417 return EXT_RETURN_NOT_SENT;
executed 4939 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4939
418-
419 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_use_srtp)
!WPACKET_put_b...pkt), (14), 2)Description
TRUEnever evaluated
FALSEnever evaluated
0
420 /* Sub-packet for SRTP extension */-
421 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEnever evaluated
0
422 /* Sub-packet for the protection profile list */-
423 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEnever evaluated
0
424 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP,-
425 ERR_R_INTERNAL_ERROR);-
426 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
427 }-
428-
429 end = sk_SRTP_PROTECTION_PROFILE_num(clnt);-
430 for (i = 0; i < end; i++) {
i < endDescription
TRUEnever evaluated
FALSEnever evaluated
0
431 const SRTP_PROTECTION_PROFILE *prof =-
432 sk_SRTP_PROTECTION_PROFILE_value(clnt, i);-
433-
434 if (prof == NULL || !WPACKET_put_bytes_u16(pkt, prof->id)) {
prof == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
!WPACKET_put_b...(prof->id), 2)Description
TRUEnever evaluated
FALSEnever evaluated
0
435 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
436 SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP, ERR_R_INTERNAL_ERROR);-
437 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
438 }-
439 }
never executed: end of block
0
440 if (!WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEnever evaluated
0
441 /* Add an empty use_mki value */-
442 || !WPACKET_put_bytes_u8(pkt, 0)
!WPACKET_put_b...(pkt), (0), 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
443 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEnever evaluated
0
444 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP,-
445 ERR_R_INTERNAL_ERROR);-
446 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
447 }-
448-
449 return EXT_RETURN_SENT;
never executed: return EXT_RETURN_SENT;
0
450}-
451#endif-
452-
453EXT_RETURN tls_construct_ctos_etm(SSL *s, WPACKET *pkt, unsigned int context,-
454 X509 *x, size_t chainidx)-
455{-
456 if (s->options & SSL_OP_NO_ENCRYPT_THEN_MAC)
s->options & 0x00080000UDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4926 times by 1 test
Evaluated by:
  • libssl.so.1.1
13-4926
457 return EXT_RETURN_NOT_SENT;
executed 13 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
13
458-
459 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_encrypt_then_mac)
!WPACKET_put_b...pkt), (22), 2)Description
TRUEnever evaluated
FALSEevaluated 4926 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4926
460 || !WPACKET_put_bytes_u16(pkt, 0)) {
!WPACKET_put_b...(pkt), (0), 2)Description
TRUEnever evaluated
FALSEevaluated 4926 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4926
461 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_ETM,-
462 ERR_R_INTERNAL_ERROR);-
463 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
464 }-
465-
466 return EXT_RETURN_SENT;
executed 4926 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4926
467}-
468-
469#ifndef OPENSSL_NO_CT-
470EXT_RETURN tls_construct_ctos_sct(SSL *s, WPACKET *pkt, unsigned int context,-
471 X509 *x, size_t chainidx)-
472{-
473 if (s->ct_validation_callback == NULL)
s->ct_validati...== ((void *)0)Description
TRUEevaluated 4962 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
11-4962
474 return EXT_RETURN_NOT_SENT;
executed 4962 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4962
475-
476 /* Not defined for client Certificates */-
477 if (x != NULL)
x != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
478 return EXT_RETURN_NOT_SENT;
never executed: return EXT_RETURN_NOT_SENT;
0
479-
480 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signed_certificate_timestamp)
!WPACKET_put_b...pkt), (18), 2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
481 || !WPACKET_put_bytes_u16(pkt, 0)) {
!WPACKET_put_b...(pkt), (0), 2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-11
482 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_SCT,-
483 ERR_R_INTERNAL_ERROR);-
484 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
485 }-
486-
487 return EXT_RETURN_SENT;
executed 11 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
11
488}-
489#endif-
490-
491EXT_RETURN tls_construct_ctos_ems(SSL *s, WPACKET *pkt, unsigned int context,-
492 X509 *x, size_t chainidx)-
493{-
494 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret)
!WPACKET_put_b...pkt), (23), 2)Description
TRUEnever evaluated
FALSEevaluated 4939 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4939
495 || !WPACKET_put_bytes_u16(pkt, 0)) {
!WPACKET_put_b...(pkt), (0), 2)Description
TRUEnever evaluated
FALSEevaluated 4939 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4939
496 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_EMS,-
497 ERR_R_INTERNAL_ERROR);-
498 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
499 }-
500-
501 return EXT_RETURN_SENT;
executed 4939 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
4939
502}-
503-
504EXT_RETURN tls_construct_ctos_supported_versions(SSL *s, WPACKET *pkt,-
505 unsigned int context, X509 *x,-
506 size_t chainidx)-
507{-
508 int currv, min_version, max_version, reason;-
509-
510 reason = ssl_get_min_max_version(s, &min_version, &max_version, NULL);-
511 if (reason != 0) {
reason != 0Description
TRUEnever evaluated
FALSEevaluated 4747 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4747
512 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
513 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS, reason);-
514 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
515 }-
516-
517 /*-
518 * Don't include this if we can't negotiate TLSv1.3. We can do a straight-
519 * comparison here because we will never be called in DTLS.-
520 */-
521 if (max_version < TLS1_3_VERSION)
max_version < 0x0304Description
TRUEevaluated 829 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
829-3918
522 return EXT_RETURN_NOT_SENT;
executed 829 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
829
523-
524 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_versions)
!WPACKET_put_b...pkt), (43), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
525 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
526 || !WPACKET_start_sub_packet_u8(pkt)) {
!WPACKET_start...en__((pkt), 1)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
527 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
528 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS,-
529 ERR_R_INTERNAL_ERROR);-
530 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
531 }-
532-
533 for (currv = max_version; currv >= min_version; currv--) {
currv >= min_versionDescription
TRUEevaluated 15201 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
3918-15201
534 if (!WPACKET_put_bytes_u16(pkt, currv)) {
!WPACKET_put_b...), (currv), 2)Description
TRUEnever evaluated
FALSEevaluated 15201 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-15201
535 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
536 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS,-
537 ERR_R_INTERNAL_ERROR);-
538 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
539 }-
540 }
executed 15201 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
15201
541 if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
542 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
543 SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS,-
544 ERR_R_INTERNAL_ERROR);-
545 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
546 }-
547-
548 return EXT_RETURN_SENT;
executed 3918 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
3918
549}-
550-
551/*-
552 * Construct a psk_kex_modes extension.-
553 */-
554EXT_RETURN tls_construct_ctos_psk_kex_modes(SSL *s, WPACKET *pkt,-
555 unsigned int context, X509 *x,-
556 size_t chainidx)-
557{-
558#ifndef OPENSSL_NO_TLS1_3-
559 int nodhe = s->options & SSL_OP_ALLOW_NO_DHE_KEX;-
560-
561 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk_kex_modes)
!WPACKET_put_b...pkt), (45), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
562 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
563 || !WPACKET_start_sub_packet_u8(pkt)
!WPACKET_start...en__((pkt), 1)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
564 || !WPACKET_put_bytes_u8(pkt, TLSEXT_KEX_MODE_KE_DHE)
!WPACKET_put_b...t), (0x01), 1)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
565 || (nodhe && !WPACKET_put_bytes_u8(pkt, TLSEXT_KEX_MODE_KE))
nodheDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libssl.so.1.1
!WPACKET_put_b...t), (0x00), 1)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3916
566 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
567 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
568 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
569 SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES, ERR_R_INTERNAL_ERROR);-
570 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
571 }-
572-
573 s->ext.psk_kex_mode = TLSEXT_KEX_MODE_FLAG_KE_DHE;-
574 if (nodhe)
nodheDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3916 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3916
575 s->ext.psk_kex_mode |= TLSEXT_KEX_MODE_FLAG_KE;
executed 2 times by 1 test: s->ext.psk_kex_mode |= 1;
Executed by:
  • libssl.so.1.1
2
576#endif-
577-
578 return EXT_RETURN_SENT;
executed 3918 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
3918
579}-
580-
581#ifndef OPENSSL_NO_TLS1_3-
582static int add_key_share(SSL *s, WPACKET *pkt, unsigned int curve_id)-
583{-
584 unsigned char *encoded_point = NULL;-
585 EVP_PKEY *key_share_key = NULL;-
586 size_t encodedlen;-
587-
588 if (s->s3->tmp.pkey != NULL) {
s->s3->tmp.pkey != ((void *)0)Description
TRUEevaluated 139 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3779 times by 1 test
Evaluated by:
  • libssl.so.1.1
139-3779
589 if (!ossl_assert(s->hello_retry_request == SSL_HRR_PENDING)) {
!((s->hello_re...PENDING) != 0)Description
TRUEnever evaluated
FALSEevaluated 139 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-139
590 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_ADD_KEY_SHARE,-
591 ERR_R_INTERNAL_ERROR);-
592 return 0;
never executed: return 0;
0
593 }-
594 /*-
595 * Could happen if we got an HRR that wasn't requesting a new key_share-
596 */-
597 key_share_key = s->s3->tmp.pkey;-
598 } else {
executed 139 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
139
599 key_share_key = ssl_generate_pkey_group(s, curve_id);-
600 if (key_share_key == NULL) {
key_share_key == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 3779 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3779
601 /* SSLfatal() already called */-
602 return 0;
never executed: return 0;
0
603 }-
604 }
executed 3779 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
3779
605-
606 /* Encode the public key. */-
607 encodedlen = EVP_PKEY_get1_tls_encodedpoint(key_share_key,-
608 &encoded_point);-
609 if (encodedlen == 0) {
encodedlen == 0Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
610 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_ADD_KEY_SHARE, ERR_R_EC_LIB);-
611 goto err;
never executed: goto err;
0
612 }-
613-
614 /* Create KeyShareEntry */-
615 if (!WPACKET_put_bytes_u16(pkt, curve_id)
!WPACKET_put_b...(curve_id), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
616 || !WPACKET_sub_memcpy_u16(pkt, encoded_point, encodedlen)) {
!WPACKET_sub_m...ncodedlen), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
617 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_ADD_KEY_SHARE,-
618 ERR_R_INTERNAL_ERROR);-
619 goto err;
never executed: goto err;
0
620 }-
621-
622 /*-
623 * TODO(TLS1.3): When changing to send more than one key_share we're-
624 * going to need to be able to save more than one EVP_PKEY. For now-
625 * we reuse the existing tmp.pkey-
626 */-
627 s->s3->tmp.pkey = key_share_key;-
628 s->s3->group_id = curve_id;-
629 OPENSSL_free(encoded_point);-
630-
631 return 1;
executed 3918 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
3918
632 err:-
633 if (s->s3->tmp.pkey == NULL)
s->s3->tmp.pkey == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
634 EVP_PKEY_free(key_share_key);
never executed: EVP_PKEY_free(key_share_key);
0
635 OPENSSL_free(encoded_point);-
636 return 0;
never executed: return 0;
0
637}-
638#endif-
639-
640EXT_RETURN tls_construct_ctos_key_share(SSL *s, WPACKET *pkt,-
641 unsigned int context, X509 *x,-
642 size_t chainidx)-
643{-
644#ifndef OPENSSL_NO_TLS1_3-
645 size_t i, num_groups = 0;-
646 const uint16_t *pgroups = NULL;-
647 uint16_t curve_id = 0;-
648-
649 /* key_share extension */-
650 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_key_share)
!WPACKET_put_b...pkt), (51), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
651 /* Extension data sub-packet */-
652 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
653 /* KeyShare list sub-packet */-
654 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
655 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE,-
656 ERR_R_INTERNAL_ERROR);-
657 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
658 }-
659-
660 tls1_get_supported_groups(s, &pgroups, &num_groups);-
661-
662 /*-
663 * TODO(TLS1.3): Make the number of key_shares sent configurable. For-
664 * now, just send one-
665 */-
666 if (s->s3->group_id != 0) {
s->s3->group_id != 0Description
TRUEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3240 times by 1 test
Evaluated by:
  • libssl.so.1.1
678-3240
667 curve_id = s->s3->group_id;-
668 } else {
executed 678 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
678
669 for (i = 0; i < num_groups; i++) {
i < num_groupsDescription
TRUEevaluated 3240 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-3240
670-
671 if (!tls_curve_allowed(s, pgroups[i], SSL_SECOP_CURVE_SUPPORTED))
!tls_curve_all... | (2 << 16)))Description
TRUEnever evaluated
FALSEevaluated 3240 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3240
672 continue;
never executed: continue;
0
673-
674 curve_id = pgroups[i];-
675 break;
executed 3240 times by 1 test: break;
Executed by:
  • libssl.so.1.1
3240
676 }-
677 }
executed 3240 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
3240
678-
679 if (curve_id == 0) {
curve_id == 0Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
680 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE,-
681 SSL_R_NO_SUITABLE_KEY_SHARE);-
682 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
683 }-
684-
685 if (!add_key_share(s, pkt, curve_id)) {
!add_key_share...pkt, curve_id)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
686 /* SSLfatal() already called */-
687 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
688 }-
689-
690 if (!WPACKET_close(pkt) || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 3918 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3918
691 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE,-
692 ERR_R_INTERNAL_ERROR);-
693 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
694 }-
695 return EXT_RETURN_SENT;
executed 3918 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
3918
696#else-
697 return EXT_RETURN_NOT_SENT;-
698#endif-
699}-
700-
701EXT_RETURN tls_construct_ctos_cookie(SSL *s, WPACKET *pkt, unsigned int context,-
702 X509 *x, size_t chainidx)-
703{-
704 EXT_RETURN ret = EXT_RETURN_FAIL;-
705-
706 /* Should only be set if we've had an HRR */-
707 if (s->ext.tls13_cookie_len == 0)
s->ext.tls13_cookie_len == 0Description
TRUEevaluated 3778 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libssl.so.1.1
140-3778
708 return EXT_RETURN_NOT_SENT;
executed 3778 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
3778
709-
710 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_cookie)
!WPACKET_put_b...pkt), (44), 2)Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-140
711 /* Extension data sub-packet */-
712 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-140
713 || !WPACKET_sub_memcpy_u16(pkt, s->ext.tls13_cookie,
!WPACKET_sub_m...ookie_len), 2)Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-140
714 s->ext.tls13_cookie_len)-
715 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 140 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-140
716 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_COOKIE,-
717 ERR_R_INTERNAL_ERROR);-
718 goto end;
never executed: goto end;
0
719 }-
720-
721 ret = EXT_RETURN_SENT;-
722 end:
code before this statement executed 140 times by 1 test: end:
Executed by:
  • libssl.so.1.1
140
723 OPENSSL_free(s->ext.tls13_cookie);-
724 s->ext.tls13_cookie = NULL;-
725 s->ext.tls13_cookie_len = 0;-
726-
727 return ret;
executed 140 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
140
728}-
729-
730EXT_RETURN tls_construct_ctos_early_data(SSL *s, WPACKET *pkt,-
731 unsigned int context, X509 *x,-
732 size_t chainidx)-
733{-
734#ifndef OPENSSL_NO_PSK-
735 char identity[PSK_MAX_IDENTITY_LEN + 1];-
736#endif /* OPENSSL_NO_PSK */-
737 const unsigned char *id = NULL;-
738 size_t idlen = 0;-
739 SSL_SESSION *psksess = NULL;-
740 SSL_SESSION *edsess = NULL;-
741 const EVP_MD *handmd = NULL;-
742-
743 if (s->hello_retry_request == SSL_HRR_PENDING)
s->hello_retry...SL_HRR_PENDINGDescription
TRUEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3240 times by 1 test
Evaluated by:
  • libssl.so.1.1
678-3240
744 handmd = ssl_handshake_md(s);
executed 678 times by 1 test: handmd = ssl_handshake_md(s);
Executed by:
  • libssl.so.1.1
678
745-
746 if (s->psk_use_session_cb != NULL
s->psk_use_ses...!= ((void *)0)Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3888 times by 1 test
Evaluated by:
  • libssl.so.1.1
30-3888
747 && (!s->psk_use_session_cb(s, handmd, &id, &idlen, &psksess)
!s->psk_use_se...len, &psksess)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-30
748 || (psksess != NULL
psksess != ((void *)0)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-28
749 && psksess->ssl_version != TLS1_3_VERSION))) {
psksess->ssl_version != 0x0304Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 27 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-27
750 SSL_SESSION_free(psksess);-
751 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
752 SSL_R_BAD_PSK);-
753 return EXT_RETURN_FAIL;
executed 1 time by 1 test: return EXT_RETURN_FAIL;
Executed by:
  • libssl.so.1.1
1
754 }-
755-
756#ifndef OPENSSL_NO_PSK-
757 if (psksess == NULL && s->psk_client_callback != NULL) {
psksess == ((void *)0)Description
TRUEevaluated 3890 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 27 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->psk_client_...!= ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3881 times by 1 test
Evaluated by:
  • libssl.so.1.1
9-3890
758 unsigned char psk[PSK_MAX_PSK_LEN];-
759 size_t psklen = 0;-
760-
761 memset(identity, 0, sizeof(identity));-
762 psklen = s->psk_client_callback(s, NULL, identity, sizeof(identity) - 1,-
763 psk, sizeof(psk));-
764-
765 if (psklen > PSK_MAX_PSK_LEN) {
psklen > 256Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-9
766 SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE,-
767 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA, ERR_R_INTERNAL_ERROR);-
768 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
769 } else if (psklen > 0) {
psklen > 0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-7
770 const unsigned char tls13_aes128gcmsha256_id[] = { 0x13, 0x01 };-
771 const SSL_CIPHER *cipher;-
772-
773 idlen = strlen(identity);-
774 if (idlen > PSK_MAX_IDENTITY_LEN) {
idlen > 128Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
775 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
776 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
777 ERR_R_INTERNAL_ERROR);-
778 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
779 }-
780 id = (unsigned char *)identity;-
781-
782 /*-
783 * We found a PSK using an old style callback. We don't know-
784 * the digest so we default to SHA256 as per the TLSv1.3 spec-
785 */-
786 cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);-
787 if (cipher == NULL) {
cipher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
788 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
789 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
790 ERR_R_INTERNAL_ERROR);-
791 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
792 }-
793-
794 psksess = SSL_SESSION_new();-
795 if (psksess == NULL
psksess == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
796 || !SSL_SESSION_set1_master_key(psksess, psk, psklen)
!SSL_SESSION_s..., psk, psklen)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
797 || !SSL_SESSION_set_cipher(psksess, cipher)
!SSL_SESSION_s...ksess, cipher)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
798 || !SSL_SESSION_set_protocol_version(psksess, TLS1_3_VERSION)) {
!SSL_SESSION_s...ksess, 0x0304)Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
799 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
800 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
801 ERR_R_INTERNAL_ERROR);-
802 OPENSSL_cleanse(psk, psklen);-
803 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
804 }-
805 OPENSSL_cleanse(psk, psklen);-
806 }
executed 7 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
7
807 }
executed 9 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
9
808#endif /* OPENSSL_NO_PSK */-
809-
810 SSL_SESSION_free(s->psksession);-
811 s->psksession = psksess;-
812 if (psksess != NULL) {
psksess != ((void *)0)Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3883 times by 1 test
Evaluated by:
  • libssl.so.1.1
34-3883
813 OPENSSL_free(s->psksession_id);-
814 s->psksession_id = OPENSSL_memdup(id, idlen);-
815 if (s->psksession_id == NULL) {
s->psksession_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-34
816 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
817 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA, ERR_R_INTERNAL_ERROR);-
818 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
819 }-
820 s->psksession_id_len = idlen;-
821 }
executed 34 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
34
822-
823 if (s->early_data_state != SSL_EARLY_DATA_CONNECTING
s->early_data_...ATA_CONNECTINGDescription
TRUEevaluated 3865 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 52 times by 1 test
Evaluated by:
  • libssl.so.1.1
52-3865
824 || (s->session->ext.max_early_data == 0
s->session->ex...arly_data == 0Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
14-38
825 && (psksess == NULL || psksess->ext.max_early_data == 0))) {
psksess == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
psksess->ext.m...arly_data == 0Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-14
826 s->max_early_data = 0;-
827 return EXT_RETURN_NOT_SENT;
executed 3865 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
3865
828 }-
829 edsess = s->session->ext.max_early_data != 0 ? s->session : psksess;
s->session->ex...arly_data != 0Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
14-38
830 s->max_early_data = edsess->ext.max_early_data;-
831-
832 if (edsess->ext.hostname != NULL) {
edsess->ext.ho...!= ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 49 times by 1 test
Evaluated by:
  • libssl.so.1.1
3-49
833 if (s->ext.hostname == NULL
s->ext.hostname == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
834 || (s->ext.hostname != NULL
s->ext.hostname != ((void *)0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-3
835 && strcmp(s->ext.hostname, edsess->ext.hostname) != 0)) {
never executed: __result = (((const unsigned char *) (const char *) ( s->ext.hostname ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( edsess->ext.hostname ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
__extension__ ... )))); }) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-2
836 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
837 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
838 SSL_R_INCONSISTENT_EARLY_DATA_SNI);-
839 return EXT_RETURN_FAIL;
executed 1 time by 1 test: return EXT_RETURN_FAIL;
Executed by:
  • libssl.so.1.1
1
840 }-
841 }
executed 2 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2
842-
843 if ((s->ext.alpn == NULL && edsess->ext.alpn_selected != NULL)) {
s->ext.alpn == ((void *)0)Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
edsess->ext.al...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-47
844 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
845 SSL_R_INCONSISTENT_EARLY_DATA_ALPN);-
846 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
847 }-
848-
849 /*-
850 * Verify that we are offering an ALPN protocol consistent with the early-
851 * data.-
852 */-
853 if (edsess->ext.alpn_selected != NULL) {
edsess->ext.al...!= ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 47 times by 1 test
Evaluated by:
  • libssl.so.1.1
4-47
854 PACKET prots, alpnpkt;-
855 int found = 0;-
856-
857 if (!PACKET_buf_init(&prots, s->ext.alpn, s->ext.alpn_len)) {
!PACKET_buf_in...>ext.alpn_len)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-4
858 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
859 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA, ERR_R_INTERNAL_ERROR);-
860 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
861 }-
862 while (PACKET_get_length_prefixed_1(&prots, &alpnpkt)) {
PACKET_get_len...ots, &alpnpkt)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
1-5
863 if (PACKET_equal(&alpnpkt, edsess->ext.alpn_selected,
PACKET_equal(&..._selected_len)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3
864 edsess->ext.alpn_selected_len)) {
PACKET_equal(&..._selected_len)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3
865 found = 1;-
866 break;
executed 3 times by 1 test: break;
Executed by:
  • libssl.so.1.1
3
867 }-
868 }
executed 2 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2
869 if (!found) {
!foundDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-3
870 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
871 SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
872 SSL_R_INCONSISTENT_EARLY_DATA_ALPN);-
873 return EXT_RETURN_FAIL;
executed 1 time by 1 test: return EXT_RETURN_FAIL;
Executed by:
  • libssl.so.1.1
1
874 }-
875 }
executed 3 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
3
876-
877 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_early_data)
!WPACKET_put_b...pkt), (42), 2)Description
TRUEnever evaluated
FALSEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-50
878 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-50
879 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 50 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-50
880 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA,-
881 ERR_R_INTERNAL_ERROR);-
882 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
883 }-
884-
885 /*-
886 * We set this to rejected here. Later, if the server acknowledges the-
887 * extension, we set it to accepted.-
888 */-
889 s->ext.early_data = SSL_EARLY_DATA_REJECTED;-
890 s->ext.early_data_ok = 1;-
891-
892 return EXT_RETURN_SENT;
executed 50 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
50
893}-
894-
895#define F5_WORKAROUND_MIN_MSG_LEN 0xff-
896#define F5_WORKAROUND_MAX_MSG_LEN 0x200-
897-
898/*-
899 * PSK pre binder overhead =-
900 * 2 bytes for TLSEXT_TYPE_psk-
901 * 2 bytes for extension length-
902 * 2 bytes for identities list length-
903 * 2 bytes for identity length-
904 * 4 bytes for obfuscated_ticket_age-
905 * 2 bytes for binder list length-
906 * 1 byte for binder length-
907 * The above excludes the number of bytes for the identity itself and the-
908 * subsequent binder bytes-
909 */-
910#define PSK_PRE_BINDER_OVERHEAD (2 + 2 + 2 + 2 + 4 + 2 + 1)-
911-
912EXT_RETURN tls_construct_ctos_padding(SSL *s, WPACKET *pkt,-
913 unsigned int context, X509 *x,-
914 size_t chainidx)-
915{-
916 unsigned char *padbytes;-
917 size_t hlen;-
918-
919 if ((s->options & SSL_OP_TLSEXT_PADDING) == 0)
(s->options & ...0000010U) == 0Description
TRUEevaluated 4933 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
3-4933
920 return EXT_RETURN_NOT_SENT;
executed 4933 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
4933
921-
922 /*-
923 * Add padding to workaround bugs in F5 terminators. See RFC7685.-
924 * This code calculates the length of all extensions added so far but-
925 * excludes the PSK extension (because that MUST be written last). Therefore-
926 * this extension MUST always appear second to last.-
927 */-
928 if (!WPACKET_get_total_written(pkt, &hlen)) {
!WPACKET_get_t...en(pkt, &hlen)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
929 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PADDING,-
930 ERR_R_INTERNAL_ERROR);-
931 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
932 }-
933-
934 /*-
935 * If we're going to send a PSK then that will be written out after this-
936 * extension, so we need to calculate how long it is going to be.-
937 */-
938 if (s->session->ssl_version == TLS1_3_VERSION
s->session->ss...sion == 0x0304Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-3
939 && s->session->ext.ticklen != 0
s->session->ext.ticklen != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-2
940 && s->session->cipher != NULL) {
s->session->ci...!= ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-1
941 const EVP_MD *md = ssl_md(s->session->cipher->algorithm2);-
942-
943 if (md != NULL) {
md != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-1
944 /*-
945 * Add the fixed PSK overhead, the identity length and the binder-
946 * length.-
947 */-
948 hlen += PSK_PRE_BINDER_OVERHEAD + s->session->ext.ticklen-
949 + EVP_MD_size(md);-
950 }
executed 1 time by 1 test: end of block
Executed by:
  • libssl.so.1.1
1
951 }
executed 1 time by 1 test: end of block
Executed by:
  • libssl.so.1.1
1
952-
953 if (hlen > F5_WORKAROUND_MIN_MSG_LEN && hlen < F5_WORKAROUND_MAX_MSG_LEN) {
hlen > 0xffDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
hlen < 0x200Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-2
954 /* Calculate the amount of padding we need to add */-
955 hlen = F5_WORKAROUND_MAX_MSG_LEN - hlen;-
956-
957 /*-
958 * Take off the size of extension header itself (2 bytes for type and-
959 * 2 bytes for length bytes), but ensure that the extension is at least-
960 * 1 byte long so as not to have an empty extension last (WebSphere 7.x,-
961 * 8.x are intolerant of that condition)-
962 */-
963 if (hlen > 4)
hlen > 4Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-2
964 hlen -= 4;
executed 2 times by 1 test: hlen -= 4;
Executed by:
  • libssl.so.1.1
2
965 else-
966 hlen = 1;
never executed: hlen = 1;
0
967-
968 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_padding)
!WPACKET_put_b...pkt), (21), 2)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2
969 || !WPACKET_sub_allocate_bytes_u16(pkt, hlen, &padbytes)) {
!WPACKET_sub_a...&padbytes), 2)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2
970 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PADDING,-
971 ERR_R_INTERNAL_ERROR);-
972 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
973 }-
974 memset(padbytes, 0, hlen);-
975 }
executed 2 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2
976-
977 return EXT_RETURN_SENT;
executed 3 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
3
978}-
979-
980/*-
981 * Construct the pre_shared_key extension-
982 */-
983EXT_RETURN tls_construct_ctos_psk(SSL *s, WPACKET *pkt, unsigned int context,-
984 X509 *x, size_t chainidx)-
985{-
986#ifndef OPENSSL_NO_TLS1_3-
987 uint32_t now, agesec, agems = 0;-
988 size_t reshashsize = 0, pskhashsize = 0, binderoffset, msglen;-
989 unsigned char *resbinder = NULL, *pskbinder = NULL, *msgstart = NULL;-
990 const EVP_MD *handmd = NULL, *mdres = NULL, *mdpsk = NULL;-
991 int dores = 0;-
992-
993 s->session->ext.tick_identity = TLSEXT_PSK_BAD_IDENTITY;-
994-
995 /*-
996 * Note: At this stage of the code we only support adding a single-
997 * resumption PSK. If we add support for multiple PSKs then the length-
998 * calculations in the padding extension will need to be adjusted.-
999 */-
1000-
1001 /*-
1002 * If this is an incompatible or new session then we have nothing to resume-
1003 * so don't add this extension.-
1004 */-
1005 if (s->session->ssl_version != TLS1_3_VERSION
s->session->ss...sion != 0x0304Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3885 times by 1 test
Evaluated by:
  • libssl.so.1.1
30-3885
1006 || (s->session->ext.ticklen == 0 && s->psksession == NULL))
s->session->ext.ticklen == 0Description
TRUEevaluated 3742 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->psksession == ((void *)0)Description
TRUEevaluated 3711 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-3742
1007 return EXT_RETURN_NOT_SENT;
executed 3741 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
3741
1008-
1009 if (s->hello_retry_request == SSL_HRR_PENDING)
s->hello_retry...SL_HRR_PENDINGDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 155 times by 1 test
Evaluated by:
  • libssl.so.1.1
19-155
1010 handmd = ssl_handshake_md(s);
executed 19 times by 1 test: handmd = ssl_handshake_md(s);
Executed by:
  • libssl.so.1.1
19
1011-
1012 if (s->session->ext.ticklen != 0) {
s->session->ext.ticklen != 0Description
TRUEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-143
1013 /* Get the digest associated with the ciphersuite in the session */-
1014 if (s->session->cipher == NULL) {
s->session->ci...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-143
1015 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1016 ERR_R_INTERNAL_ERROR);-
1017 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1018 }-
1019 mdres = ssl_md(s->session->cipher->algorithm2);-
1020 if (mdres == NULL) {
mdres == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 143 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-143
1021 /*-
1022 * Don't recognize this cipher so we can't use the session.-
1023 * Ignore it-
1024 */-
1025 goto dopsksess;
never executed: goto dopsksess;
0
1026 }-
1027-
1028 if (s->hello_retry_request == SSL_HRR_PENDING && mdres != handmd) {
s->hello_retry...SL_HRR_PENDINGDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 130 times by 1 test
Evaluated by:
  • libssl.so.1.1
mdres != handmdDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-130
1029 /*-
1030 * Selected ciphersuite hash does not match the hash for the session-
1031 * so we can't use it.-
1032 */-
1033 goto dopsksess;
executed 1 time by 1 test: goto dopsksess;
Executed by:
  • libssl.so.1.1
1
1034 }-
1035-
1036 /*-
1037 * Technically the C standard just says time() returns a time_t and says-
1038 * nothing about the encoding of that type. In practice most-
1039 * implementations follow POSIX which holds it as an integral type in-
1040 * seconds since epoch. We've already made the assumption that we can do-
1041 * this in multiple places in the code, so portability shouldn't be an-
1042 * issue.-
1043 */-
1044 now = (uint32_t)time(NULL);-
1045 agesec = now - (uint32_t)s->session->time;-
1046 /*-
1047 * We calculate the age in seconds but the server may work in ms. Due to-
1048 * rounding errors we could overestimate the age by up to 1s. It is-
1049 * better to underestimate it. Otherwise, if the RTT is very short, when-
1050 * the server calculates the age reported by the client it could be-
1051 * bigger than the age calculated on the server - which should never-
1052 * happen.-
1053 */-
1054 if (agesec > 0)
agesec > 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 132 times by 1 test
Evaluated by:
  • libssl.so.1.1
10-132
1055 agesec--;
executed 10 times by 1 test: agesec--;
Executed by:
  • libssl.so.1.1
10
1056-
1057 if (s->session->ext.tick_lifetime_hint < agesec) {
s->session->ex..._hint < agesecDescription
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1058 /* Ticket is too old. Ignore it. */-
1059 goto dopsksess;
never executed: goto dopsksess;
0
1060 }-
1061-
1062 /*-
1063 * Calculate age in ms. We're just doing it to nearest second. Should be-
1064 * good enough.-
1065 */-
1066 agems = agesec * (uint32_t)1000;-
1067-
1068 if (agesec != 0 && agems / (uint32_t)1000 != agesec) {
agesec != 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 138 times by 1 test
Evaluated by:
  • libssl.so.1.1
agems / (uint3...1000 != agesecDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-138
1069 /*-
1070 * Overflow. Shouldn't happen unless this is a *really* old session.-
1071 * If so we just ignore it.-
1072 */-
1073 goto dopsksess;
never executed: goto dopsksess;
0
1074 }-
1075-
1076 /*-
1077 * Obfuscate the age. Overflow here is fine, this addition is supposed-
1078 * to be mod 2^32.-
1079 */-
1080 agems += s->session->ext.tick_age_add;-
1081-
1082 reshashsize = EVP_MD_size(mdres);-
1083 dores = 1;-
1084 }
executed 142 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
142
1085-
1086 dopsksess:
code before this statement executed 173 times by 1 test: dopsksess:
Executed by:
  • libssl.so.1.1
173
1087 if (!dores && s->psksession == NULL)
!doresDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->psksession == ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-142
1088 return EXT_RETURN_NOT_SENT;
executed 1 time by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
1
1089-
1090 if (s->psksession != NULL) {
s->psksession != ((void *)0)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
32-141
1091 mdpsk = ssl_md(s->psksession->cipher->algorithm2);-
1092 if (mdpsk == NULL) {
mdpsk == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1093 /*-
1094 * Don't recognize this cipher so we can't use the session.-
1095 * If this happens it's an application bug.-
1096 */-
1097 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1098 SSL_R_BAD_PSK);-
1099 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1100 }-
1101-
1102 if (s->hello_retry_request == SSL_HRR_PENDING && mdpsk != handmd) {
s->hello_retry...SL_HRR_PENDINGDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libssl.so.1.1
mdpsk != handmdDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-26
1103 /*-
1104 * Selected ciphersuite hash does not match the hash for the PSK-
1105 * session. This is an application bug.-
1106 */-
1107 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1108 SSL_R_BAD_PSK);-
1109 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1110 }-
1111-
1112 pskhashsize = EVP_MD_size(mdpsk);-
1113 }
executed 32 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
32
1114-
1115 /* Create the extension, but skip over the binder for now */-
1116 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk)
!WPACKET_put_b...pkt), (41), 2)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1117 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1118 || !WPACKET_start_sub_packet_u16(pkt)) {
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1119 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1120 ERR_R_INTERNAL_ERROR);-
1121 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1122 }-
1123-
1124 if (dores) {
doresDescription
TRUEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-142
1125 if (!WPACKET_sub_memcpy_u16(pkt, s->session->ext.tick,
!WPACKET_sub_m...t.ticklen), 2)Description
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1126 s->session->ext.ticklen)-
1127 || !WPACKET_put_bytes_u32(pkt, agems)) {
!WPACKET_put_b...), (agems), 4)Description
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1128 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1129 ERR_R_INTERNAL_ERROR);-
1130 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1131 }-
1132 }
executed 142 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
142
1133-
1134 if (s->psksession != NULL) {
s->psksession != ((void *)0)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
32-141
1135 if (!WPACKET_sub_memcpy_u16(pkt, s->psksession_id,
!WPACKET_sub_m...on_id_len), 2)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1136 s->psksession_id_len)-
1137 || !WPACKET_put_bytes_u32(pkt, 0)) {
!WPACKET_put_b...(pkt), (0), 4)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1138 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1139 ERR_R_INTERNAL_ERROR);-
1140 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1141 }-
1142 }
executed 32 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
32
1143-
1144 if (!WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1145 || !WPACKET_get_total_written(pkt, &binderoffset)
!WPACKET_get_t...&binderoffset)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1146 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1147 || (dores
doresDescription
TRUEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-142
1148 && !WPACKET_sub_allocate_bytes_u8(pkt, reshashsize, &resbinder))
!WPACKET_sub_a...resbinder), 1)Description
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1149 || (s->psksession != NULL
s->psksession != ((void *)0)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
32-141
1150 && !WPACKET_sub_allocate_bytes_u8(pkt, pskhashsize, &pskbinder))
!WPACKET_sub_a...pskbinder), 1)Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1151 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1152 || !WPACKET_close(pkt)
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1153 || !WPACKET_get_total_written(pkt, &msglen)
!WPACKET_get_t...(pkt, &msglen)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1154 /*-
1155 * We need to fill in all the sub-packet lengths now so we can-
1156 * calculate the HMAC of the message up to the binders-
1157 */-
1158 || !WPACKET_fill_lengths(pkt)) {
!WPACKET_fill_lengths(pkt)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
1159 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CTOS_PSK,-
1160 ERR_R_INTERNAL_ERROR);-
1161 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1162 }-
1163-
1164 msgstart = WPACKET_get_curr(pkt) - msglen;-
1165-
1166 if (dores
doresDescription
TRUEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-142
1167 && tls_psk_do_binder(s, mdres, msgstart, binderoffset, NULL,
tls_psk_do_bin...on, 1, 0) != 1Description
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1168 resbinder, s->session, 1, 0) != 1) {
tls_psk_do_bin...on, 1, 0) != 1Description
TRUEnever evaluated
FALSEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-142
1169 /* SSLfatal() already called */-
1170 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1171 }-
1172-
1173 if (s->psksession != NULL
s->psksession != ((void *)0)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
32-141
1174 && tls_psk_do_binder(s, mdpsk, msgstart, binderoffset, NULL,
tls_psk_do_bin...on, 1, 1) != 1Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1175 pskbinder, s->psksession, 1, 1) != 1) {
tls_psk_do_bin...on, 1, 1) != 1Description
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-32
1176 /* SSLfatal() already called */-
1177 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1178 }-
1179-
1180 if (dores)
doresDescription
TRUEevaluated 142 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
31-142
1181 s->session->ext.tick_identity = 0;
executed 142 times by 1 test: s->session->ext.tick_identity = 0;
Executed by:
  • libssl.so.1.1
142
1182 if (s->psksession != NULL)
s->psksession != ((void *)0)Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
32-141
1183 s->psksession->ext.tick_identity = (dores ? 1 : 0);
executed 32 times by 1 test: s->psksession->ext.tick_identity = (dores ? 1 : 0);
Executed by:
  • libssl.so.1.1
doresDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 31 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-32
1184-
1185 return EXT_RETURN_SENT;
executed 173 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
173
1186#else-
1187 return EXT_RETURN_NOT_SENT;-
1188#endif-
1189}-
1190-
1191EXT_RETURN tls_construct_ctos_post_handshake_auth(SSL *s, WPACKET *pkt,-
1192 unsigned int context,-
1193 X509 *x, size_t chainidx)-
1194{-
1195#ifndef OPENSSL_NO_TLS1_3-
1196 if (!s->pha_enabled)
!s->pha_enabledDescription
TRUEevaluated 3880 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
38-3880
1197 return EXT_RETURN_NOT_SENT;
executed 3880 times by 1 test: return EXT_RETURN_NOT_SENT;
Executed by:
  • libssl.so.1.1
3880
1198-
1199 /* construct extension - 0 length, no contents */-
1200 if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_post_handshake_auth)
!WPACKET_put_b...pkt), (49), 2)Description
TRUEnever evaluated
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-38
1201 || !WPACKET_start_sub_packet_u16(pkt)
!WPACKET_start...en__((pkt), 2)Description
TRUEnever evaluated
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-38
1202 || !WPACKET_close(pkt)) {
!WPACKET_close(pkt)Description
TRUEnever evaluated
FALSEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-38
1203 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
1204 SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH,-
1205 ERR_R_INTERNAL_ERROR);-
1206 return EXT_RETURN_FAIL;
never executed: return EXT_RETURN_FAIL;
0
1207 }-
1208-
1209 s->post_handshake_auth = SSL_PHA_EXT_SENT;-
1210-
1211 return EXT_RETURN_SENT;
executed 38 times by 1 test: return EXT_RETURN_SENT;
Executed by:
  • libssl.so.1.1
38
1212#else-
1213 return EXT_RETURN_NOT_SENT;-
1214#endif-
1215}-
1216-
1217-
1218/*-
1219 * Parse the server's renegotiation binding and abort if it's not right-
1220 */-
1221int tls_parse_stoc_renegotiate(SSL *s, PACKET *pkt, unsigned int context,-
1222 X509 *x, size_t chainidx)-
1223{-
1224 size_t expected_len = s->s3->previous_client_finished_len-
1225 + s->s3->previous_server_finished_len;-
1226 size_t ilen;-
1227 const unsigned char *data;-
1228-
1229 /* Check for logic errors */-
1230 if (!ossl_assert(expected_len == 0
!((expected_le...en != 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 2484 times by 1 test
Evaluated by:
  • libssl.so.1.1
expected_len == 0Description
TRUEevaluated 2462 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->s3->previou...ished_len != 0Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-2484
1231 || s->s3->previous_client_finished_len != 0)-
1232 || !ossl_assert(expected_len == 0
!((expected_le...en != 0) != 0)Description
TRUEnever evaluated
FALSEevaluated 2484 times by 1 test
Evaluated by:
  • libssl.so.1.1
expected_len == 0Description
TRUEevaluated 2462 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->s3->previou...ished_len != 0Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-2484
1233 || s->s3->previous_server_finished_len != 0)) {-
1234 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1235 ERR_R_INTERNAL_ERROR);-
1236 return 0;
never executed: return 0;
0
1237 }-
1238-
1239 /* Parse the length byte */-
1240 if (!PACKET_get_1_len(pkt, &ilen)) {
!PACKET_get_1_len(pkt, &ilen)Description
TRUEnever evaluated
FALSEevaluated 2484 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2484
1241 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1242 SSL_R_RENEGOTIATION_ENCODING_ERR);-
1243 return 0;
never executed: return 0;
0
1244 }-
1245-
1246 /* Consistency check */-
1247 if (PACKET_remaining(pkt) != ilen) {
PACKET_remaining(pkt) != ilenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2483 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-2483
1248 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1249 SSL_R_RENEGOTIATION_ENCODING_ERR);-
1250 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1251 }-
1252-
1253 /* Check that the extension matches */-
1254 if (ilen != expected_len) {
ilen != expected_lenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-2482
1255 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1256 SSL_R_RENEGOTIATION_MISMATCH);-
1257 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1258 }-
1259-
1260 if (!PACKET_get_bytes(pkt, &data, s->s3->previous_client_finished_len)
!PACKET_get_by..._finished_len)Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1261 || memcmp(data, s->s3->previous_client_finished,
memcmp(data, s...shed_len) != 0Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1262 s->s3->previous_client_finished_len) != 0) {
memcmp(data, s...shed_len) != 0Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1263 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1264 SSL_R_RENEGOTIATION_MISMATCH);-
1265 return 0;
never executed: return 0;
0
1266 }-
1267-
1268 if (!PACKET_get_bytes(pkt, &data, s->s3->previous_server_finished_len)
!PACKET_get_by..._finished_len)Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1269 || memcmp(data, s->s3->previous_server_finished,
memcmp(data, s...shed_len) != 0Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1270 s->s3->previous_server_finished_len) != 0) {
memcmp(data, s...shed_len) != 0Description
TRUEnever evaluated
FALSEevaluated 2482 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2482
1271 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_RENEGOTIATE,-
1272 SSL_R_RENEGOTIATION_MISMATCH);-
1273 return 0;
never executed: return 0;
0
1274 }-
1275 s->s3->send_connection_binding = 1;-
1276-
1277 return 1;
executed 2482 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
2482
1278}-
1279-
1280/* Parse the server's max fragment len extension packet */-
1281int tls_parse_stoc_maxfragmentlen(SSL *s, PACKET *pkt, unsigned int context,-
1282 X509 *x, size_t chainidx)-
1283{-
1284 unsigned int value;-
1285-
1286 if (PACKET_remaining(pkt) != 1 || !PACKET_get_1(pkt, &value)) {
PACKET_remaining(pkt) != 1Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
!PACKET_get_1(pkt, &value)Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
1287 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN,-
1288 SSL_R_BAD_EXTENSION);-
1289 return 0;
never executed: return 0;
0
1290 }-
1291-
1292 /* |value| should contains a valid max-fragment-length code. */-
1293 if (!IS_MAX_FRAGMENT_LENGTH_EXT_VALID(value)) {
((value) >= 1)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
((value) <= 4)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-6
1294 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,-
1295 SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN,-
1296 SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH);-
1297 return 0;
never executed: return 0;
0
1298 }-
1299-
1300 /* Must be the same value as client-configured one who was sent to server */-
1301 /*--
1302 * RFC 6066: if a client receives a maximum fragment length negotiation-
1303 * response that differs from the length it requested, ...-
1304 * It must abort with SSL_AD_ILLEGAL_PARAMETER alert-
1305 */-
1306 if (value != s->ext.max_fragment_len_mode) {
value != s->ex...gment_len_modeDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
1307 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,-
1308 SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN,-
1309 SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH);-
1310 return 0;
never executed: return 0;
0
1311 }-
1312-
1313 /*-
1314 * Maximum Fragment Length Negotiation succeeded.-
1315 * The negotiated Maximum Fragment Length is binding now.-
1316 */-
1317 s->session->ext.max_fragment_len_mode = value;-
1318-
1319 return 1;
executed 6 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
6
1320}-
1321-
1322int tls_parse_stoc_server_name(SSL *s, PACKET *pkt, unsigned int context,-
1323 X509 *x, size_t chainidx)-
1324{-
1325 if (s->ext.hostname == NULL) {
s->ext.hostname == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 680 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-680
1326 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_SERVER_NAME,-
1327 ERR_R_INTERNAL_ERROR);-
1328 return 0;
never executed: return 0;
0
1329 }-
1330-
1331 if (PACKET_remaining(pkt) > 0) {
PACKET_remaining(pkt) > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-678
1332 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_SERVER_NAME,-
1333 SSL_R_BAD_EXTENSION);-
1334 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1335 }-
1336-
1337 if (!s->hit) {
!s->hitDescription
TRUEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-678
1338 if (s->session->ext.hostname != NULL) {
s->session->ex...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-678
1339 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_SERVER_NAME,-
1340 ERR_R_INTERNAL_ERROR);-
1341 return 0;
never executed: return 0;
0
1342 }-
1343 s->session->ext.hostname = OPENSSL_strdup(s->ext.hostname);-
1344 if (s->session->ext.hostname == NULL) {
s->session->ex...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 678 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-678
1345 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_SERVER_NAME,-
1346 ERR_R_INTERNAL_ERROR);-
1347 return 0;
never executed: return 0;
0
1348 }-
1349 }
executed 678 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
678
1350-
1351 return 1;
executed 678 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
678
1352}-
1353-
1354#ifndef OPENSSL_NO_EC-
1355int tls_parse_stoc_ec_pt_formats(SSL *s, PACKET *pkt, unsigned int context,-
1356 X509 *x, size_t chainidx)-
1357{-
1358 size_t ecpointformats_len;-
1359 PACKET ecptformatlist;-
1360-
1361 if (!PACKET_as_length_prefixed_1(pkt, &ecptformatlist)) {
!PACKET_as_len...cptformatlist)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1050 times by 1 test
Evaluated by:
  • libssl.so.1.1
3-1050
1362 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS,-
1363 SSL_R_BAD_EXTENSION);-
1364 return 0;
executed 3 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
3
1365 }-
1366 if (!s->hit) {
!s->hitDescription
TRUEevaluated 1037 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 13 times by 1 test
Evaluated by:
  • libssl.so.1.1
13-1037
1367 ecpointformats_len = PACKET_remaining(&ecptformatlist);-
1368 if (ecpointformats_len == 0) {
ecpointformats_len == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1036 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-1036
1369 SSLfatal(s, SSL_AD_DECODE_ERROR,-
1370 SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS, SSL_R_BAD_LENGTH);-
1371 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1372 }-
1373-
1374 s->session->ext.ecpointformats_len = 0;-
1375 OPENSSL_free(s->session->ext.ecpointformats);-
1376 s->session->ext.ecpointformats = OPENSSL_malloc(ecpointformats_len);-
1377 if (s->session->ext.ecpointformats == NULL) {
s->session->ex...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1036 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1036
1378 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
1379 SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);-
1380 return 0;
never executed: return 0;
0
1381 }-
1382-
1383 s->session->ext.ecpointformats_len = ecpointformats_len;-
1384-
1385 if (!PACKET_copy_bytes(&ecptformatlist,
!PACKET_copy_b...ntformats_len)Description
TRUEnever evaluated
FALSEevaluated 1036 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1036
1386 s->session->ext.ecpointformats,
!PACKET_copy_b...ntformats_len)Description
TRUEnever evaluated
FALSEevaluated 1036 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1036
1387 ecpointformats_len)) {
!PACKET_copy_b...ntformats_len)Description
TRUEnever evaluated
FALSEevaluated 1036 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1036
1388 SSLfatal(s, SSL_AD_INTERNAL_ERROR,-
1389 SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS, ERR_R_INTERNAL_ERROR);-
1390 return 0;
never executed: return 0;
0
1391 }-
1392 }
executed 1036 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1036
1393-
1394 return 1;
executed 1049 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1049
1395}-
1396#endif-
1397-
1398int tls_parse_stoc_session_ticket(SSL *s, PACKET *pkt, unsigned int context,-
1399 X509 *x, size_t chainidx)-
1400{-
1401 if (s->ext.session_ticket_cb != NULL &&
s->ext.session...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1607 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1607
1402 !s->ext.session_ticket_cb(s, PACKET_data(pkt),
!s->ext.sessio...ticket_cb_arg)Description
TRUEnever evaluated
FALSEnever evaluated
0
1403 PACKET_remaining(pkt),
!s->ext.sessio...ticket_cb_arg)Description
TRUEnever evaluated
FALSEnever evaluated
0
1404 s->ext.session_ticket_cb_arg)) {
!s->ext.sessio...ticket_cb_arg)Description
TRUEnever evaluated
FALSEnever evaluated
0
1405 SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE,-
1406 SSL_F_TLS_PARSE_STOC_SESSION_TICKET, SSL_R_BAD_EXTENSION);-
1407 return 0;
never executed: return 0;
0
1408 }-
1409-
1410 if (!tls_use_ticket(s)) {
!tls_use_ticket(s)Description
TRUEnever evaluated
FALSEevaluated 1607 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1607
1411 SSLfatal(s, SSL_AD_UNSUPPORTED_EXTENSION,-
1412 SSL_F_TLS_PARSE_STOC_SESSION_TICKET, SSL_R_BAD_EXTENSION);-
1413 return 0;
never executed: return 0;
0
1414 }-
1415 if (PACKET_remaining(pkt) > 0) {
PACKET_remaining(pkt) > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1606 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-1606
1416 SSLfatal(s, SSL_AD_DECODE_ERROR,-
1417 SSL_F_TLS_PARSE_STOC_SESSION_TICKET, SSL_R_BAD_EXTENSION);-
1418 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1419 }-
1420-
1421 s->ext.ticket_expected = 1;-
1422-
1423 return 1;
executed 1606 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1606
1424}-
1425-
1426#ifndef OPENSSL_NO_OCSP-
1427int tls_parse_stoc_status_request(SSL *s, PACKET *pkt, unsigned int context,-
1428 X509 *x, size_t chainidx)-
1429{-
1430 if (context == SSL_EXT_TLS1_3_CERTIFICATE_REQUEST) {
context == 0x4000Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
1431 /* We ignore this if the server sends a CertificateRequest */-
1432 /* TODO(TLS1.3): Add support for this */-
1433 return 1;
never executed: return 1;
0
1434 }-
1435-
1436 /*-
1437 * MUST only be sent if we've requested a status-
1438 * request message. In TLS <= 1.2 it must also be empty.-
1439 */-
1440 if (s->ext.status_type != TLSEXT_STATUSTYPE_ocsp) {
s->ext.status_type != 1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-12
1441 SSLfatal(s, SSL_AD_UNSUPPORTED_EXTENSION,-
1442 SSL_F_TLS_PARSE_STOC_STATUS_REQUEST, SSL_R_BAD_EXTENSION);-
1443 return 0;
never executed: return 0;
0
1444 }-
1445 if (!SSL_IS_TLS13(s) && PACKET_remaining(pkt) > 0) {
!(s->method->s...c_flags & 0x8)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->method->version >= 0x0304Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->method->v...ion != 0x10000Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
PACKET_remaining(pkt) > 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-10
1446 SSLfatal(s, SSL_AD_DECODE_ERROR,-
1447 SSL_F_TLS_PARSE_STOC_STATUS_REQUEST, SSL_R_BAD_EXTENSION);-
1448 return 0;
never executed: return 0;
0
1449 }-
1450-
1451 if (SSL_IS_TLS13(s)) {
!(s->method->s...c_flags & 0x8)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->method->version >= 0x0304Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
(s)->method->v...ion != 0x10000Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-10
1452 /* We only know how to handle this if it's for the first Certificate in-
1453 * the chain. We ignore any other responses.-
1454 */-
1455 if (chainidx != 0)
chainidx != 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-6
1456 return 1;
never executed: return 1;
0
1457-
1458 /* SSLfatal() already called */-
1459 return tls_process_cert_status_body(s, pkt);
executed 6 times by 1 test: return tls_process_cert_status_body(s, pkt);
Executed by:
  • libssl.so.1.1
6
1460 }-
1461-
1462 /* Set flag to expect CertificateStatus message */-
1463 s->ext.status_expected = 1;-
1464-
1465 return 1;
executed 6 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
6
1466}-
1467#endif-
1468-
1469-
1470#ifndef OPENSSL_NO_CT-
1471int tls_parse_stoc_sct(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1472 size_t chainidx)-
1473{-
1474 if (context == SSL_EXT_TLS1_3_CERTIFICATE_REQUEST) {
context == 0x4000Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7
1475 /* We ignore this if the server sends it in a CertificateRequest */-
1476 /* TODO(TLS1.3): Add support for this */-
1477 return 1;
never executed: return 1;
0
1478 }-
1479-
1480 /*-
1481 * Only take it if we asked for it - i.e if there is no CT validation-
1482 * callback set, then a custom extension MAY be processing it, so we-
1483 * need to let control continue to flow to that.-
1484 */-
1485 if (s->ct_validation_callback != NULL) {
s->ct_validati...!= ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-5
1486 size_t size = PACKET_remaining(pkt);-
1487-
1488 /* Simply copy it off for later processing */-
1489 OPENSSL_free(s->ext.scts);-
1490 s->ext.scts = NULL;-
1491-
1492 s->ext.scts_len = (uint16_t)size;-
1493 if (size > 0) {
size > 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-2
1494 s->ext.scts = OPENSSL_malloc(size);-
1495 if (s->ext.scts == NULL
s->ext.scts == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2
1496 || !PACKET_copy_bytes(pkt, s->ext.scts, size)) {
!PACKET_copy_b...xt.scts, size)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2
1497 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_SCT,-
1498 ERR_R_INTERNAL_ERROR);-
1499 return 0;
never executed: return 0;
0
1500 }-
1501 }
executed 2 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2
1502 } else {
executed 2 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2
1503 ENDPOINT role = (context & SSL_EXT_TLS1_2_SERVER_HELLO) != 0
(context & 0x0100) != 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-5
1504 ? ENDPOINT_CLIENT : ENDPOINT_BOTH;-
1505-
1506 /*-
1507 * If we didn't ask for it then there must be a custom extension,-
1508 * otherwise this is unsolicited.-
1509 */-
1510 if (custom_ext_find(&s->cert->custext, role,
custom_ext_fin...== ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3
1511 TLSEXT_TYPE_signed_certificate_timestamp,
custom_ext_fin...== ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3
1512 NULL) == NULL) {
custom_ext_fin...== ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-3
1513 SSLfatal(s, TLS1_AD_UNSUPPORTED_EXTENSION, SSL_F_TLS_PARSE_STOC_SCT,-
1514 SSL_R_BAD_EXTENSION);-
1515 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1516 }-
1517-
1518 if (!custom_ext_parse(s, context,
!custom_ext_pa..., x, chainidx)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
1519 TLSEXT_TYPE_signed_certificate_timestamp,
!custom_ext_pa..., x, chainidx)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
1520 PACKET_data(pkt), PACKET_remaining(pkt),
!custom_ext_pa..., x, chainidx)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
1521 x, chainidx)) {
!custom_ext_pa..., x, chainidx)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-3
1522 /* SSLfatal already called */-
1523 return 0;
never executed: return 0;
0
1524 }-
1525 }
executed 3 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
3
1526-
1527 return 1;
executed 5 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
5
1528}-
1529#endif-
1530-
1531-
1532#ifndef OPENSSL_NO_NEXTPROTONEG-
1533/*-
1534 * ssl_next_proto_validate validates a Next Protocol Negotiation block. No-
1535 * elements of zero length are allowed and the set of elements must exactly-
1536 * fill the length of the block. Returns 1 on success or 0 on failure.-
1537 */-
1538static int ssl_next_proto_validate(SSL *s, PACKET *pkt)-
1539{-
1540 PACKET tmp_protocol;-
1541-
1542 while (PACKET_remaining(pkt)) {
PACKET_remaining(pkt)Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
21-29
1543 if (!PACKET_get_length_prefixed_1(pkt, &tmp_protocol)
!PACKET_get_le...&tmp_protocol)Description
TRUEnever evaluated
FALSEevaluated 29 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-29
1544 || PACKET_remaining(&tmp_protocol) == 0) {
PACKET_remaini...protocol) == 0Description
TRUEnever evaluated
FALSEevaluated 29 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-29
1545 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL_NEXT_PROTO_VALIDATE,-
1546 SSL_R_BAD_EXTENSION);-
1547 return 0;
never executed: return 0;
0
1548 }-
1549 }
executed 29 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
29
1550-
1551 return 1;
executed 21 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
21
1552}-
1553-
1554int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1555 size_t chainidx)-
1556{-
1557 unsigned char *selected;-
1558 unsigned char selected_len;-
1559 PACKET tmppkt;-
1560-
1561 /* Check if we are in a renegotiation. If so ignore this extension */-
1562 if (!SSL_IS_FIRST_HANDSHAKE(s))
(s)->s3->tmp.f...sh_md_len == 0Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
(s)->s3->tmp.p...sh_md_len == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-21
1563 return 1;
never executed: return 1;
0
1564-
1565 /* We must have requested it. */-
1566 if (s->ctx->ext.npn_select_cb == NULL) {
s->ctx->ext.np...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1567 SSLfatal(s, SSL_AD_UNSUPPORTED_EXTENSION, SSL_F_TLS_PARSE_STOC_NPN,-
1568 SSL_R_BAD_EXTENSION);-
1569 return 0;
never executed: return 0;
0
1570 }-
1571-
1572 /* The data must be valid */-
1573 tmppkt = *pkt;-
1574 if (!ssl_next_proto_validate(s, &tmppkt)) {
!ssl_next_prot...te(s, &tmppkt)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1575 /* SSLfatal() already called */-
1576 return 0;
never executed: return 0;
0
1577 }-
1578 if (s->ctx->ext.npn_select_cb(s, &selected, &selected_len,
s->ctx->ext.np...t_cb_arg) != 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1579 PACKET_data(pkt),
s->ctx->ext.np...t_cb_arg) != 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1580 PACKET_remaining(pkt),
s->ctx->ext.np...t_cb_arg) != 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1581 s->ctx->ext.npn_select_cb_arg) !=
s->ctx->ext.np...t_cb_arg) != 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1582 SSL_TLSEXT_ERR_OK) {
s->ctx->ext.np...t_cb_arg) != 0Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1583 SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_F_TLS_PARSE_STOC_NPN,-
1584 SSL_R_BAD_EXTENSION);-
1585 return 0;
never executed: return 0;
0
1586 }-
1587-
1588 /*-
1589 * Could be non-NULL if server has sent multiple NPN extensions in-
1590 * a single Serverhello-
1591 */-
1592 OPENSSL_free(s->ext.npn);-
1593 s->ext.npn = OPENSSL_malloc(selected_len);-
1594 if (s->ext.npn == NULL) {
s->ext.npn == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-21
1595 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_NPN,-
1596 ERR_R_INTERNAL_ERROR);-
1597 return 0;
never executed: return 0;
0
1598 }-
1599-
1600 memcpy(s->ext.npn, selected, selected_len);-
1601 s->ext.npn_len = selected_len;-
1602 s->s3->npn_seen = 1;-
1603-
1604 return 1;
executed 21 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
21
1605}-
1606#endif-
1607-
1608int tls_parse_stoc_alpn(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1609 size_t chainidx)-
1610{-
1611 size_t len;-
1612-
1613 /* We must have requested it. */-
1614 if (!s->s3->alpn_sent) {
!s->s3->alpn_sentDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1615 SSLfatal(s, SSL_AD_UNSUPPORTED_EXTENSION, SSL_F_TLS_PARSE_STOC_ALPN,-
1616 SSL_R_BAD_EXTENSION);-
1617 return 0;
never executed: return 0;
0
1618 }-
1619 /*--
1620 * The extension data consists of:-
1621 * uint16 list_length-
1622 * uint8 proto_length;-
1623 * uint8 proto[proto_length];-
1624 */-
1625 if (!PACKET_get_net_2_len(pkt, &len)
!PACKET_get_ne...len(pkt, &len)Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1626 || PACKET_remaining(pkt) != len || !PACKET_get_1_len(pkt, &len)
PACKET_remaining(pkt) != lenDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
!PACKET_get_1_len(pkt, &len)Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1627 || PACKET_remaining(pkt) != len) {
PACKET_remaining(pkt) != lenDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1628 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_ALPN,-
1629 SSL_R_BAD_EXTENSION);-
1630 return 0;
never executed: return 0;
0
1631 }-
1632 OPENSSL_free(s->s3->alpn_selected);-
1633 s->s3->alpn_selected = OPENSSL_malloc(len);-
1634 if (s->s3->alpn_selected == NULL) {
s->s3->alpn_se...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1635 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_ALPN,-
1636 ERR_R_INTERNAL_ERROR);-
1637 return 0;
never executed: return 0;
0
1638 }-
1639 if (!PACKET_copy_bytes(pkt, s->s3->alpn_selected, len)) {
!PACKET_copy_b...selected, len)Description
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-22
1640 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_ALPN,-
1641 SSL_R_BAD_EXTENSION);-
1642 return 0;
never executed: return 0;
0
1643 }-
1644 s->s3->alpn_selected_len = len;-
1645-
1646 if (s->session->ext.alpn_selected == NULL
s->session->ex...== ((void *)0)Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libssl.so.1.1
5-17
1647 || s->session->ext.alpn_selected_len != len
s->session->ex...ted_len != lenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-4
1648 || memcmp(s->session->ext.alpn_selected, s->s3->alpn_selected, len)
memcmp(s->sess...ted, len) != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2
1649 != 0) {
memcmp(s->sess...ted, len) != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2
1650 /* ALPN not consistent with the old session so cannot use early_data */-
1651 s->ext.early_data_ok = 0;-
1652 }
executed 20 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
20
1653 if (!s->hit) {
!s->hitDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 6 times by 1 test
Evaluated by:
  • libssl.so.1.1
6-16
1654 /*-
1655 * This is a new session and so alpn_selected should have been-
1656 * initialised to NULL. We should update it with the selected ALPN.-
1657 */-
1658 if (!ossl_assert(s->session->ext.alpn_selected == NULL)) {
!((s->session-...d *)0) ) != 0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-16
1659 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_ALPN,-
1660 ERR_R_INTERNAL_ERROR);-
1661 return 0;
never executed: return 0;
0
1662 }-
1663 s->session->ext.alpn_selected =-
1664 OPENSSL_memdup(s->s3->alpn_selected, s->s3->alpn_selected_len);-
1665 if (s->session->ext.alpn_selected == NULL) {
s->session->ex...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-16
1666 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_ALPN,-
1667 ERR_R_INTERNAL_ERROR);-
1668 return 0;
never executed: return 0;
0
1669 }-
1670 s->session->ext.alpn_selected_len = s->s3->alpn_selected_len;-
1671 }
executed 16 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
16
1672-
1673 return 1;
executed 22 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
22
1674}-
1675-
1676#ifndef OPENSSL_NO_SRTP-
1677int tls_parse_stoc_use_srtp(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1678 size_t chainidx)-
1679{-
1680 unsigned int id, ct, mki;-
1681 int i;-
1682 STACK_OF(SRTP_PROTECTION_PROFILE) *clnt;-
1683 SRTP_PROTECTION_PROFILE *prof;-
1684-
1685 if (!PACKET_get_net_2(pkt, &ct) || ct != 2
!PACKET_get_net_2(pkt, &ct)Description
TRUEnever evaluated
FALSEnever evaluated
ct != 2Description
TRUEnever evaluated
FALSEnever evaluated
0
1686 || !PACKET_get_net_2(pkt, &id)
!PACKET_get_net_2(pkt, &id)Description
TRUEnever evaluated
FALSEnever evaluated
0
1687 || !PACKET_get_1(pkt, &mki)
!PACKET_get_1(pkt, &mki)Description
TRUEnever evaluated
FALSEnever evaluated
0
1688 || PACKET_remaining(pkt) != 0) {
PACKET_remaining(pkt) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1689 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_USE_SRTP,-
1690 SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);-
1691 return 0;
never executed: return 0;
0
1692 }-
1693-
1694 if (mki != 0) {
mki != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1695 /* Must be no MKI, since we never offer one */-
1696 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_USE_SRTP,-
1697 SSL_R_BAD_SRTP_MKI_VALUE);-
1698 return 0;
never executed: return 0;
0
1699 }-
1700-
1701 /* Throw an error if the server gave us an unsolicited extension */-
1702 clnt = SSL_get_srtp_profiles(s);-
1703 if (clnt == NULL) {
clnt == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1704 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_USE_SRTP,-
1705 SSL_R_NO_SRTP_PROFILES);-
1706 return 0;
never executed: return 0;
0
1707 }-
1708-
1709 /*-
1710 * Check to see if the server gave us something we support (and-
1711 * presumably offered)-
1712 */-
1713 for (i = 0; i < sk_SRTP_PROTECTION_PROFILE_num(clnt); i++) {
i < sk_SRTP_PR...FILE_num(clnt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1714 prof = sk_SRTP_PROTECTION_PROFILE_value(clnt, i);-
1715-
1716 if (prof->id == id) {
prof->id == idDescription
TRUEnever evaluated
FALSEnever evaluated
0
1717 s->srtp_profile = prof;-
1718 return 1;
never executed: return 1;
0
1719 }-
1720 }
never executed: end of block
0
1721-
1722 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_USE_SRTP,-
1723 SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);-
1724 return 0;
never executed: return 0;
0
1725}-
1726#endif-
1727-
1728int tls_parse_stoc_etm(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1729 size_t chainidx)-
1730{-
1731 /* Ignore if inappropriate ciphersuite */-
1732 if (!(s->options & SSL_OP_NO_ENCRYPT_THEN_MAC)
!(s->options & 0x00080000U)Description
TRUEevaluated 673 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-673
1733 && s->s3->tmp.new_cipher->algorithm_mac != SSL_AEAD
s->s3->tmp.new...!= 0x00000040UDescription
TRUEevaluated 664 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libssl.so.1.1
9-664
1734 && s->s3->tmp.new_cipher->algorithm_enc != SSL_RC4)
s->s3->tmp.new...!= 0x00000004UDescription
TRUEevaluated 664 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
0-664
1735 s->ext.use_etm = 1;
executed 664 times by 1 test: s->ext.use_etm = 1;
Executed by:
  • libssl.so.1.1
664
1736-
1737 return 1;
executed 673 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
673
1738}-
1739-
1740int tls_parse_stoc_ems(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1741 size_t chainidx)-
1742{-
1743 s->s3->flags |= TLS1_FLAGS_RECEIVED_EXTMS;-
1744 if (!s->hit)
!s->hitDescription
TRUEevaluated 1805 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 63 times by 1 test
Evaluated by:
  • libssl.so.1.1
63-1805
1745 s->session->flags |= SSL_SESS_FLAG_EXTMS;
executed 1805 times by 1 test: s->session->flags |= 0x1;
Executed by:
  • libssl.so.1.1
1805
1746-
1747 return 1;
executed 1868 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1868
1748}-
1749-
1750int tls_parse_stoc_supported_versions(SSL *s, PACKET *pkt, unsigned int context,-
1751 X509 *x, size_t chainidx)-
1752{-
1753 unsigned int version;-
1754-
1755 if (!PACKET_get_net_2(pkt, &version)
!PACKET_get_ne...pkt, &version)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 672 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-672
1756 || PACKET_remaining(pkt) != 0) {
PACKET_remaining(pkt) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 671 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-671
1757 SSLfatal(s, SSL_AD_DECODE_ERROR,-
1758 SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS,-
1759 SSL_R_LENGTH_MISMATCH);-
1760 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1761 }-
1762-
1763 /*-
1764 * The only protocol version we support which is valid in this extension in-
1765 * a ServerHello is TLSv1.3 therefore we shouldn't be getting anything else.-
1766 */-
1767 if (version != TLS1_3_VERSION) {
version != 0x0304Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 670 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-670
1768 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,-
1769 SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS,-
1770 SSL_R_BAD_PROTOCOL_VERSION_NUMBER);-
1771 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1772 }-
1773-
1774 /* We ignore this extension for HRRs except to sanity check it */-
1775 if (context == SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST)
context == 0x0800Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 632 times by 1 test
Evaluated by:
  • libssl.so.1.1
38-632
1776 return 1;
executed 38 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
38
1777-
1778 /* We just set it here. We validate it in ssl_choose_client_version */-
1779 s->version = version;-
1780-
1781 return 1;
executed 632 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
632
1782}-
1783-
1784int tls_parse_stoc_key_share(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1785 size_t chainidx)-
1786{-
1787#ifndef OPENSSL_NO_TLS1_3-
1788 unsigned int group_id;-
1789 PACKET encoded_pt;-
1790 EVP_PKEY *ckey = s->s3->tmp.pkey, *skey = NULL;-
1791-
1792 /* Sanity check */-
1793 if (ckey == NULL || s->s3->peer_tmp != NULL) {
ckey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1170 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->s3->peer_tmp != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1170 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1170
1794 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1795 ERR_R_INTERNAL_ERROR);-
1796 return 0;
never executed: return 0;
0
1797 }-
1798-
1799 if (!PACKET_get_net_2(pkt, &group_id)) {
!PACKET_get_ne...kt, &group_id)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1168 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-1168
1800 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1801 SSL_R_LENGTH_MISMATCH);-
1802 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1803 }-
1804-
1805 if ((context & SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST) != 0) {
(context & 0x0800) != 0Description
TRUEevaluated 544 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 624 times by 1 test
Evaluated by:
  • libssl.so.1.1
544-624
1806 const uint16_t *pgroups = NULL;-
1807 size_t i, num_groups;-
1808-
1809 if (PACKET_remaining(pkt) != 0) {
PACKET_remaining(pkt) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 543 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-543
1810 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1811 SSL_R_LENGTH_MISMATCH);-
1812 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1813 }-
1814-
1815 /*-
1816 * It is an error if the HelloRetryRequest wants a key_share that we-
1817 * already sent in the first ClientHello-
1818 */-
1819 if (group_id == s->s3->group_id) {
group_id == s->s3->group_idDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 541 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-541
1820 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,-
1821 SSL_F_TLS_PARSE_STOC_KEY_SHARE, SSL_R_BAD_KEY_SHARE);-
1822 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1823 }-
1824-
1825 /* Validate the selected group is one we support */-
1826 tls1_get_supported_groups(s, &pgroups, &num_groups);-
1827 for (i = 0; i < num_groups; i++) {
i < num_groupsDescription
TRUEevaluated 1626 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-1626
1828 if (group_id == pgroups[i])
group_id == pgroups[i]Description
TRUEevaluated 539 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1087 times by 1 test
Evaluated by:
  • libssl.so.1.1
539-1087
1829 break;
executed 539 times by 1 test: break;
Executed by:
  • libssl.so.1.1
539
1830 }
executed 1087 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1087
1831 if (i >= num_groups
i >= num_groupsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 539 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-539
1832 || !tls_curve_allowed(s, group_id, SSL_SECOP_CURVE_SUPPORTED)) {
!tls_curve_all... | (2 << 16)))Description
TRUEnever evaluated
FALSEevaluated 539 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-539
1833 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER,-
1834 SSL_F_TLS_PARSE_STOC_KEY_SHARE, SSL_R_BAD_KEY_SHARE);-
1835 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1836 }-
1837-
1838 s->s3->group_id = group_id;-
1839 EVP_PKEY_free(s->s3->tmp.pkey);-
1840 s->s3->tmp.pkey = NULL;-
1841 return 1;
executed 539 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
539
1842 }-
1843-
1844 if (group_id != s->s3->group_id) {
group_id != s->s3->group_idDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 622 times by 1 test
Evaluated by:
  • libssl.so.1.1
2-622
1845 /*-
1846 * This isn't for the group that we sent in the original-
1847 * key_share!-
1848 */-
1849 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1850 SSL_R_BAD_KEY_SHARE);-
1851 return 0;
executed 2 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
2
1852 }-
1853-
1854 if (!PACKET_as_length_prefixed_2(pkt, &encoded_pt)
!PACKET_as_len..., &encoded_pt)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 618 times by 1 test
Evaluated by:
  • libssl.so.1.1
4-618
1855 || PACKET_remaining(&encoded_pt) == 0) {
PACKET_remaini...coded_pt) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 617 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-617
1856 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1857 SSL_R_LENGTH_MISMATCH);-
1858 return 0;
executed 5 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
5
1859 }-
1860-
1861 skey = ssl_generate_pkey(ckey);-
1862 if (skey == NULL) {
skey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 617 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-617
1863 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1864 ERR_R_MALLOC_FAILURE);-
1865 return 0;
never executed: return 0;
0
1866 }-
1867 if (!EVP_PKEY_set1_tls_encodedpoint(skey, PACKET_data(&encoded_pt),
!EVP_PKEY_set1...(&encoded_pt))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 616 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-616
1868 PACKET_remaining(&encoded_pt))) {
!EVP_PKEY_set1...(&encoded_pt))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 616 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-616
1869 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_KEY_SHARE,-
1870 SSL_R_BAD_ECPOINT);-
1871 EVP_PKEY_free(skey);-
1872 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1873 }-
1874-
1875 if (ssl_derive(s, ckey, skey, 1) == 0) {
ssl_derive(s, ... skey, 1) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 615 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-615
1876 /* SSLfatal() already called */-
1877 EVP_PKEY_free(skey);-
1878 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1879 }-
1880 s->s3->peer_tmp = skey;-
1881#endif-
1882-
1883 return 1;
executed 615 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
615
1884}-
1885-
1886int tls_parse_stoc_cookie(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1887 size_t chainidx)-
1888{-
1889 PACKET cookie;-
1890-
1891 if (!PACKET_as_length_prefixed_2(pkt, &cookie)
!PACKET_as_len...(pkt, &cookie)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
3-141
1892 || !PACKET_memdup(&cookie, &s->ext.tls13_cookie,
!PACKET_memdup...13_cookie_len)Description
TRUEnever evaluated
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-141
1893 &s->ext.tls13_cookie_len)) {
!PACKET_memdup...13_cookie_len)Description
TRUEnever evaluated
FALSEevaluated 141 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-141
1894 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_COOKIE,-
1895 SSL_R_LENGTH_MISMATCH);-
1896 return 0;
executed 3 times by 1 test: return 0;
Executed by:
  • libssl.so.1.1
3
1897 }-
1898-
1899 return 1;
executed 141 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
141
1900}-
1901-
1902int tls_parse_stoc_early_data(SSL *s, PACKET *pkt, unsigned int context,-
1903 X509 *x, size_t chainidx)-
1904{-
1905 if (context == SSL_EXT_TLS1_3_NEW_SESSION_TICKET) {
context == 0x2000Description
TRUEevaluated 132 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 19 times by 1 test
Evaluated by:
  • libssl.so.1.1
19-132
1906 unsigned long max_early_data;-
1907-
1908 if (!PACKET_get_net_4(pkt, &max_early_data)
!PACKET_get_ne...ax_early_data)Description
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-132
1909 || PACKET_remaining(pkt) != 0) {
PACKET_remaining(pkt) != 0Description
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-132
1910 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_EARLY_DATA,-
1911 SSL_R_INVALID_MAX_EARLY_DATA);-
1912 return 0;
never executed: return 0;
0
1913 }-
1914-
1915 s->session->ext.max_early_data = max_early_data;-
1916-
1917 return 1;
executed 132 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
132
1918 }-
1919-
1920 if (PACKET_remaining(pkt) != 0) {
PACKET_remaining(pkt) != 0Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-19
1921 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_EARLY_DATA,-
1922 SSL_R_BAD_EXTENSION);-
1923 return 0;
never executed: return 0;
0
1924 }-
1925-
1926 if (!s->ext.early_data_ok
!s->ext.early_data_okDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
1-18
1927 || !s->hit
!s->hitDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-18
1928 || s->session->ext.tick_identity != 0) {
s->session->ex..._identity != 0Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-18
1929 /*-
1930 * If we get here then we didn't send early data, or we didn't resume-
1931 * using the first identity, or the SNI/ALPN is not consistent so the-
1932 * server should not be accepting it.-
1933 */-
1934 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_EARLY_DATA,-
1935 SSL_R_BAD_EXTENSION);-
1936 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libssl.so.1.1
1
1937 }-
1938-
1939 s->ext.early_data = SSL_EARLY_DATA_ACCEPTED;-
1940-
1941 return 1;
executed 18 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
18
1942}-
1943-
1944int tls_parse_stoc_psk(SSL *s, PACKET *pkt, unsigned int context, X509 *x,-
1945 size_t chainidx)-
1946{-
1947#ifndef OPENSSL_NO_TLS1_3-
1948 unsigned int identity;-
1949-
1950 if (!PACKET_get_net_2(pkt, &identity) || PACKET_remaining(pkt) != 0) {
!PACKET_get_ne...kt, &identity)Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • libssl.so.1.1
PACKET_remaining(pkt) != 0Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-107
1951 SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PARSE_STOC_PSK,-
1952 SSL_R_LENGTH_MISMATCH);-
1953 return 0;
never executed: return 0;
0
1954 }-
1955-
1956 if (s->session->ext.tick_identity == (int)identity) {
s->session->ex... (int)identityDescription
TRUEevaluated 89 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
18-89
1957 s->hit = 1;-
1958 SSL_SESSION_free(s->psksession);-
1959 s->psksession = NULL;-
1960 return 1;
executed 89 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
89
1961 }-
1962-
1963 if (s->psksession == NULL
s->psksession == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-18
1964 || s->psksession->ext.tick_identity != (int)identity) {
s->psksession-... (int)identityDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-18
1965 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PARSE_STOC_PSK,-
1966 SSL_R_BAD_PSK_IDENTITY);-
1967 return 0;
never executed: return 0;
0
1968 }-
1969-
1970 /*-
1971 * If we used the external PSK for sending early_data then s->early_secret-
1972 * is already set up, so don't overwrite it. Otherwise we copy the-
1973 * early_secret across that we generated earlier.-
1974 */-
1975 if ((s->early_data_state != SSL_EARLY_DATA_WRITE_RETRY
s->early_data_...TA_WRITE_RETRYDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libssl.so.1.1
1-17
1976 && s->early_data_state != SSL_EARLY_DATA_FINISHED_WRITING)
s->early_data_...NISHED_WRITINGDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 7 times by 1 test
Evaluated by:
  • libssl.so.1.1
7-10
1977 || s->session->ext.max_early_data > 0
s->session->ex...early_data > 0Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-8
1978 || s->psksession->ext.max_early_data == 0)
s->psksession-...arly_data == 0Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-8
1979 memcpy(s->early_secret, s->psksession->early_secret, EVP_MAX_MD_SIZE);
executed 10 times by 1 test: memcpy(s->early_secret, s->psksession->early_secret, 64);
Executed by:
  • libssl.so.1.1
10
1980-
1981 SSL_SESSION_free(s->session);-
1982 s->session = s->psksession;-
1983 s->psksession = NULL;-
1984 s->hit = 1;-
1985#endif-
1986-
1987 return 1;
executed 18 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
18
1988}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2