OpenCoverage

bs_cbs.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/bs_cbs.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void-
5CBS_init(CBS *cbs, const uint8_t *data, size_t len)-
6{-
7 cbs->data = data;-
8 cbs->initial_len = len;-
9 cbs->len = len;-
10}
executed 5272 times by 10 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • clienttest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
5272
11-
12void-
13CBS_dup(const CBS *cbs, CBS *out)-
14{-
15 CBS_init(out, CBS_data(cbs), CBS_len(cbs));-
16 out->initial_len = cbs->initial_len;-
17}
executed 139 times by 6 tests: end of block
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
139
18-
19static int-
20cbs_get(CBS *cbs, const uint8_t **p, size_t n)-
21{-
22 if (cbs->len < n
cbs->len < nDescription
TRUEevaluated 41 times by 3 tests
Evaluated by:
  • bytestringtest
  • cipher_list
  • tls_ext_alpn
FALSEevaluated 12534 times by 10 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • clienttest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
41-12534
23 return
executed 41 times by 3 tests: return 0;
Executed by:
  • bytestringtest
  • cipher_list
  • tls_ext_alpn
0;
executed 41 times by 3 tests: return 0;
Executed by:
  • bytestringtest
  • cipher_list
  • tls_ext_alpn
41
24-
25 *p = cbs->data;-
26 cbs->data += n;-
27 cbs->len -= n;-
28 return
executed 12534 times by 10 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • clienttest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1;
executed 12534 times by 10 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • clienttest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
12534
29}-
30-
31size_t-
32CBS_offset(const CBS *cbs)-
33{-
34 return
executed 11 times by 1 test: return cbs->initial_len - cbs->len;
Executed by:
  • bytestringtest
cbs->initial_len - cbs->len;
executed 11 times by 1 test: return cbs->initial_len - cbs->len;
Executed by:
  • bytestringtest
11
35}-
36-
37int-
38CBS_skip(CBS *cbs, size_t len)-
39{-
40 const uint8_t *dummy;-
41 return
executed 148 times by 3 tests: return cbs_get(cbs, &dummy, len);
Executed by:
  • asn1test
  • bytestringtest
  • ssltest
cbs_get(cbs, &dummy, len);
executed 148 times by 3 tests: return cbs_get(cbs, &dummy, len);
Executed by:
  • asn1test
  • bytestringtest
  • ssltest
148
42}-
43-
44const uint8_t *-
45CBS_data(const CBS *cbs)-
46{-
47 return
executed 959 times by 7 tests: return cbs->data;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
cbs->data;
executed 959 times by 7 tests: return cbs->data;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
959
48}-
49-
50size_t-
51CBS_len(const CBS *cbs)-
52{-
53 return
executed 5934 times by 8 tests: return cbs->len;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
cbs->len;
executed 5934 times by 8 tests: return cbs->len;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
5934
54}-
55-
56int-
57CBS_stow(const CBS *cbs, uint8_t **out_ptr, size_t *out_len)-
58{-
59 free(*out_ptr);-
60 *out_ptr = -
61 ((void *)0)-
62 ;-
63 *out_len = 0;-
64-
65 if (cbs->len == 0
cbs->len == 0Description
TRUEnever evaluated
FALSEevaluated 132 times by 5 tests
Evaluated by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
0-132
66 return
never executed: return 1;
1;
never executed: return 1;
0
67-
68 if ((*
(*out_ptr = ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 132 times by 5 tests
Evaluated by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
out_ptr = malloc(cbs->len)) ==
(*out_ptr = ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 132 times by 5 tests
Evaluated by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
0-132
69 ((void *)0)
(*out_ptr = ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 132 times by 5 tests
Evaluated by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
0-132
70 )-
71 return
never executed: return 0;
0;
never executed: return 0;
0
72-
73 memcpy(*out_ptr, cbs->data, cbs->len);-
74-
75 *out_len = cbs->len;-
76 return
executed 132 times by 5 tests: return 1;
Executed by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1;
executed 132 times by 5 tests: return 1;
Executed by:
  • asn1test
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
132
77}-
78-
79int-
80CBS_strdup(const CBS *cbs, char **out_ptr)-
81{-
82 free(*out_ptr);-
83 *out_ptr = -
84 (__extension__ (__builtin_constant_p (
__builtin_cons... *)cbs->data )Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • asn1test
  • tlsexttest
  • tlstest
0-6
85 (const char *)cbs->data
__builtin_cons... *)cbs->data )Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • asn1test
  • tlsexttest
  • tlstest
0-6
86 )
__builtin_cons... *)cbs->data )Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • asn1test
  • tlsexttest
  • tlstest
&& ((
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
size_t)(const void *)((
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0-6
87 (const char *)cbs->data
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
88 ) + 1) - (size_t)(const void *)(
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
89 (const char *)cbs->data
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
90 ) == 1)
((size_t)(cons...->data ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
? (((const
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
char *) (
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0
91 (const char *)cbs->data
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
0
92 ))[0] == '\0'
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (
0
93 (const char *)cbs->data-
94 ) + 1; size_t __n = (-
95 cbs->len-
96 ); char *__retval; if (__n < __len
__n < __lenDescription
TRUEnever evaluated
FALSEnever evaluated
) __len = __n + 1;
never executed: __len = __n + 1;
__retval = (char *) malloc (__len); if (__retval != ((void *)0)
__retval != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
) { __retval[__len - 1] = '\0'; __retval = (char *) memcpy (__retval,
0
97 (const char *)cbs->data-
98 , __len - 1); }
never executed: end of block
__retval; })) : __strndup (
0
99 (const char *)cbs->data-
100 , -
101 cbs->len-
102 )))-
103 ;-
104 return
executed 6 times by 3 tests: return (*out_ptr != ((void *)0) );
Executed by:
  • asn1test
  • tlsexttest
  • tlstest
(*out_ptr !=
executed 6 times by 3 tests: return (*out_ptr != ((void *)0) );
Executed by:
  • asn1test
  • tlsexttest
  • tlstest
6
105 ((void *)0)
executed 6 times by 3 tests: return (*out_ptr != ((void *)0) );
Executed by:
  • asn1test
  • tlsexttest
  • tlstest
6
106 );
executed 6 times by 3 tests: return (*out_ptr != ((void *)0) );
Executed by:
  • asn1test
  • tlsexttest
  • tlstest
6
107}-
108-
109int-
110CBS_write_bytes(const CBS *cbs, uint8_t *dst, size_t dst_len, size_t *copied)-
111{-
112 if (dst_len < cbs->len
dst_len < cbs->lenDescription
TRUEnever evaluated
FALSEevaluated 361 times by 5 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tlstest
)
0-361
113 return
never executed: return 0;
0;
never executed: return 0;
0
114-
115 memmove(dst, cbs->data, cbs->len);-
116-
117 if (copied !=
copied != ((void *)0)Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • ssltest
  • tlstest
FALSEevaluated 288 times by 3 tests
Evaluated by:
  • servertest
  • ssltest
  • tlstest
73-288
118 ((void *)0)
copied != ((void *)0)Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • ssltest
  • tlstest
FALSEevaluated 288 times by 3 tests
Evaluated by:
  • servertest
  • ssltest
  • tlstest
73-288
119 )-
120 *
executed 73 times by 4 tests: *copied = cbs->len;
Executed by:
  • asn1test
  • bytestringtest
  • ssltest
  • tlstest
copied = cbs->len;
executed 73 times by 4 tests: *copied = cbs->len;
Executed by:
  • asn1test
  • bytestringtest
  • ssltest
  • tlstest
73
121-
122 return
executed 361 times by 5 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tlstest
1;
executed 361 times by 5 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tlstest
361
123}-
124-
125int-
126CBS_contains_zero_byte(const CBS *cbs)-
127{-
128 return
executed 67 times by 4 tests: return memchr(cbs->data, 0, cbs->len) != ((void *)0) ;
Executed by:
  • asn1test
  • ssltest
  • tlsexttest
  • tlstest
memchr(cbs->data, 0, cbs->len) !=
executed 67 times by 4 tests: return memchr(cbs->data, 0, cbs->len) != ((void *)0) ;
Executed by:
  • asn1test
  • ssltest
  • tlsexttest
  • tlstest
67
129 ((void *)0)
executed 67 times by 4 tests: return memchr(cbs->data, 0, cbs->len) != ((void *)0) ;
Executed by:
  • asn1test
  • ssltest
  • tlsexttest
  • tlstest
67
130 ;
executed 67 times by 4 tests: return memchr(cbs->data, 0, cbs->len) != ((void *)0) ;
Executed by:
  • asn1test
  • ssltest
  • tlsexttest
  • tlstest
67
131}-
132-
133int-
134CBS_mem_equal(const CBS *cbs, const uint8_t *data, size_t len)-
135{-
136 if (len != cbs->len
len != cbs->lenDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tlsexttest
FALSEevaluated 270 times by 4 tests
Evaluated by:
  • bytestringtest
  • ssltest
  • tlsexttest
  • tlstest
)
1-270
137 return
executed 1 time by 1 test: return 0;
Executed by:
  • tlsexttest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tlsexttest
1
138-
139 return
executed 270 times by 4 tests: return timingsafe_memcmp(cbs->data, data, len) == 0;
Executed by:
  • bytestringtest
  • ssltest
  • tlsexttest
  • tlstest
timingsafe_memcmp(cbs->data, data, len) == 0;
executed 270 times by 4 tests: return timingsafe_memcmp(cbs->data, data, len) == 0;
Executed by:
  • bytestringtest
  • ssltest
  • tlsexttest
  • tlstest
270
140}-
141-
142static int-
143cbs_get_u(CBS *cbs, uint32_t *out, size_t len)-
144{-
145 uint32_t result = 0;-
146 size_t i;-
147 const uint8_t *data;-
148-
149 if (len < 1
len < 1Description
TRUEnever evaluated
FALSEevaluated 7138 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
|| len > 4
len > 4Description
TRUEnever evaluated
FALSEevaluated 7138 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
0-7138
150 return
never executed: return 0;
0;
never executed: return 0;
0
151-
152 if (!cbs_get(cbs, &data, len)
!cbs_get(cbs, &data, len)Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • cipher_list
  • tls_ext_alpn
FALSEevaluated 7132 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
6-7132
153 return
executed 6 times by 2 tests: return 0;
Executed by:
  • cipher_list
  • tls_ext_alpn
0;
executed 6 times by 2 tests: return 0;
Executed by:
  • cipher_list
  • tls_ext_alpn
6
154-
155 for (i = 0; i < len
i < lenDescription
TRUEevaluated 14973 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
FALSEevaluated 7132 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
; i++) {
7132-14973
156 result <<= 8;-
157 result |= data[i];-
158 }
executed 14973 times by 9 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
14973
159 *out = result;-
160 return
executed 7132 times by 9 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1;
executed 7132 times by 9 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
7132
161}-
162-
163int-
164CBS_get_u8(CBS *cbs, uint8_t *out)-
165{-
166 const uint8_t *v;-
167-
168 if (!cbs_get(cbs, &v, 1)
!cbs_get(cbs, &v, 1)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 3071 times by 7 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • clienttest
  • servertest
  • ssltest
  • tlsexttest
  • tlstest
)
2-3071
169 return
executed 2 times by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 2 times by 1 test: return 0;
Executed by:
  • bytestringtest
2
170-
171 *out = *v;-
172 return
executed 3071 times by 7 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • clienttest
  • servertest
  • ssltest
  • tlsexttest
  • tlstest
1;
executed 3071 times by 7 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • clienttest
  • servertest
  • ssltest
  • tlsexttest
  • tlstest
3071
173}-
174-
175int-
176CBS_get_u16(CBS *cbs, uint16_t *out)-
177{-
178 uint32_t v;-
179-
180 if (!cbs_get_u(cbs, &v, 2)
!cbs_get_u(cbs, &v, 2)Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • cipher_list
  • tls_ext_alpn
FALSEevaluated 4498 times by 9 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
4-4498
181 return
executed 4 times by 2 tests: return 0;
Executed by:
  • cipher_list
  • tls_ext_alpn
0;
executed 4 times by 2 tests: return 0;
Executed by:
  • cipher_list
  • tls_ext_alpn
4
182-
183 *out = v;-
184 return
executed 4498 times by 9 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1;
executed 4498 times by 9 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • cipher_list
  • cipherstest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
4498
185}-
186-
187int-
188CBS_get_u24(CBS *cbs, uint32_t *out)-
189{-
190 return
executed 874 times by 4 tests: return cbs_get_u(cbs, out, 3);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tlstest
cbs_get_u(cbs, out, 3);
executed 874 times by 4 tests: return cbs_get_u(cbs, out, 3);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tlstest
874
191}-
192-
193int-
194CBS_get_u32(CBS *cbs, uint32_t *out)-
195{-
196 return
executed 60 times by 2 tests: return cbs_get_u(cbs, out, 4);
Executed by:
  • bytestringtest
  • ssltest
cbs_get_u(cbs, out, 4);
executed 60 times by 2 tests: return cbs_get_u(cbs, out, 4);
Executed by:
  • bytestringtest
  • ssltest
60
197}-
198-
199int-
200CBS_get_bytes(CBS *cbs, CBS *out, size_t len)-
201{-
202 const uint8_t *v;-
203-
204 if (!cbs_get(cbs, &v, len)
!cbs_get(cbs, &v, len)Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • bytestringtest
  • tls_ext_alpn
FALSEevaluated 2186 times by 7 tests
Evaluated by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
30-2186
205 return
executed 30 times by 2 tests: return 0;
Executed by:
  • bytestringtest
  • tls_ext_alpn
0;
executed 30 times by 2 tests: return 0;
Executed by:
  • bytestringtest
  • tls_ext_alpn
30
206-
207 CBS_init(out, v, len);-
208 return
executed 2186 times by 7 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1;
executed 2186 times by 7 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
2186
209}-
210-
211static int-
212cbs_get_length_prefixed(CBS *cbs, CBS *out, size_t len_len)-
213{-
214 uint32_t len;-
215-
216 if (!cbs_get_u(cbs, &len, len_len)
!cbs_get_u(cbs, &len, len_len)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tls_ext_alpn
FALSEevaluated 1694 times by 6 tests
Evaluated by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
)
2-1694
217 return
executed 2 times by 1 test: return 0;
Executed by:
  • tls_ext_alpn
0;
executed 2 times by 1 test: return 0;
Executed by:
  • tls_ext_alpn
2
218-
219 return
executed 1694 times by 6 tests: return CBS_get_bytes(cbs, out, len);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
CBS_get_bytes(cbs, out, len);
executed 1694 times by 6 tests: return CBS_get_bytes(cbs, out, len);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1694
220}-
221-
222int-
223CBS_get_u8_length_prefixed(CBS *cbs, CBS *out)-
224{-
225 return
executed 438 times by 6 tests: return cbs_get_length_prefixed(cbs, out, 1);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
cbs_get_length_prefixed(cbs, out, 1);
executed 438 times by 6 tests: return cbs_get_length_prefixed(cbs, out, 1);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
438
226}-
227-
228int-
229CBS_get_u16_length_prefixed(CBS *cbs, CBS *out)-
230{-
231 return
executed 1102 times by 6 tests: return cbs_get_length_prefixed(cbs, out, 2);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
cbs_get_length_prefixed(cbs, out, 2);
executed 1102 times by 6 tests: return cbs_get_length_prefixed(cbs, out, 2);
Executed by:
  • bytestringtest
  • servertest
  • ssltest
  • tls_ext_alpn
  • tlsexttest
  • tlstest
1102
232}-
233-
234int-
235CBS_get_u24_length_prefixed(CBS *cbs, CBS *out)-
236{-
237 return
executed 156 times by 3 tests: return cbs_get_length_prefixed(cbs, out, 3);
Executed by:
  • bytestringtest
  • ssltest
  • tlstest
cbs_get_length_prefixed(cbs, out, 3);
executed 156 times by 3 tests: return cbs_get_length_prefixed(cbs, out, 3);
Executed by:
  • bytestringtest
  • ssltest
  • tlstest
156
238}-
239-
240int-
241CBS_get_any_asn1_element(CBS *cbs, CBS *out, unsigned int *out_tag,-
242 size_t *out_header_len)-
243{-
244 return
executed 70 times by 2 tests: return cbs_get_any_asn1_element_internal(cbs, out, out_tag, out_header_len, 1);
Executed by:
  • asn1test
  • bytestringtest
cbs_get_any_asn1_element_internal(cbs, out, out_tag,
executed 70 times by 2 tests: return cbs_get_any_asn1_element_internal(cbs, out, out_tag, out_header_len, 1);
Executed by:
  • asn1test
  • bytestringtest
70
245 out_header_len, 1);
executed 70 times by 2 tests: return cbs_get_any_asn1_element_internal(cbs, out, out_tag, out_header_len, 1);
Executed by:
  • asn1test
  • bytestringtest
70
246}-
247int-
248cbs_get_any_asn1_element_internal(CBS *cbs, CBS *out, unsigned int *out_tag,-
249 size_t *out_header_len, int strict)-
250{-
251 uint8_t tag, length_byte;-
252 CBS header = *cbs;-
253 CBS throwaway;-
254 size_t len;-
255-
256 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
0-101
257 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
0-101
258 )-
259 out = &throwaway;
never executed: out = &throwaway;
0
260-
261-
262-
263-
264-
265 if (!CBS_get_u8(&header, &tag)
!CBS_get_u8(&header, &tag)Description
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
|| !CBS_get_u8(&header, &length_byte)
!CBS_get_u8(&h... &length_byte)Description
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-101
266 return
never executed: return 0;
0;
never executed: return 0;
0
267-
268-
269 if ((
(tag & 0x1f) == 0x1fDescription
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
tag & 0x1f) == 0x1f
(tag & 0x1f) == 0x1fDescription
TRUEnever evaluated
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-101
270 return
never executed: return 0;
0;
never executed: return 0;
0
271-
272 if (out_tag !=
out_tag != ((void *)0)Description
TRUEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEnever evaluated
0-101
273 ((void *)0)
out_tag != ((void *)0)Description
TRUEevaluated 101 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEnever evaluated
0-101
274 )-
275 *
executed 101 times by 2 tests: *out_tag = tag;
Executed by:
  • asn1test
  • bytestringtest
out_tag = tag;
executed 101 times by 2 tests: *out_tag = tag;
Executed by:
  • asn1test
  • bytestringtest
101
276-
277 if ((
(length_byte & 0x80) == 0Description
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
length_byte & 0x80) == 0
(length_byte & 0x80) == 0Description
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
17-84
278-
279 len = ((size_t) length_byte) + 2;-
280 if (out_header_len !=
out_header_len != ((void *)0)Description
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEnever evaluated
0-84
281 ((void *)0)
out_header_len != ((void *)0)Description
TRUEevaluated 84 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEnever evaluated
0-84
282 )-
283 *
executed 84 times by 2 tests: *out_header_len = 2;
Executed by:
  • asn1test
  • bytestringtest
out_header_len = 2;
executed 84 times by 2 tests: *out_header_len = 2;
Executed by:
  • asn1test
  • bytestringtest
84
284-
285 }
executed 84 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
else {
84
286-
287 const size_t num_bytes = length_byte & 0x7f;-
288 uint32_t len32;-
289-
290-
291 if (num_bytes == 0x7f
num_bytes == 0x7fDescription
TRUEnever evaluated
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-17
292 return
never executed: return 0;
0;
never executed: return 0;
0
293-
294-
295 if (num_bytes == 0
num_bytes == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
6-11
296-
297 if (strict
strictDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 10 times by 1 test
Evaluated by:
  • bytestringtest
)
1-10
298 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
299-
300-
301 if ((
(tag & 0x20) == 0Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • bytestringtest
tag & 0x20) == 0
(tag & 0x20) == 0Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • bytestringtest
)
0-10
302 return
never executed: return 0;
0;
never executed: return 0;
0
303-
304-
305 if (out_header_len !=
out_header_len != ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • bytestringtest
FALSEnever evaluated
0-10
306 ((void *)0)
out_header_len != ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • bytestringtest
FALSEnever evaluated
0-10
307 )-
308 *
executed 10 times by 1 test: *out_header_len = 2;
Executed by:
  • bytestringtest
out_header_len = 2;
executed 10 times by 1 test: *out_header_len = 2;
Executed by:
  • bytestringtest
10
309 return
executed 10 times by 1 test: return CBS_get_bytes(cbs, out, 2);
Executed by:
  • bytestringtest
CBS_get_bytes(cbs, out, 2);
executed 10 times by 1 test: return CBS_get_bytes(cbs, out, 2);
Executed by:
  • bytestringtest
10
310 }-
311-
312-
313 if (num_bytes > 4
num_bytes > 4Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-6
314 return
never executed: return 0;
0;
never executed: return 0;
0
315-
316 if (!cbs_get_u(&header, &len32, num_bytes)
!cbs_get_u(&he...32, num_bytes)Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-6
317 return
never executed: return 0;
0;
never executed: return 0;
0
318-
319-
320 if (len32 < 128
len32 < 128Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
1-5
321-
322 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
323-
324 if ((
(len32 >> ((nu... 1) * 8)) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 4 times by 1 test
Evaluated by:
  • asn1test
len32 >> ((num_bytes - 1) * 8)) == 0
(len32 >> ((nu... 1) * 8)) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 4 times by 1 test
Evaluated by:
  • asn1test
)
1-4
325-
326 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
327-
328 len = len32;-
329 if (len + 2 + num_bytes < len
len + 2 + num_bytes < lenDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • asn1test
)
0-4
330-
331 return
never executed: return 0;
0;
never executed: return 0;
0
332-
333 len += 2 + num_bytes;-
334 if (out_header_len !=
out_header_len != ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • asn1test
FALSEnever evaluated
0-4
335 ((void *)0)
out_header_len != ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • asn1test
FALSEnever evaluated
0-4
336 )-
337 *
executed 4 times by 1 test: *out_header_len = 2 + num_bytes;
Executed by:
  • asn1test
out_header_len = 2 + num_bytes;
executed 4 times by 1 test: *out_header_len = 2 + num_bytes;
Executed by:
  • asn1test
4
338 }
executed 4 times by 1 test: end of block
Executed by:
  • asn1test
4
339-
340 return
executed 88 times by 2 tests: return CBS_get_bytes(cbs, out, len);
Executed by:
  • asn1test
  • bytestringtest
CBS_get_bytes(cbs, out, len);
executed 88 times by 2 tests: return CBS_get_bytes(cbs, out, len);
Executed by:
  • asn1test
  • bytestringtest
88
341}-
342-
343static int-
344cbs_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value, int skip_header)-
345{-
346 size_t header_len;-
347 unsigned int tag;-
348 CBS throwaway;-
349-
350 if (out ==
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
0-70
351 ((void *)0)
out == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
0-70
352 )-
353 out = &throwaway;
never executed: out = &throwaway;
0
354-
355 if (!CBS_get_any_asn1_element(cbs, out, &tag, &header_len)
!CBS_get_any_a..., &header_len)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 65 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
||
5-65
356 tag != tag_value
tag != tag_valueDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 63 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
2-63
357 return
executed 7 times by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 7 times by 1 test: return 0;
Executed by:
  • bytestringtest
7
358-
359 if (skip_header
skip_headerDescription
TRUEevaluated 63 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEnever evaluated
&& !CBS_skip(out, header_len)
!CBS_skip(out, header_len)Description
TRUEnever evaluated
FALSEevaluated 63 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
0-63
360 -
361 ((-
362 0-
363 ) ? (void) (0) : __assert_fail (-
364 "0"-
365 , __FILE__, 351, __PRETTY_FUNCTION__))-
366 ;-
367 return
never executed: return 0;
0;
never executed: return 0;
0
368 }-
369-
370 return
executed 63 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
1;
executed 63 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
63
371}-
372-
373int-
374CBS_get_asn1(CBS *cbs, CBS *out, unsigned int tag_value)-
375{-
376 return
executed 70 times by 2 tests: return cbs_get_asn1(cbs, out, tag_value, 1 );
Executed by:
  • asn1test
  • bytestringtest
cbs_get_asn1(cbs, out, tag_value, 1 );
executed 70 times by 2 tests: return cbs_get_asn1(cbs, out, tag_value, 1 );
Executed by:
  • asn1test
  • bytestringtest
70
377}-
378-
379int-
380CBS_get_asn1_element(CBS *cbs, CBS *out, unsigned int tag_value)-
381{-
382 return
never executed: return cbs_get_asn1(cbs, out, tag_value, 0 );
cbs_get_asn1(cbs, out, tag_value, 0 );
never executed: return cbs_get_asn1(cbs, out, tag_value, 0 );
0
383}-
384-
385int-
386CBS_peek_asn1_tag(const CBS *cbs, unsigned int tag_value)-
387{-
388 if (CBS_len(cbs) < 1
CBS_len(cbs) < 1Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 29 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
14-29
389 return
executed 14 times by 2 tests: return 0;
Executed by:
  • asn1test
  • bytestringtest
0;
executed 14 times by 2 tests: return 0;
Executed by:
  • asn1test
  • bytestringtest
14
390-
391-
392-
393-
394-
395 if ((
(tag_value & 0x1f) == 0x1fDescription
TRUEnever evaluated
FALSEevaluated 29 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
tag_value & 0x1f) == 0x1f
(tag_value & 0x1f) == 0x1fDescription
TRUEnever evaluated
FALSEevaluated 29 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-29
396 return
never executed: return 0;
0;
never executed: return 0;
0
397-
398 return
executed 29 times by 2 tests: return CBS_data(cbs)[0] == tag_value;
Executed by:
  • asn1test
  • bytestringtest
CBS_data(cbs)[0] == tag_value;
executed 29 times by 2 tests: return CBS_data(cbs)[0] == tag_value;
Executed by:
  • asn1test
  • bytestringtest
29
399}-
400-
401-
402int-
403CBS_get_asn1_uint64(CBS *cbs, uint64_t *out)-
404{-
405 CBS bytes;-
406 const uint8_t *data;-
407 size_t i, len;-
408-
409 if (!CBS_get_asn1(cbs, &bytes, (0x00 | 0x00 | 0x2))
!CBS_get_asn1(...| 0x00 | 0x2))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 23 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
1-23
410 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
411-
412 *out = 0;-
413 data = CBS_data(&bytes);-
414 len = CBS_len(&bytes);-
415-
416 if (len == 0
len == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
1-22
417-
418 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
419-
420 if ((
(data[0] & 0x80) != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
data[0] & 0x80) != 0
(data[0] & 0x80) != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
2-20
421-
422 return
executed 2 times by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 2 times by 1 test: return 0;
Executed by:
  • bytestringtest
2
423-
424 if (data[0] == 0
data[0] == 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
&& len > 1
len > 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
&& (
(data[1] & 0x80) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
data[1] & 0x80) == 0
(data[1] & 0x80) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
)
1-15
425-
426 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
427-
428 for (i = 0; i < len
i < lenDescription
TRUEevaluated 56 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
; i++) {
18-56
429 if ((*
(*out >> 56) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 55 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
out >> 56) != 0
(*out >> 56) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 55 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
1-55
430-
431 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
432-
433 *out <<= 8;-
434 *out |= data[i];-
435 }
executed 55 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
55
436-
437 return
executed 18 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
1;
executed 18 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
18
438}-
439-
440int-
441CBS_get_optional_asn1(CBS *cbs, CBS *out, int *out_present, unsigned int tag)-
442{-
443 if (CBS_peek_asn1_tag(cbs, tag)
CBS_peek_asn1_tag(cbs, tag)Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
18-22
444 if (!CBS_get_asn1(cbs, out, tag)
!CBS_get_asn1(cbs, out, tag)Description
TRUEnever evaluated
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-18
445 return
never executed: return 0;
0;
never executed: return 0;
0
446-
447 *out_present = 1;-
448 }
executed 18 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
else {
18
449 *out_present = 0;-
450 }
executed 22 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
22
451 return
executed 40 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
1;
executed 40 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
40
452}-
453-
454int-
455CBS_get_optional_asn1_octet_string(CBS *cbs, CBS *out, int *out_present,-
456 unsigned int tag)-
457{-
458 CBS child;-
459 int present;-
460-
461 if (!CBS_get_optional_asn1(cbs, &child, &present, tag)
!CBS_get_optio...&present, tag)Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-14
462 return
never executed: return 0;
0;
never executed: return 0;
0
463-
464 if (present
presentDescription
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
7
465 if (!CBS_get_asn1(&child, out, (0x00 | 0x00 | 0x4))
!CBS_get_asn1(...| 0x00 | 0x4))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
||
1-6
466 CBS_len(&child) != 0
CBS_len(&child) != 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-6
467 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
468 }
executed 6 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
else {
6
469 CBS_init(out, -
470 ((void *)0)-
471 , 0);-
472 }
executed 7 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
7
473 if (out_present
out_presentDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
)
1-12
474 *
executed 12 times by 2 tests: *out_present = present;
Executed by:
  • asn1test
  • bytestringtest
out_present = present;
executed 12 times by 2 tests: *out_present = present;
Executed by:
  • asn1test
  • bytestringtest
12
475-
476 return
executed 13 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
1;
executed 13 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
13
477}-
478-
479int-
480CBS_get_optional_asn1_uint64(CBS *cbs, uint64_t *out, unsigned int tag,-
481 uint64_t default_value)-
482{-
483 CBS child;-
484 int present;-
485-
486 if (!CBS_get_optional_asn1(cbs, &child, &present, tag)
!CBS_get_optio...&present, tag)Description
TRUEnever evaluated
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-16
487 return
never executed: return 0;
0;
never executed: return 0;
0
488-
489 if (present
presentDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
) {
6-10
490 if (!CBS_get_asn1_uint64(&child, out)
!CBS_get_asn1_...4(&child, out)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
||
1-5
491 CBS_len(&child) != 0
CBS_len(&child) != 0Description
TRUEnever evaluated
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • asn1test
  • bytestringtest
)
0-5
492 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
493 }
executed 5 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
else {
5
494 *out = default_value;-
495 }
executed 10 times by 2 tests: end of block
Executed by:
  • asn1test
  • bytestringtest
10
496 return
executed 15 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
1;
executed 15 times by 2 tests: return 1;
Executed by:
  • asn1test
  • bytestringtest
15
497}-
498-
499int-
500CBS_get_optional_asn1_bool(CBS *cbs, int *out, unsigned int tag,-
501 int default_value)-
502{-
503 CBS child, child2;-
504 int present;-
505-
506 if (!CBS_get_optional_asn1(cbs, &child, &present, tag)
!CBS_get_optio...&present, tag)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • bytestringtest
)
0-4
507 return
never executed: return 0;
0;
never executed: return 0;
0
508-
509 if (present
presentDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
) {
1-3
510 uint8_t boolean;-
511-
512 if (!CBS_get_asn1(&child, &child2, (0x00 | 0x00 | 0x1))
!CBS_get_asn1(...| 0x00 | 0x1))Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
||
0-3
513 CBS_len(&child2) != 1
CBS_len(&child2) != 1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
|| CBS_len(&child) != 0
CBS_len(&child) != 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • bytestringtest
)
0-3
514 return
never executed: return 0;
0;
never executed: return 0;
0
515-
516 boolean = CBS_data(&child2)[0];-
517 if (boolean == 0
boolean == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 2 times by 1 test
Evaluated by:
  • bytestringtest
)
1-2
518 *
executed 1 time by 1 test: *out = 0;
Executed by:
  • bytestringtest
out = 0;
executed 1 time by 1 test: *out = 0;
Executed by:
  • bytestringtest
1
519 else if (boolean == 0xff
boolean == 0xffDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
FALSEevaluated 1 time by 1 test
Evaluated by:
  • bytestringtest
)
1
520 *
executed 1 time by 1 test: *out = 1;
Executed by:
  • bytestringtest
out = 1;
executed 1 time by 1 test: *out = 1;
Executed by:
  • bytestringtest
1
521 else-
522 return
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
0;
executed 1 time by 1 test: return 0;
Executed by:
  • bytestringtest
1
523-
524 } else {-
525 *out = default_value;-
526 }
executed 1 time by 1 test: end of block
Executed by:
  • bytestringtest
1
527 return
executed 3 times by 1 test: return 1;
Executed by:
  • bytestringtest
1;
executed 3 times by 1 test: return 1;
Executed by:
  • bytestringtest
3
528}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2