OpenCoverage

b_sock2.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/bio/b_sock2.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2int BIO_socket(int domain, int socktype, int protocol, int options)-
3{-
4 int sock = -1;-
5-
6 if (BIO_sock_init() != 1
BIO_sock_init() != 1Description
TRUEnever evaluated
FALSEevaluated 371 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-371
7 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
8-
9 sock = socket(domain, socktype, protocol);-
10 if (sock == -1
sock == -1Description
TRUEnever evaluated
FALSEevaluated 371 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-371
11 ERR_put_error(2,(4),(-
12 (*__errno_location ())-
13 ),__FILE__,49);-
14 ERR_put_error(32,(140),(118),__FILE__,50);-
15 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
16 }-
17-
18 return
executed 371 times by 1 test: return sock;
Executed by:
  • libcrypto.so.1.1
sock;
executed 371 times by 1 test: return sock;
Executed by:
  • libcrypto.so.1.1
371
19}-
20int BIO_connect(int sock, const BIO_ADDR *addr, int options)-
21{-
22 const int on = 1;-
23-
24 if (sock == -1
sock == -1Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-193
25 ERR_put_error(32,(138),(135),__FILE__,82);-
26 return
never executed: return 0;
0;
never executed: return 0;
0
27 }-
28-
29 if (!BIO_socket_nbio(sock, (options & 0x08) != 0)
!BIO_socket_nb... & 0x08) != 0)Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-193
30 return
never executed: return 0;
0;
never executed: return 0;
0
31-
32 if (options & 0x04
options & 0x04Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-191
33 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
34 1
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
35 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
36 9
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
37 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
38 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
39 ERR_put_error(2,(14),(-
40 (*__errno_location ())-
41 ),__FILE__,92);-
42 ERR_put_error(32,(138),(137),__FILE__,93);-
43 return
never executed: return 0;
0;
never executed: return 0;
0
44 }-
45 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
46-
47 if (options & 0x10
options & 0x10Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-193
48 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
49 IPPROTO_TCP
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
50 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
51 1
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
52 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
53 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
54 ERR_put_error(2,(14),(-
55 (*__errno_location ())-
56 ),__FILE__,101);-
57 ERR_put_error(32,(138),(138),__FILE__,102);-
58 return
never executed: return 0;
0;
never executed: return 0;
0
59 }-
60 }
never executed: end of block
0
61-
62 if (connect(sock, BIO_ADDR_sockaddr(addr),
connect(sock, ...e(addr)) == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-191
63 BIO_ADDR_sockaddr_size(addr)) == -1
connect(sock, ...e(addr)) == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 191 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
2-191
64 if (!BIO_sock_should_retry(-1)
!BIO_sock_should_retry(-1)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-2
65 ERR_put_error(2,(2),(-
66 (*__errno_location ())-
67 ),__FILE__,110);-
68 ERR_put_error(32,(138),(103),__FILE__,111);-
69 }
never executed: end of block
0
70 return
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 2 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2
71 }-
72 return
executed 191 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 191 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
191
73}-
74int BIO_bind(int sock, const BIO_ADDR *addr, int options)-
75{-
76-
77 int on = 1;-
78-
79-
80 if (sock == -1
sock == -1Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
81 ERR_put_error(32,(147),(135),__FILE__,141);-
82 return
never executed: return 0;
0;
never executed: return 0;
0
83 }-
84-
85-
86-
87-
88-
89-
90 if (options & 0x01
options & 0x01Description
TRUEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-178
91 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
92 1
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
93 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
94 2
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
95 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
96 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
97 ERR_put_error(2,(14),(-
98 (*__errno_location ())-
99 ),__FILE__,153);-
100 ERR_put_error(32,(147),(139),__FILE__,154);-
101 return
never executed: return 0;
0;
never executed: return 0;
0
102 }-
103 }
executed 178 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
178
104-
105-
106 if (bind(sock, BIO_ADDR_sockaddr(addr), BIO_ADDR_sockaddr_size(addr)) != 0
bind(sock, BIO...ze(addr)) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
107 ERR_put_error(2,(6),(-
108 (*__errno_location ())-
109 ),__FILE__,161);-
110 ERR_put_error(32,(147),(117),__FILE__,162);-
111 return
never executed: return 0;
0;
never executed: return 0;
0
112 }-
113-
114 return
executed 178 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 178 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
178
115}-
116int BIO_listen(int sock, const BIO_ADDR *addr, int options)-
117{-
118 int on = 1;-
119 int socktype;-
120 socklen_t socktype_len = sizeof(socktype);-
121-
122 if (sock == -1
sock == -1Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
123 ERR_put_error(32,(139),(135),__FILE__,213);-
124 return
never executed: return 0;
0;
never executed: return 0;
0
125 }-
126-
127 if (getsockopt(sock,
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
128 1
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
129 ,
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
130 3
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
131 ,
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
132 (void *)&socktype, &socktype_len) != 0
getsockopt(soc...type_len) != 0Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
133 || socktype_len != sizeof(socktype)
socktype_len !...zeof(socktype)Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
134 ERR_put_error(2,(15),(-
135 (*__errno_location ())-
136 ),__FILE__,220);-
137 ERR_put_error(32,(139),(134),__FILE__,221);-
138 return
never executed: return 0;
0;
never executed: return 0;
0
139 }-
140-
141 if (!BIO_socket_nbio(sock, (options & 0x08) != 0)
!BIO_socket_nb... & 0x08) != 0)Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-178
142 return
never executed: return 0;
0;
never executed: return 0;
0
143-
144 if (options & 0x04
options & 0x04Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
145 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
146 1
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
147 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
148 9
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
149 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
150 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
151 ERR_put_error(2,(14),(-
152 (*__errno_location ())-
153 ),__FILE__,231);-
154 ERR_put_error(32,(139),(137),__FILE__,232);-
155 return
never executed: return 0;
0;
never executed: return 0;
0
156 }-
157 }
never executed: end of block
0
158-
159 if (options & 0x10
options & 0x10Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
160 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
161 IPPROTO_TCP
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
162 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
163 1
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
164 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
165 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
166 ERR_put_error(2,(14),(-
167 (*__errno_location ())-
168 ),__FILE__,240);-
169 ERR_put_error(32,(139),(138),__FILE__,241);-
170 return
never executed: return 0;
0;
never executed: return 0;
0
171 }-
172 }
never executed: end of block
0
173-
174-
175 if (BIO_ADDR_family(addr) ==
BIO_ADDR_family(addr) == 10Description
TRUEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-177
176 10
BIO_ADDR_family(addr) == 10Description
TRUEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-177
177 ) {-
178-
179-
180-
181-
182 on = options & 0x02
options & 0x02Description
TRUEevaluated 176 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
? 1 : 0;
1-176
183 if (setsockopt(sock,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-177
184 IPPROTO_IPV6
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-177
185 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-177
186 26
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-177
187 ,
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-177
188 (const void *)&on, sizeof(on)) != 0
setsockopt(soc...zeof(on)) != 0Description
TRUEnever evaluated
FALSEevaluated 177 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-177
189 ERR_put_error(2,(14),(-
190 (*__errno_location ())-
191 ),__FILE__,255);-
192 ERR_put_error(32,(139),(136),__FILE__,256);-
193 return
never executed: return 0;
0;
never executed: return 0;
0
194 }-
195 }
executed 177 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
177
196-
197-
198 if (!BIO_bind(sock, addr, options)
!BIO_bind(sock, addr, options)Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-178
199 return
never executed: return 0;
0;
never executed: return 0;
0
200-
201 if (socktype !=
socktype != SOCK_DGRAMDescription
TRUEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-178
202 SOCK_DGRAM
socktype != SOCK_DGRAMDescription
TRUEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-178
203 && listen(sock,
listen(sock, 128 ) == -1Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
204 128
listen(sock, 128 ) == -1Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-178
205 ) == -1
listen(sock, 128 ) == -1Description
TRUEnever evaluated
FALSEevaluated 178 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-178
206 ERR_put_error(2,(7),(-
207 (*__errno_location ())-
208 ),__FILE__,266);-
209 ERR_put_error(32,(139),(119),__FILE__,267);-
210 return
never executed: return 0;
0;
never executed: return 0;
0
211 }-
212-
213 return
executed 178 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 178 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
178
214}-
215int BIO_accept_ex(int accept_sock, BIO_ADDR *addr_, int options)-
216{-
217 socklen_t len;-
218 int accepted_sock;-
219 BIO_ADDR locaddr;-
220 BIO_ADDR *addr = addr_ ==
addr_ == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-193
221 ((void *)0)
addr_ == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-193
222 ? &locaddr : addr_;-
223-
224 len = sizeof(*addr);-
225 accepted_sock = accept(accept_sock,-
226 BIO_ADDR_sockaddr_noconst(addr), &len);-
227 if (accepted_sock == -1
accepted_sock == -1Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-193
228 if (!BIO_sock_should_retry(accepted_sock)
!BIO_sock_shou...accepted_sock)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
229 ERR_put_error(2,(8),(-
230 (*__errno_location ())-
231 ),__FILE__,293);-
232 ERR_put_error(32,(137),(100),__FILE__,294);-
233 }
never executed: end of block
0
234 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
235 }-
236-
237 if (!BIO_socket_nbio(accepted_sock, (options & 0x08) != 0)
!BIO_socket_nb... & 0x08) != 0)Description
TRUEnever evaluated
FALSEevaluated 193 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-193
238 close(accepted_sock);-
239 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
240 }-
241-
242 return
executed 193 times by 1 test: return accepted_sock;
Executed by:
  • libcrypto.so.1.1
accepted_sock;
executed 193 times by 1 test: return accepted_sock;
Executed by:
  • libcrypto.so.1.1
193
243}-
244-
245-
246-
247-
248-
249int BIO_closesocket(int sock)-
250{-
251 if (close(sock) < 0
close(sock) < 0Description
TRUEnever evaluated
FALSEevaluated 562 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-562
252 return
never executed: return 0;
0;
never executed: return 0;
0
253 return
executed 562 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 562 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
562
254}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2