OpenCoverage

ct_sct.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ct/ct_sct.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5SCT *SCT_new(void)-
6{-
7 SCT *sct = CRYPTO_zalloc(sizeof(*sct), __FILE__, 24);-
8-
9 if (sct ==
sct == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14203 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14203
10 ((void *)0)
sct == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 14203 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-14203
11 ) {-
12 ERR_put_error(50,(100),((1|64)),__FILE__,27);-
13 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
14 ((void *)0)
never executed: return ((void *)0) ;
0
15 ;
never executed: return ((void *)0) ;
0
16 }-
17-
18 sct->entry_type = CT_LOG_ENTRY_TYPE_NOT_SET;-
19 sct->version = SCT_VERSION_NOT_SET;-
20 return
executed 14203 times by 1 test: return sct;
Executed by:
  • libcrypto.so.1.1
sct;
executed 14203 times by 1 test: return sct;
Executed by:
  • libcrypto.so.1.1
14203
21}-
22-
23void SCT_free(SCT *sct)-
24{-
25 if (sct ==
sct == ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14203 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-14203
26 ((void *)0)
sct == ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 14203 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-14203
27 )-
28 return;
executed 8 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
8
29-
30 CRYPTO_free(sct->log_id, __FILE__, 41);-
31 CRYPTO_free(sct->ext, __FILE__, 42);-
32 CRYPTO_free(sct->sig, __FILE__, 43);-
33 CRYPTO_free(sct->sct, __FILE__, 44);-
34 CRYPTO_free(sct, __FILE__, 45);-
35}
executed 14203 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
14203
36-
37void SCT_LIST_free(struct stack_st_SCT *a)-
38{-
39 sk_SCT_pop_free(a, SCT_free);-
40}
executed 12972 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
12972
41-
42int SCT_set_version(SCT *sct, sct_version_t version)-
43{-
44 if (version != SCT_VERSION_V1
version != SCT_VERSION_V1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-1
45 ERR_put_error(50,(104),(103),__FILE__,56);-
46 return
never executed: return 0;
0;
never executed: return 0;
0
47 }-
48 sct->version = version;-
49 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
50 return
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1
51}-
52-
53int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type)-
54{-
55 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
56-
57 switch (entry_type) {-
58 case
executed 2721 times by 1 test: case CT_LOG_ENTRY_TYPE_X509:
Executed by:
  • libcrypto.so.1.1
CT_LOG_ENTRY_TYPE_X509:
executed 2721 times by 1 test: case CT_LOG_ENTRY_TYPE_X509:
Executed by:
  • libcrypto.so.1.1
2721
59 case
executed 656 times by 1 test: case CT_LOG_ENTRY_TYPE_PRECERT:
Executed by:
  • libcrypto.so.1.1
CT_LOG_ENTRY_TYPE_PRECERT:
executed 656 times by 1 test: case CT_LOG_ENTRY_TYPE_PRECERT:
Executed by:
  • libcrypto.so.1.1
656
60 sct->entry_type = entry_type;-
61 return
executed 3377 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 3377 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
3377
62 case
never executed: case CT_LOG_ENTRY_TYPE_NOT_SET:
CT_LOG_ENTRY_TYPE_NOT_SET:
never executed: case CT_LOG_ENTRY_TYPE_NOT_SET:
0
63 break;
never executed: break;
0
64 }-
65 ERR_put_error(50,(102),(102),__FILE__,76);-
66 return
never executed: return 0;
0;
never executed: return 0;
0
67}-
68-
69int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len)-
70{-
71 if (sct->version == SCT_VERSION_V1
sct->version == SCT_VERSION_V1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&& log_id_len != 32
log_id_len != 32Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-1
72 ERR_put_error(50,(101),(100),__FILE__,83);-
73 return
never executed: return 0;
0;
never executed: return 0;
0
74 }-
75-
76 CRYPTO_free(sct->log_id, __FILE__, 87);-
77 sct->log_id = log_id;-
78 sct->log_id_len = log_id_len;-
79 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
80 return
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1
81}-
82-
83int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len)-
84{-
85 if (sct->version == SCT_VERSION_V1
sct->version == SCT_VERSION_V1Description
TRUEnever evaluated
FALSEnever evaluated
&& log_id_len != 32
log_id_len != 32Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
86 ERR_put_error(50,(115),(100),__FILE__,97);-
87 return
never executed: return 0;
0;
never executed: return 0;
0
88 }-
89-
90 CRYPTO_free(sct->log_id, __FILE__, 101);-
91 sct->log_id = -
92 ((void *)0)-
93 ;-
94 sct->log_id_len = 0;-
95 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
96-
97 if (log_id !=
log_id != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
98 ((void *)0)
log_id != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
99 && log_id_len > 0
log_id_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
100 sct->log_id = CRYPTO_memdup((log_id), log_id_len, __FILE__, 107);-
101 if (sct->log_id ==
sct->log_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
102 ((void *)0)
sct->log_id == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
103 ) {-
104 ERR_put_error(50,(115),((1|64)),__FILE__,109);-
105 return
never executed: return 0;
0;
never executed: return 0;
0
106 }-
107 sct->log_id_len = log_id_len;-
108 }
never executed: end of block
0
109 return
never executed: return 1;
1;
never executed: return 1;
0
110}-
111-
112-
113void SCT_set_timestamp(SCT *sct, uint64_t timestamp)-
114{-
115 sct->timestamp = timestamp;-
116 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
117}
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
118-
119int SCT_set_signature_nid(SCT *sct, int nid)-
120{-
121 switch (nid) {-
122 case
never executed: case 668:
668:
never executed: case 668:
0
123 sct->hash_alg = 4;-
124 sct->sig_alg = 1;-
125 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
126 return
never executed: return 1;
1;
never executed: return 1;
0
127 case
never executed: case 794:
794:
never executed: case 794:
0
128 sct->hash_alg = 4;-
129 sct->sig_alg = 3;-
130 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
131 return
never executed: return 1;
1;
never executed: return 1;
0
132 default
never executed: default:
:
never executed: default:
0
133 ERR_put_error(50,(103),(101),__FILE__,138);-
134 return
never executed: return 0;
0;
never executed: return 0;
0
135 }-
136}-
137-
138void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len)-
139{-
140 CRYPTO_free(sct->ext, __FILE__, 145);-
141 sct->ext = ext;-
142 sct->ext_len = ext_len;-
143 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
144}
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
145-
146int SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len)-
147{-
148 CRYPTO_free(sct->ext, __FILE__, 153);-
149 sct->ext = -
150 ((void *)0)-
151 ;-
152 sct->ext_len = 0;-
153 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
154-
155 if (ext !=
ext != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
156 ((void *)0)
ext != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
157 && ext_len > 0
ext_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
158 sct->ext = CRYPTO_memdup((ext), ext_len, __FILE__, 159);-
159 if (sct->ext ==
sct->ext == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
160 ((void *)0)
sct->ext == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
161 ) {-
162 ERR_put_error(50,(114),((1|64)),__FILE__,161);-
163 return
never executed: return 0;
0;
never executed: return 0;
0
164 }-
165 sct->ext_len = ext_len;-
166 }
never executed: end of block
0
167 return
never executed: return 1;
1;
never executed: return 1;
0
168}-
169-
170void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len)-
171{-
172 CRYPTO_free(sct->sig, __FILE__, 171);-
173 sct->sig = sig;-
174 sct->sig_len = sig_len;-
175 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
176}
never executed: end of block
0
177-
178int SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len)-
179{-
180 CRYPTO_free(sct->sig, __FILE__, 179);-
181 sct->sig = -
182 ((void *)0)-
183 ;-
184 sct->sig_len = 0;-
185 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
186-
187 if (sig !=
sig != ((void *)0)Description
TRUEevaluated 2362 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2362
188 ((void *)0)
sig != ((void *)0)Description
TRUEevaluated 2362 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2362
189 && sig_len > 0
sig_len > 0Description
TRUEevaluated 761 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1601 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
761-1601
190 sct->sig = CRYPTO_memdup((sig), sig_len, __FILE__, 185);-
191 if (sct->sig ==
sct->sig == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 761 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-761
192 ((void *)0)
sct->sig == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 761 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-761
193 ) {-
194 ERR_put_error(50,(116),((1|64)),__FILE__,187);-
195 return
never executed: return 0;
0;
never executed: return 0;
0
196 }-
197 sct->sig_len = sig_len;-
198 }
executed 761 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
761
199 return
executed 2362 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1;
executed 2362 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
2362
200}-
201-
202sct_version_t SCT_get_version(const SCT *sct)-
203{-
204 return
never executed: return sct->version;
sct->version;
never executed: return sct->version;
0
205}-
206-
207ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct)-
208{-
209 return
executed 9 times by 1 test: return sct->entry_type;
Executed by:
  • libcrypto.so.1.1
sct->entry_type;
executed 9 times by 1 test: return sct->entry_type;
Executed by:
  • libcrypto.so.1.1
9
210}-
211-
212size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id)-
213{-
214 *log_id = sct->log_id;-
215 return
never executed: return sct->log_id_len;
sct->log_id_len;
never executed: return sct->log_id_len;
0
216}-
217-
218uint64_t SCT_get_timestamp(const SCT *sct)-
219{-
220 return
never executed: return sct->timestamp;
sct->timestamp;
never executed: return sct->timestamp;
0
221}-
222-
223int SCT_get_signature_nid(const SCT *sct)-
224{-
225 if (sct->version == SCT_VERSION_V1
sct->version == SCT_VERSION_V1Description
TRUEevaluated 6573 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-6573
226 if (sct->hash_alg == 4
sct->hash_alg == 4Description
TRUEevaluated 6505 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 68 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
68-6505
227 switch (sct->sig_alg) {-
228 case
executed 3152 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
3:
executed 3152 times by 1 test: case 3:
Executed by:
  • libcrypto.so.1.1
3152
229 return
executed 3152 times by 1 test: return 794;
Executed by:
  • libcrypto.so.1.1
794;
executed 3152 times by 1 test: return 794;
Executed by:
  • libcrypto.so.1.1
3152
230 case
executed 3324 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
1:
executed 3324 times by 1 test: case 1:
Executed by:
  • libcrypto.so.1.1
3324
231 return
executed 3324 times by 1 test: return 668;
Executed by:
  • libcrypto.so.1.1
668;
executed 3324 times by 1 test: return 668;
Executed by:
  • libcrypto.so.1.1
3324
232 default
executed 29 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 29 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
29
233 return
executed 29 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 29 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
29
234 }-
235 }-
236 }
executed 68 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
68
237 return
executed 68 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
0;
executed 68 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
68
238}-
239-
240size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext)-
241{-
242 *ext = sct->ext;-
243 return
never executed: return sct->ext_len;
sct->ext_len;
never executed: return sct->ext_len;
0
244}-
245-
246size_t SCT_get0_signature(const SCT *sct, unsigned char **sig)-
247{-
248 *sig = sct->sig;-
249 return
never executed: return sct->sig_len;
sct->sig_len;
never executed: return sct->sig_len;
0
250}-
251-
252int SCT_is_complete(const SCT *sct)-
253{-
254 switch (sct->version) {-
255 case
never executed: case SCT_VERSION_NOT_SET:
SCT_VERSION_NOT_SET:
never executed: case SCT_VERSION_NOT_SET:
0
256 return
never executed: return 0;
0;
never executed: return 0;
0
257 case
executed 1154 times by 1 test: case SCT_VERSION_V1:
Executed by:
  • libcrypto.so.1.1
SCT_VERSION_V1:
executed 1154 times by 1 test: case SCT_VERSION_V1:
Executed by:
  • libcrypto.so.1.1
1154
258 return
executed 1154 times by 1 test: return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);
Executed by:
  • libcrypto.so.1.1
sct->log_id !=
sct->log_id != ((void *)0)Description
TRUEevaluated 1154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
executed 1154 times by 1 test: return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);
Executed by:
  • libcrypto.so.1.1
0-1154
259 ((void *)0)
sct->log_id != ((void *)0)Description
TRUEevaluated 1154 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
executed 1154 times by 1 test: return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);
Executed by:
  • libcrypto.so.1.1
0-1154
260 && SCT_signature_is_complete(sct)
SCT_signature_is_complete(sct)Description
TRUEevaluated 1134 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
;
executed 1154 times by 1 test: return sct->log_id != ((void *)0) && SCT_signature_is_complete(sct);
Executed by:
  • libcrypto.so.1.1
20-1154
261 default
executed 8860 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
:
executed 8860 times by 1 test: default:
Executed by:
  • libcrypto.so.1.1
8860
262 return
executed 8860 times by 1 test: return sct->sct != ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
sct->sct !=
executed 8860 times by 1 test: return sct->sct != ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
8860
263 ((void *)0)
executed 8860 times by 1 test: return sct->sct != ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
8860
264 ;
executed 8860 times by 1 test: return sct->sct != ((void *)0) ;
Executed by:
  • libcrypto.so.1.1
8860
265 }-
266}-
267-
268int SCT_signature_is_complete(const SCT *sct)-
269{-
270 return
executed 1703 times by 1 test: return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;
Executed by:
  • libcrypto.so.1.1
SCT_get_signature_nid(sct) != 0
SCT_get_signat..._nid(sct) != 0Description
TRUEevaluated 1703 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
&&
executed 1703 times by 1 test: return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;
Executed by:
  • libcrypto.so.1.1
0-1703
271 sct->sig !=
sct->sig != ((void *)0)Description
TRUEevaluated 1683 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
executed 1703 times by 1 test: return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;
Executed by:
  • libcrypto.so.1.1
20-1703
272 ((void *)0)
sct->sig != ((void *)0)Description
TRUEevaluated 1683 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
executed 1703 times by 1 test: return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;
Executed by:
  • libcrypto.so.1.1
20-1703
273 && sct->sig_len > 0
sct->sig_len > 0Description
TRUEevaluated 1683 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
;
executed 1703 times by 1 test: return SCT_get_signature_nid(sct) != 0 && sct->sig != ((void *)0) && sct->sig_len > 0;
Executed by:
  • libcrypto.so.1.1
0-1703
274}-
275-
276sct_source_t SCT_get_source(const SCT *sct)-
277{-
278 return
executed 9 times by 1 test: return sct->source;
Executed by:
  • libcrypto.so.1.1
sct->source;
executed 9 times by 1 test: return sct->source;
Executed by:
  • libcrypto.so.1.1
9
279}-
280-
281int SCT_set_source(SCT *sct, sct_source_t source)-
282{-
283 sct->source = source;-
284 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET;-
285 switch (source) {-
286 case
executed 2 times by 1 test: case SCT_SOURCE_TLS_EXTENSION:
Executed by:
  • libcrypto.so.1.1
SCT_SOURCE_TLS_EXTENSION:
executed 2 times by 1 test: case SCT_SOURCE_TLS_EXTENSION:
Executed by:
  • libcrypto.so.1.1
2
287 case
executed 2718 times by 1 test: case SCT_SOURCE_OCSP_STAPLED_RESPONSE:
Executed by:
  • libcrypto.so.1.1
SCT_SOURCE_OCSP_STAPLED_RESPONSE:
executed 2718 times by 1 test: case SCT_SOURCE_OCSP_STAPLED_RESPONSE:
Executed by:
  • libcrypto.so.1.1
2718
288 return
executed 2720 times by 1 test: return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509);
Executed by:
  • libcrypto.so.1.1
SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509);
executed 2720 times by 1 test: return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509);
Executed by:
  • libcrypto.so.1.1
2720
289 case
executed 656 times by 1 test: case SCT_SOURCE_X509V3_EXTENSION:
Executed by:
  • libcrypto.so.1.1
SCT_SOURCE_X509V3_EXTENSION:
executed 656 times by 1 test: case SCT_SOURCE_X509V3_EXTENSION:
Executed by:
  • libcrypto.so.1.1
656
290 return
executed 656 times by 1 test: return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT);
Executed by:
  • libcrypto.so.1.1
SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT);
executed 656 times by 1 test: return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT);
Executed by:
  • libcrypto.so.1.1
656
291 case
never executed: case SCT_SOURCE_UNKNOWN:
SCT_SOURCE_UNKNOWN:
never executed: case SCT_SOURCE_UNKNOWN:
0
292 break;
never executed: break;
0
293 }-
294-
295 return
never executed: return 1;
1;
never executed: return 1;
0
296}-
297-
298sct_validation_status_t SCT_get_validation_status(const SCT *sct)-
299{-
300 return
executed 9 times by 1 test: return sct->validation_status;
Executed by:
  • libcrypto.so.1.1
sct->validation_status;
executed 9 times by 1 test: return sct->validation_status;
Executed by:
  • libcrypto.so.1.1
9
301}-
302-
303int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx)-
304{-
305 int is_sct_valid = -1;-
306 SCT_CTX *sctx = -
307 ((void *)0)-
308 ;-
309 X509_PUBKEY *pub = -
310 ((void *)0)-
311 , *log_pkey = -
312 ((void *)0)-
313 ;-
314 const CTLOG *log;-
315-
316-
317-
318-
319-
320 if (sct->version != SCT_VERSION_V1
sct->version != SCT_VERSION_V1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
) {
0-9
321 sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_VERSION;-
322 return
never executed: return 0;
0;
never executed: return 0;
0
323 }-
324-
325 log = CTLOG_STORE_get0_log_by_id(ctx->log_store,-
326 sct->log_id, sct->log_id_len);-
327-
328-
329 if (log ==
log == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
330 ((void *)0)
log == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
331 ) {-
332 sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_LOG;-
333 return
never executed: return 0;
0;
never executed: return 0;
0
334 }-
335-
336 sctx = SCT_CTX_new();-
337 if (sctx ==
sctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
338 ((void *)0)
sctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
339 )-
340 goto
never executed: goto err;
err;
never executed: goto err;
0
341-
342 if (X509_PUBKEY_set(&log_pkey, CTLOG_get0_public_key(log)) != 1
X509_PUBKEY_se...key(log)) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
343 goto
never executed: goto err;
err;
never executed: goto err;
0
344 if (SCT_CTX_set1_pubkey(sctx, log_pkey) != 1
SCT_CTX_set1_p...log_pkey) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
345 goto
never executed: goto err;
err;
never executed: goto err;
0
346-
347 if (SCT_get_log_entry_type(sct) == CT_LOG_ENTRY_TYPE_PRECERT
SCT_get_log_en...Y_TYPE_PRECERTDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
) {
0-9
348 EVP_PKEY *issuer_pkey;-
349-
350 if (ctx->issuer ==
ctx->issuer == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
351 ((void *)0)
ctx->issuer == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
352 ) {-
353 sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED;-
354 goto
never executed: goto end;
end;
never executed: goto end;
0
355 }-
356-
357 issuer_pkey = X509_get0_pubkey(ctx->issuer);-
358-
359 if (X509_PUBKEY_set(&pub, issuer_pkey) != 1
X509_PUBKEY_se...uer_pkey) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
360 goto
never executed: goto err;
err;
never executed: goto err;
0
361 if (SCT_CTX_set1_issuer_pubkey(sctx, pub) != 1
SCT_CTX_set1_i...ctx, pub) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
362 goto
never executed: goto err;
err;
never executed: goto err;
0
363 }
executed 9 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
9
364-
365 SCT_CTX_set_time(sctx, ctx->epoch_time_in_ms);-
366 if (SCT_CTX_set1_cert(sctx, ctx->cert,
SCT_CTX_set1_c...id *)0) ) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
367 ((void *)0)
SCT_CTX_set1_c...id *)0) ) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
368 ) != 1
SCT_CTX_set1_c...id *)0) ) != 1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
369 sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED;
never executed: sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED;
0
370 else-
371 sct->validation_status = SCT_CTX_verify(sctx, sct) == 1
SCT_CTX_verify(sctx, sct) == 1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
?
executed 9 times by 1 test: sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 ? SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID;
Executed by:
  • libcrypto.so.1.1
1-9
372 SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID;
executed 9 times by 1 test: sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 ? SCT_VALIDATION_STATUS_VALID : SCT_VALIDATION_STATUS_INVALID;
Executed by:
  • libcrypto.so.1.1
9
373-
374end:
code before this statement executed 9 times by 1 test: end:
Executed by:
  • libcrypto.so.1.1
9
375 is_sct_valid = sct->validation_status == SCT_VALIDATION_STATUS_VALID;-
376err:
code before this statement executed 9 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
9
377 X509_PUBKEY_free(pub);-
378 X509_PUBKEY_free(log_pkey);-
379 SCT_CTX_free(sctx);-
380-
381 return
executed 9 times by 1 test: return is_sct_valid;
Executed by:
  • libcrypto.so.1.1
is_sct_valid;
executed 9 times by 1 test: return is_sct_valid;
Executed by:
  • libcrypto.so.1.1
9
382}-
383-
384int SCT_LIST_validate(const struct stack_st_SCT *scts, CT_POLICY_EVAL_CTX *ctx)-
385{-
386 int are_scts_valid = 1;-
387 int sct_count = scts !=
scts != ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9
388 ((void *)0)
scts != ((void *)0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9
389 ? sk_SCT_num(scts) : 0;-
390 int i;-
391-
392 for (i = 0; i < sct_count
i < sct_countDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
; ++i) {
9
393 int is_sct_valid = -1;-
394 SCT *sct = sk_SCT_value(scts, i);-
395-
396 if (sct ==
sct == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
397 ((void *)0)
sct == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9
398 )-
399 continue;
never executed: continue;
0
400-
401 is_sct_valid = SCT_validate(sct, ctx);-
402 if (is_sct_valid < 0
is_sct_valid < 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
)
0-9
403 return
never executed: return is_sct_valid;
is_sct_valid;
never executed: return is_sct_valid;
0
404 are_scts_valid &= is_sct_valid;-
405 }
executed 9 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
9
406-
407 return
executed 9 times by 1 test: return are_scts_valid;
Executed by:
  • libcrypto.so.1.1
are_scts_valid;
executed 9 times by 1 test: return are_scts_valid;
Executed by:
  • libcrypto.so.1.1
9
408}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2