OpenCoverage

ssl3_buffer.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/record/ssl3_buffer.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2void SSL3_BUFFER_set_data(SSL3_BUFFER *b, const unsigned char *d, size_t n)-
3{-
4 if (d !=
d != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
5 ((void *)0)
d != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
6 )-
7 memcpy(b->buf, d, n);
never executed: memcpy(b->buf, d, n);
0
8 b->left = n;-
9 b->offset = 0;-
10}
never executed: end of block
0
11-
12-
13-
14-
15-
16void SSL3_BUFFER_clear(SSL3_BUFFER *b)-
17{-
18 b->offset = 0;-
19 b->left = 0;-
20}
executed 16269 times by 2 tests: end of block
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
16269
21-
22void SSL3_BUFFER_release(SSL3_BUFFER *b)-
23{-
24 CRYPTO_free(b->buf, __FILE__, 33);-
25 b->buf = -
26 ((void *)0)-
27 ;-
28}
executed 14 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
14
29-
30int ssl3_setup_read_buffer(SSL *s)-
31{-
32 unsigned char *p;-
33 size_t len, align = 0, headerlen;-
34 SSL3_BUFFER *b;-
35-
36 b = (&(&s->rlayer)->rbuf);-
37-
38 if ((
(s->method->ss...c_flags & 0x8)Description
TRUEevaluated 400 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9048 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->method->ssl3_enc->enc_flags & 0x8)
(s->method->ss...c_flags & 0x8)Description
TRUEevaluated 400 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9048 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
400-9048
39 headerlen = 13;
executed 400 times by 1 test: headerlen = 13;
Executed by:
  • libssl.so.1.1
400
40 else-
41 headerlen = 5;
executed 9048 times by 1 test: headerlen = 5;
Executed by:
  • libssl.so.1.1
9048
42-
43-
44 align = (-5) & (8 - 1);-
45-
46-
47 if (b->buf ==
b->buf == ((void *)0)Description
TRUEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1466 times by 1 test
Evaluated by:
  • libssl.so.1.1
1466-7982
48 ((void *)0)
b->buf == ((void *)0)Description
TRUEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1466 times by 1 test
Evaluated by:
  • libssl.so.1.1
1466-7982
49 ) {-
50 len = 16384-
51 + (256 + 64) + headerlen + align;-
52-
53 if (ssl_allow_compression(s)
ssl_allow_compression(s)Description
TRUEnever evaluated
FALSEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-7982
54 len += 1024;
never executed: len += 1024;
0
55-
56 if (b->default_len > len
b->default_len > lenDescription
TRUEnever evaluated
FALSEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-7982
57 len = b->default_len;
never executed: len = b->default_len;
0
58 if ((
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
p = CRYPTO_malloc(len, __FILE__, 63)) ==
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7982
59 ((void *)0)
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 7982 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-7982
60 ) {-
61-
62-
63-
64-
65-
66 ossl_statem_fatal((s), (-1), (156), ((1|64)),-
67 __FILE__-
68 ,-
69 70-
70 )-
71 ;-
72 return
never executed: return 0;
0;
never executed: return 0;
0
73 }-
74 b->buf = p;-
75 b->len = len;-
76 }
executed 7982 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
7982
77-
78 ((&s->rlayer)->packet = (&(b->buf[0])));-
79 return
executed 9448 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 9448 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
9448
80}-
81-
82int ssl3_setup_write_buffer(SSL *s, size_t numwpipes, size_t len)-
83{-
84 unsigned char *p;-
85 size_t align = 0, headerlen;-
86 SSL3_BUFFER *wb;-
87 size_t currpipe;-
88-
89 s->rlayer.numwpipes = numwpipes;-
90-
91 if (len == 0
len == 0Description
TRUEevaluated 9354 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
) {
0-9354
92 if ((
(s->method->ss...c_flags & 0x8)Description
TRUEevaluated 400 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 8954 times by 1 test
Evaluated by:
  • libssl.so.1.1
s->method->ssl3_enc->enc_flags & 0x8)
(s->method->ss...c_flags & 0x8)Description
TRUEevaluated 400 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 8954 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
400-8954
93 headerlen = 13 + 1;
executed 400 times by 1 test: headerlen = 13 + 1;
Executed by:
  • libssl.so.1.1
400
94 else-
95 headerlen = 5;
executed 8954 times by 1 test: headerlen = 5;
Executed by:
  • libssl.so.1.1
8954
96-
97-
98 align = (-5) & (8 - 1);-
99-
100-
101 len = ssl_get_max_send_fragment(s)-
102 + (16 + 64) + headerlen + align;-
103-
104 if (ssl_allow_compression(s)
ssl_allow_compression(s)Description
TRUEnever evaluated
FALSEevaluated 9354 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-9354
105 len += 1024;
never executed: len += 1024;
0
106-
107 if (!(s->options & 0x00000800U)
!(s->options & 0x00000800U)Description
TRUEevaluated 9354 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEnever evaluated
)
0-9354
108 len += headerlen + align + (16 + 64);
executed 9354 times by 1 test: len += headerlen + align + (16 + 64);
Executed by:
  • libssl.so.1.1
9354
109 }
executed 9354 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
9354
110-
111 wb = ((&s->rlayer)->wbuf);-
112 for (currpipe = 0; currpipe < numwpipes
currpipe < numwpipesDescription
TRUEevaluated 9354 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 9354 times by 1 test
Evaluated by:
  • libssl.so.1.1
; currpipe++) {
9354
113 SSL3_BUFFER *thiswb = &wb[currpipe];-
114-
115 if (thiswb->buf !=
thiswb->buf != ((void *)0)Description
TRUEevaluated 1323 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 8031 times by 1 test
Evaluated by:
  • libssl.so.1.1
1323-8031
116 ((void *)0)
thiswb->buf != ((void *)0)Description
TRUEevaluated 1323 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 8031 times by 1 test
Evaluated by:
  • libssl.so.1.1
1323-8031
117 && thiswb->len != len
thiswb->len != lenDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1309 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
14-1309
118 CRYPTO_free(thiswb->buf, __FILE__, 115);-
119 thiswb->buf = -
120 ((void *)0)-
121 ;-
122 }
executed 14 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
14
123-
124 if (thiswb->buf ==
thiswb->buf == ((void *)0)Description
TRUEevaluated 8045 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1309 times by 1 test
Evaluated by:
  • libssl.so.1.1
1309-8045
125 ((void *)0)
thiswb->buf == ((void *)0)Description
TRUEevaluated 8045 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1309 times by 1 test
Evaluated by:
  • libssl.so.1.1
1309-8045
126 ) {-
127 p = CRYPTO_malloc(len, __FILE__, 120);-
128 if (p ==
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8045 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-8045
129 ((void *)0)
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8045 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-8045
130 ) {-
131 s->rlayer.numwpipes = currpipe;-
132-
133-
134-
135-
136-
137 ossl_statem_fatal((s), (-1), (291), ((1|64)),-
138 __FILE__-
139 ,-
140 129-
141 )-
142 ;-
143 return
never executed: return 0;
0;
never executed: return 0;
0
144 }-
145 memset(thiswb, 0, sizeof(SSL3_BUFFER));-
146 thiswb->buf = p;-
147 thiswb->len = len;-
148 }
executed 8045 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
8045
149 }
executed 9354 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
9354
150-
151 return
executed 9354 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 9354 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
9354
152}-
153-
154int ssl3_setup_buffers(SSL *s)-
155{-
156 if (!ssl3_setup_read_buffer(s)
!ssl3_setup_read_buffer(s)Description
TRUEnever evaluated
FALSEevaluated 9342 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-9342
157-
158 return
never executed: return 0;
0;
never executed: return 0;
0
159 }-
160 if (!ssl3_setup_write_buffer(s, 1, 0)
!ssl3_setup_wr...uffer(s, 1, 0)Description
TRUEnever evaluated
FALSEevaluated 9342 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-9342
161-
162 return
never executed: return 0;
0;
never executed: return 0;
0
163 }-
164 return
executed 9342 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 9342 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
9342
165}-
166-
167int ssl3_release_write_buffer(SSL *s)-
168{-
169 SSL3_BUFFER *wb;-
170 size_t pipes;-
171-
172 pipes = s->rlayer.numwpipes;-
173 while (pipes > 0
pipes > 0Description
TRUEevaluated 8031 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 24238 times by 2 tests
Evaluated by:
  • libssl.so.1.1
  • tls13encryptiontest
) {
8031-24238
174 wb = &((&s->rlayer)->wbuf)[pipes - 1];-
175-
176 CRYPTO_free(wb->buf, __FILE__, 163);-
177 wb->buf = -
178 ((void *)0)-
179 ;-
180 pipes--;-
181 }
executed 8031 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
8031
182 s->rlayer.numwpipes = 0;-
183 return
executed 24238 times by 2 tests: return 1;
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
1;
executed 24238 times by 2 tests: return 1;
Executed by:
  • libssl.so.1.1
  • tls13encryptiontest
24238
184}-
185-
186int ssl3_release_read_buffer(SSL *s)-
187{-
188 SSL3_BUFFER *b;-
189-
190 b = (&(&s->rlayer)->rbuf);-
191 CRYPTO_free(b->buf, __FILE__, 176);-
192 b->buf = -
193 ((void *)0)-
194 ;-
195 return
executed 7966 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
1;
executed 7966 times by 1 test: return 1;
Executed by:
  • libssl.so.1.1
7966
196}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2