OpenCoverage

ts_rsp_print.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/ts/ts_rsp_print.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4struct status_map_st {-
5 int bit;-
6 const char *text;-
7};-
8-
9-
10-
11static int TS_status_map_print(BIO *bio, struct status_map_st *a,-
12 ASN1_BIT_STRING *v);-
13static int TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy);-
14-
15-
16-
17int-
18TS_RESP_print_bio(BIO *bio, TS_RESP *a)-
19{-
20 TS_TST_INFO *tst_info;-
21-
22 BIO_printf(bio, "Status info:\n");-
23 TS_STATUS_INFO_print_bio(bio, TS_RESP_get_status_info(a));-
24-
25 BIO_printf(bio, "\nTST info:\n");-
26 tst_info = TS_RESP_get_tst_info(a);-
27 if (tst_info !=
tst_info != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
28 ((void *)0)
tst_info != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
29 )-
30 TS_TST_INFO_print_bio(bio, TS_RESP_get_tst_info(a));
never executed: TS_TST_INFO_print_bio(bio, TS_RESP_get_tst_info(a));
0
31 else-
32 BIO_printf(bio, "Not included.\n");
never executed: BIO_printf(bio, "Not included.\n");
0
33-
34 return
never executed: return 1;
1;
never executed: return 1;
0
35}-
36-
37int-
38TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a)-
39{-
40 static const char *status_map[] = {-
41 "Granted.",-
42 "Granted with modifications.",-
43 "Rejected.",-
44 "Waiting.",-
45 "Revocation warning.",-
46 "Revoked."-
47 };-
48 static struct status_map_st failure_map[] = {-
49 {-
50 0,-
51 "unrecognized or unsupported algorithm identifier"-
52 },-
53 {-
54 2,-
55 "transaction not permitted or supported"-
56 },-
57 {-
58 5,-
59 "the data submitted has the wrong format"-
60 },-
61 {-
62 14,-
63 "the TSA's time source is not available"-
64 },-
65 {-
66 15,-
67 "the requested TSA policy is not supported by the TSA"-
68 },-
69 {-
70 16,-
71 "the requested extension is not supported by the TSA"-
72 },-
73 {-
74 17,-
75 "the additional information requested could not be understood "-
76 "or is not available"-
77 },-
78 {-
79 25,-
80 "the request cannot be handled due to system failure"-
81 },-
82 { -1, -
83 ((void *)0) -
84 }-
85 };-
86 long status;-
87 int i, lines = 0;-
88-
89-
90 BIO_printf(bio, "Status: ");-
91 status = ASN1_INTEGER_get(a->status);-
92 if (0 <= status
0 <= statusDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
93 status < (long)(sizeof(status_map) / sizeof(status_map[0]))
status < (long...tatus_map[0]))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
94 BIO_printf(bio, "%s\n", status_map[status]);
never executed: BIO_printf(bio, "%s\n", status_map[status]);
0
95 else-
96 BIO_printf(bio, "out of bounds\n");
never executed: BIO_printf(bio, "out of bounds\n");
0
97-
98-
99 BIO_printf(bio, "Status description: ");-
100 for (i = 0; i < sk_num(((_STACK*) (1 ? (a->text) : (struct stack_st_ASN1_UTF8STRING*)0)))
i < sk_num(((_...F8STRING*)0)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
101 if (i > 0
i > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
102 BIO_puts(bio, "\t");
never executed: BIO_puts(bio, "\t");
0
103 ASN1_STRING_print_ex(bio, ((ASN1_UTF8STRING *)sk_value(((_STACK*) (1 ? (a->text) : (struct stack_st_ASN1_UTF8STRING*)0)), (i))),-
104 0);-
105 BIO_puts(bio, "\n");-
106 }
never executed: end of block
0
107 if (i == 0
i == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
108 BIO_printf(bio, "unspecified\n");
never executed: BIO_printf(bio, "unspecified\n");
0
109-
110-
111 BIO_printf(bio, "Failure info: ");-
112 if (a->failure_info !=
a->failure_info != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
113 ((void *)0)
a->failure_info != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
114 )-
115 lines = TS_status_map_print(bio, failure_map, a->failure_info);
never executed: lines = TS_status_map_print(bio, failure_map, a->failure_info);
0
116 if (lines == 0
lines == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
117 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
118 BIO_printf(bio, "\n");-
119-
120 return
never executed: return 1;
1;
never executed: return 1;
0
121}-
122-
123static int-
124TS_status_map_print(BIO *bio, struct status_map_st *a, ASN1_BIT_STRING *v)-
125{-
126 int lines = 0;-
127-
128 for (; a->bit >= 0
a->bit >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; ++a) {
0
129 if (ASN1_BIT_STRING_get_bit(v, a->bit)
ASN1_BIT_STRIN...bit(v, a->bit)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
130 if (++
++lines > 1Description
TRUEnever evaluated
FALSEnever evaluated
lines > 1
++lines > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
131 BIO_printf(bio, ", ");
never executed: BIO_printf(bio, ", ");
0
132 BIO_printf(bio, "%s", a->text);-
133 }
never executed: end of block
0
134 }
never executed: end of block
0
135-
136 return
never executed: return lines;
lines;
never executed: return lines;
0
137}-
138-
139int-
140TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a)-
141{-
142 int v;-
143 ASN1_OBJECT *policy_id;-
144 const ASN1_INTEGER *serial;-
145 const ASN1_GENERALIZEDTIME *gtime;-
146 TS_ACCURACY *accuracy;-
147 const ASN1_INTEGER *nonce;-
148 GENERAL_NAME *tsa_name;-
149-
150 if (a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
151 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
152 )-
153 return
never executed: return 0;
0;
never executed: return 0;
0
154-
155-
156 v = TS_TST_INFO_get_version(a);-
157 BIO_printf(bio, "Version: %d\n", v);-
158-
159-
160 BIO_printf(bio, "Policy OID: ");-
161 policy_id = TS_TST_INFO_get_policy_id(a);-
162 TS_OBJ_print_bio(bio, policy_id);-
163-
164-
165 TS_MSG_IMPRINT_print_bio(bio, TS_TST_INFO_get_msg_imprint(a));-
166-
167-
168 BIO_printf(bio, "Serial number: ");-
169 serial = TS_TST_INFO_get_serial(a);-
170 if (serial ==
serial == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
171 ((void *)0)
serial == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
172 )-
173 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
174 else-
175 TS_ASN1_INTEGER_print_bio(bio, serial);
never executed: TS_ASN1_INTEGER_print_bio(bio, serial);
0
176 BIO_write(bio, "\n", 1);-
177-
178-
179 BIO_printf(bio, "Time stamp: ");-
180 gtime = TS_TST_INFO_get_time(a);-
181 ASN1_GENERALIZEDTIME_print(bio, gtime);-
182 BIO_write(bio, "\n", 1);-
183-
184-
185 BIO_printf(bio, "Accuracy: ");-
186 accuracy = TS_TST_INFO_get_accuracy(a);-
187 if (accuracy ==
accuracy == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
188 ((void *)0)
accuracy == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
189 )-
190 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
191 else-
192 TS_ACCURACY_print_bio(bio, accuracy);
never executed: TS_ACCURACY_print_bio(bio, accuracy);
0
193 BIO_write(bio, "\n", 1);-
194-
195-
196 BIO_printf(bio, "Ordering: %s\n",-
197 TS_TST_INFO_get_ordering(a) ? "yes" : "no");-
198-
199-
200 BIO_printf(bio, "Nonce: ");-
201 nonce = TS_TST_INFO_get_nonce(a);-
202 if (nonce ==
nonce == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
203 ((void *)0)
nonce == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
204 )-
205 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
206 else-
207 TS_ASN1_INTEGER_print_bio(bio, nonce);
never executed: TS_ASN1_INTEGER_print_bio(bio, nonce);
0
208 BIO_write(bio, "\n", 1);-
209-
210-
211 BIO_printf(bio, "TSA: ");-
212 tsa_name = TS_TST_INFO_get_tsa(a);-
213 if (tsa_name ==
tsa_name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
214 ((void *)0)
tsa_name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
215 )-
216 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
217 else {-
218 struct stack_st_CONF_VALUE *nval;-
219 if ((
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
nval = i2v_GENERAL_NAME(
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
0
220 ((void *)0)
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
0
221 , tsa_name,
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
0
222 ((void *)0)
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
0
223 ))
(nval = i2v_GE...((void *)0) ))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
224 X509V3_EXT_val_prn(bio, nval, 0, 0);
never executed: X509V3_EXT_val_prn(bio, nval, 0, 0);
0
225 sk_pop_free(((_STACK*) (1 ? (nval) : (struct stack_st_CONF_VALUE*)0)), ((void (*)(void *)) ((1 ? (X509V3_conf_free) : (void (*)(CONF_VALUE *))0))));-
226 }
never executed: end of block
0
227 BIO_write(bio, "\n", 1);-
228-
229-
230 TS_ext_print_bio(bio, TS_TST_INFO_get_exts(a));-
231-
232 return
never executed: return 1;
1;
never executed: return 1;
0
233}-
234-
235static int-
236TS_ACCURACY_print_bio(BIO *bio, const TS_ACCURACY *accuracy)-
237{-
238 const ASN1_INTEGER *seconds = TS_ACCURACY_get_seconds(accuracy);-
239 const ASN1_INTEGER *millis = TS_ACCURACY_get_millis(accuracy);-
240 const ASN1_INTEGER *micros = TS_ACCURACY_get_micros(accuracy);-
241-
242 if (seconds !=
seconds != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
243 ((void *)0)
seconds != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
244 )-
245 TS_ASN1_INTEGER_print_bio(bio, seconds);
never executed: TS_ASN1_INTEGER_print_bio(bio, seconds);
0
246 else-
247 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
248 BIO_printf(bio, " seconds, ");-
249 if (millis !=
millis != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
250 ((void *)0)
millis != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
251 )-
252 TS_ASN1_INTEGER_print_bio(bio, millis);
never executed: TS_ASN1_INTEGER_print_bio(bio, millis);
0
253 else-
254 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
255 BIO_printf(bio, " millis, ");-
256 if (micros !=
micros != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
257 ((void *)0)
micros != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
258 )-
259 TS_ASN1_INTEGER_print_bio(bio, micros);
never executed: TS_ASN1_INTEGER_print_bio(bio, micros);
0
260 else-
261 BIO_printf(bio, "unspecified");
never executed: BIO_printf(bio, "unspecified");
0
262 BIO_printf(bio, " micros");-
263-
264 return
never executed: return 1;
1;
never executed: return 1;
0
265}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2