Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ocsp/v3_ocsp.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *nonce, | - | ||||||||||||||||||
8 | BIO *out, int indent); | - | ||||||||||||||||||
9 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *nonce, | - | ||||||||||||||||||
10 | BIO *out, int indent); | - | ||||||||||||||||||
11 | static int i2r_object(const X509V3_EXT_METHOD *method, void *obj, BIO *out, | - | ||||||||||||||||||
12 | int indent); | - | ||||||||||||||||||
13 | - | |||||||||||||||||||
14 | static void *ocsp_nonce_new(void); | - | ||||||||||||||||||
15 | static int i2d_ocsp_nonce(void *a, unsigned char **pp); | - | ||||||||||||||||||
16 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length); | - | ||||||||||||||||||
17 | static void ocsp_nonce_free(void *a); | - | ||||||||||||||||||
18 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, | - | ||||||||||||||||||
19 | BIO *out, int indent); | - | ||||||||||||||||||
20 | - | |||||||||||||||||||
21 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, | - | ||||||||||||||||||
22 | void *nocheck, BIO *out, int indent); | - | ||||||||||||||||||
23 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, | - | ||||||||||||||||||
24 | X509V3_CTX *ctx, const char *str); | - | ||||||||||||||||||
25 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, | - | ||||||||||||||||||
26 | BIO *bp, int ind); | - | ||||||||||||||||||
27 | - | |||||||||||||||||||
28 | const X509V3_EXT_METHOD v3_ocsp_crlid = { | - | ||||||||||||||||||
29 | 367, 0, (&(OCSP_CRLID_it)), | - | ||||||||||||||||||
30 | 0, 0, 0, 0, | - | ||||||||||||||||||
31 | 0, 0, | - | ||||||||||||||||||
32 | 0, 0, | - | ||||||||||||||||||
33 | i2r_ocsp_crlid, 0, | - | ||||||||||||||||||
34 | - | |||||||||||||||||||
35 | ((void *)0) | - | ||||||||||||||||||
36 | - | |||||||||||||||||||
37 | }; | - | ||||||||||||||||||
38 | - | |||||||||||||||||||
39 | const X509V3_EXT_METHOD v3_ocsp_acutoff = { | - | ||||||||||||||||||
40 | 370, 0, (&(ASN1_GENERALIZEDTIME_it)), | - | ||||||||||||||||||
41 | 0, 0, 0, 0, | - | ||||||||||||||||||
42 | 0, 0, | - | ||||||||||||||||||
43 | 0, 0, | - | ||||||||||||||||||
44 | i2r_ocsp_acutoff, 0, | - | ||||||||||||||||||
45 | - | |||||||||||||||||||
46 | ((void *)0) | - | ||||||||||||||||||
47 | - | |||||||||||||||||||
48 | }; | - | ||||||||||||||||||
49 | - | |||||||||||||||||||
50 | const X509V3_EXT_METHOD v3_crl_invdate = { | - | ||||||||||||||||||
51 | 142, 0, (&(ASN1_GENERALIZEDTIME_it)), | - | ||||||||||||||||||
52 | 0, 0, 0, 0, | - | ||||||||||||||||||
53 | 0, 0, | - | ||||||||||||||||||
54 | 0, 0, | - | ||||||||||||||||||
55 | i2r_ocsp_acutoff, 0, | - | ||||||||||||||||||
56 | - | |||||||||||||||||||
57 | ((void *)0) | - | ||||||||||||||||||
58 | - | |||||||||||||||||||
59 | }; | - | ||||||||||||||||||
60 | - | |||||||||||||||||||
61 | const X509V3_EXT_METHOD v3_crl_hold = { | - | ||||||||||||||||||
62 | 430, 0, (&(ASN1_OBJECT_it)), | - | ||||||||||||||||||
63 | 0, 0, 0, 0, | - | ||||||||||||||||||
64 | 0, 0, | - | ||||||||||||||||||
65 | 0, 0, | - | ||||||||||||||||||
66 | i2r_object, 0, | - | ||||||||||||||||||
67 | - | |||||||||||||||||||
68 | ((void *)0) | - | ||||||||||||||||||
69 | - | |||||||||||||||||||
70 | }; | - | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | const X509V3_EXT_METHOD v3_ocsp_nonce = { | - | ||||||||||||||||||
73 | 366, 0, | - | ||||||||||||||||||
74 | ((void *)0) | - | ||||||||||||||||||
75 | , | - | ||||||||||||||||||
76 | ocsp_nonce_new, | - | ||||||||||||||||||
77 | ocsp_nonce_free, | - | ||||||||||||||||||
78 | d2i_ocsp_nonce, | - | ||||||||||||||||||
79 | i2d_ocsp_nonce, | - | ||||||||||||||||||
80 | 0, 0, | - | ||||||||||||||||||
81 | 0, 0, | - | ||||||||||||||||||
82 | i2r_ocsp_nonce, 0, | - | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | ((void *)0) | - | ||||||||||||||||||
85 | - | |||||||||||||||||||
86 | }; | - | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | const X509V3_EXT_METHOD v3_ocsp_nocheck = { | - | ||||||||||||||||||
89 | 369, 0, (&(ASN1_NULL_it)), | - | ||||||||||||||||||
90 | 0, 0, 0, 0, | - | ||||||||||||||||||
91 | 0, s2i_ocsp_nocheck, | - | ||||||||||||||||||
92 | 0, 0, | - | ||||||||||||||||||
93 | i2r_ocsp_nocheck, 0, | - | ||||||||||||||||||
94 | - | |||||||||||||||||||
95 | ((void *)0) | - | ||||||||||||||||||
96 | - | |||||||||||||||||||
97 | }; | - | ||||||||||||||||||
98 | - | |||||||||||||||||||
99 | const X509V3_EXT_METHOD v3_ocsp_serviceloc = { | - | ||||||||||||||||||
100 | 371, 0, (&(OCSP_SERVICELOC_it)), | - | ||||||||||||||||||
101 | 0, 0, 0, 0, | - | ||||||||||||||||||
102 | 0, 0, | - | ||||||||||||||||||
103 | 0, 0, | - | ||||||||||||||||||
104 | i2r_ocsp_serviceloc, 0, | - | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | ((void *)0) | - | ||||||||||||||||||
107 | - | |||||||||||||||||||
108 | }; | - | ||||||||||||||||||
109 | - | |||||||||||||||||||
110 | static int i2r_ocsp_crlid(const X509V3_EXT_METHOD *method, void *in, BIO *bp, | - | ||||||||||||||||||
111 | int ind) | - | ||||||||||||||||||
112 | { | - | ||||||||||||||||||
113 | OCSP_CRLID *a = in; | - | ||||||||||||||||||
114 | if (a->crlUrl
| 0-831 | ||||||||||||||||||
115 | if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0
| 0 | ||||||||||||||||||
116 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
117 | if (!ASN1_STRING_print(bp, (ASN1_STRING *)a->crlUrl)
| 0 | ||||||||||||||||||
118 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
119 | if (BIO_write(bp, "\n", 1) <= 0
| 0 | ||||||||||||||||||
120 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
121 | } never executed: end of block | 0 | ||||||||||||||||||
122 | if (a->crlNum
| 0-831 | ||||||||||||||||||
123 | if (BIO_printf(bp, "%*scrlNum: ", ind, "") <= 0
| 0 | ||||||||||||||||||
124 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
125 | if (i2a_ASN1_INTEGER(bp, a->crlNum) <= 0
| 0 | ||||||||||||||||||
126 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
127 | if (BIO_write(bp, "\n", 1) <= 0
| 0 | ||||||||||||||||||
128 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
129 | } never executed: end of block | 0 | ||||||||||||||||||
130 | if (a->crlTime
| 0-831 | ||||||||||||||||||
131 | if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0
| 0 | ||||||||||||||||||
132 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
133 | if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)
| 0 | ||||||||||||||||||
134 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
135 | if (BIO_write(bp, "\n", 1) <= 0
| 0 | ||||||||||||||||||
136 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
137 | } never executed: end of block | 0 | ||||||||||||||||||
138 | return executed 831 times by 1 test: 1;return 1; Executed by:
executed 831 times by 1 test: return 1; Executed by:
| 831 | ||||||||||||||||||
139 | err: | - | ||||||||||||||||||
140 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
141 | } | - | ||||||||||||||||||
142 | - | |||||||||||||||||||
143 | static int i2r_ocsp_acutoff(const X509V3_EXT_METHOD *method, void *cutoff, | - | ||||||||||||||||||
144 | BIO *bp, int ind) | - | ||||||||||||||||||
145 | { | - | ||||||||||||||||||
146 | if (BIO_printf(bp, "%*s", ind, "") <= 0
| 0-5264 | ||||||||||||||||||
147 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
148 | if (!ASN1_GENERALIZEDTIME_print(bp, cutoff)
| 1085-4179 | ||||||||||||||||||
149 | return executed 4179 times by 1 test: 0;return 0; Executed by:
executed 4179 times by 1 test: return 0; Executed by:
| 4179 | ||||||||||||||||||
150 | return executed 1085 times by 1 test: 1;return 1; Executed by:
executed 1085 times by 1 test: return 1; Executed by:
| 1085 | ||||||||||||||||||
151 | } | - | ||||||||||||||||||
152 | - | |||||||||||||||||||
153 | static int i2r_object(const X509V3_EXT_METHOD *method, void *oid, BIO *bp, | - | ||||||||||||||||||
154 | int ind) | - | ||||||||||||||||||
155 | { | - | ||||||||||||||||||
156 | if (BIO_printf(bp, "%*s", ind, "") <= 0
| 0-270 | ||||||||||||||||||
157 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
158 | if (i2a_ASN1_OBJECT(bp, oid) <= 0
| 0-270 | ||||||||||||||||||
159 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
160 | return executed 270 times by 1 test: 1;return 1; Executed by:
executed 270 times by 1 test: return 1; Executed by:
| 270 | ||||||||||||||||||
161 | } | - | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | - | |||||||||||||||||||
164 | - | |||||||||||||||||||
165 | - | |||||||||||||||||||
166 | - | |||||||||||||||||||
167 | - | |||||||||||||||||||
168 | static void *ocsp_nonce_new(void) | - | ||||||||||||||||||
169 | { | - | ||||||||||||||||||
170 | return never executed: ASN1_OCTET_STRING_new();return ASN1_OCTET_STRING_new(); never executed: return ASN1_OCTET_STRING_new(); | 0 | ||||||||||||||||||
171 | } | - | ||||||||||||||||||
172 | - | |||||||||||||||||||
173 | static int i2d_ocsp_nonce(void *a, unsigned char **pp) | - | ||||||||||||||||||
174 | { | - | ||||||||||||||||||
175 | ASN1_OCTET_STRING *os = a; | - | ||||||||||||||||||
176 | if (pp
| 0 | ||||||||||||||||||
177 | memcpy(*pp, os->data, os->length); | - | ||||||||||||||||||
178 | *pp += os->length; | - | ||||||||||||||||||
179 | } never executed: end of block | 0 | ||||||||||||||||||
180 | return never executed: os->length;return os->length; never executed: return os->length; | 0 | ||||||||||||||||||
181 | } | - | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | static void *d2i_ocsp_nonce(void *a, const unsigned char **pp, long length) | - | ||||||||||||||||||
184 | { | - | ||||||||||||||||||
185 | ASN1_OCTET_STRING *os, **pos; | - | ||||||||||||||||||
186 | pos = a; | - | ||||||||||||||||||
187 | if (pos ==
| 0-978 | ||||||||||||||||||
188 | ((void *)0)
| 0-978 | ||||||||||||||||||
189 | || *
| 0 | ||||||||||||||||||
190 | ((void *)0)
| 0 | ||||||||||||||||||
191 | ) { | - | ||||||||||||||||||
192 | os = ASN1_OCTET_STRING_new(); | - | ||||||||||||||||||
193 | if (os ==
| 0-978 | ||||||||||||||||||
194 | ((void *)0)
| 0-978 | ||||||||||||||||||
195 | ) | - | ||||||||||||||||||
196 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
197 | } executed 978 times by 1 test: else {end of block Executed by:
| 978 | ||||||||||||||||||
198 | os = *pos; | - | ||||||||||||||||||
199 | } never executed: end of block | 0 | ||||||||||||||||||
200 | if (!ASN1_OCTET_STRING_set(os, *pp, length)
| 0-978 | ||||||||||||||||||
201 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
202 | - | |||||||||||||||||||
203 | *pp += length; | - | ||||||||||||||||||
204 | - | |||||||||||||||||||
205 | if (pos
| 0-978 | ||||||||||||||||||
206 | * never executed: pos = os;*pos = os; never executed: *pos = os; | 0 | ||||||||||||||||||
207 | return executed 978 times by 1 test: os;return os; Executed by:
executed 978 times by 1 test: return os; Executed by:
| 978 | ||||||||||||||||||
208 | - | |||||||||||||||||||
209 | err: | - | ||||||||||||||||||
210 | if ((
| 0 | ||||||||||||||||||
211 | ((void *)0)
| 0 | ||||||||||||||||||
212 | )
| 0 | ||||||||||||||||||
213 | ASN1_OCTET_STRING_free(os); never executed: ASN1_OCTET_STRING_free(os); | 0 | ||||||||||||||||||
214 | ERR_put_error(39,(102),((1|64)),__FILE__,206); | - | ||||||||||||||||||
215 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
216 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
217 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
218 | } | - | ||||||||||||||||||
219 | - | |||||||||||||||||||
220 | static void ocsp_nonce_free(void *a) | - | ||||||||||||||||||
221 | { | - | ||||||||||||||||||
222 | ASN1_OCTET_STRING_free(a); | - | ||||||||||||||||||
223 | } executed 978 times by 1 test: end of block Executed by:
| 978 | ||||||||||||||||||
224 | - | |||||||||||||||||||
225 | static int i2r_ocsp_nonce(const X509V3_EXT_METHOD *method, void *nonce, | - | ||||||||||||||||||
226 | BIO *out, int indent) | - | ||||||||||||||||||
227 | { | - | ||||||||||||||||||
228 | if (BIO_printf(out, "%*s", indent, "") <= 0
| 0-978 | ||||||||||||||||||
229 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
230 | if (i2a_ASN1_STRING(out, nonce, 4) <= 0
| 0-978 | ||||||||||||||||||
231 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
232 | return executed 978 times by 1 test: 1;return 1; Executed by:
executed 978 times by 1 test: return 1; Executed by:
| 978 | ||||||||||||||||||
233 | } | - | ||||||||||||||||||
234 | - | |||||||||||||||||||
235 | - | |||||||||||||||||||
236 | - | |||||||||||||||||||
237 | static int i2r_ocsp_nocheck(const X509V3_EXT_METHOD *method, void *nocheck, | - | ||||||||||||||||||
238 | BIO *out, int indent) | - | ||||||||||||||||||
239 | { | - | ||||||||||||||||||
240 | return executed 390 times by 1 test: 1;return 1; Executed by:
executed 390 times by 1 test: return 1; Executed by:
| 390 | ||||||||||||||||||
241 | } | - | ||||||||||||||||||
242 | - | |||||||||||||||||||
243 | static void *s2i_ocsp_nocheck(const X509V3_EXT_METHOD *method, | - | ||||||||||||||||||
244 | X509V3_CTX *ctx, const char *str) | - | ||||||||||||||||||
245 | { | - | ||||||||||||||||||
246 | return never executed: ASN1_NULL_new();return ASN1_NULL_new(); never executed: return ASN1_NULL_new(); | 0 | ||||||||||||||||||
247 | } | - | ||||||||||||||||||
248 | - | |||||||||||||||||||
249 | static int i2r_ocsp_serviceloc(const X509V3_EXT_METHOD *method, void *in, | - | ||||||||||||||||||
250 | BIO *bp, int ind) | - | ||||||||||||||||||
251 | { | - | ||||||||||||||||||
252 | int i; | - | ||||||||||||||||||
253 | OCSP_SERVICELOC *a = in; | - | ||||||||||||||||||
254 | ACCESS_DESCRIPTION *ad; | - | ||||||||||||||||||
255 | - | |||||||||||||||||||
256 | if (BIO_printf(bp, "%*sIssuer: ", ind, "") <= 0
| 0-1972 | ||||||||||||||||||
257 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
258 | if (X509_NAME_print_ex(bp, a->issuer, 0, ((1 | 2 | 4 | 0x10 | 0x100 | 0x200) | 8 | (2 << 16) | (1 << 23) | 0)) <= 0
| 410-1562 | ||||||||||||||||||
259 | goto executed 1562 times by 1 test: err;goto err; Executed by:
executed 1562 times by 1 test: goto err; Executed by:
| 1562 | ||||||||||||||||||
260 | for (i = 0; i < sk_ACCESS_DESCRIPTION_num(a->locator)
| 0-410 | ||||||||||||||||||
261 | ad = sk_ACCESS_DESCRIPTION_value(a->locator, i); | - | ||||||||||||||||||
262 | if (BIO_printf(bp, "\n%*s", (2 * ind), "") <= 0
| 0 | ||||||||||||||||||
263 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
264 | if (i2a_ASN1_OBJECT(bp, ad->method) <= 0
| 0 | ||||||||||||||||||
265 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
266 | if (BIO_puts(bp, " - ") <= 0
| 0 | ||||||||||||||||||
267 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
268 | if (GENERAL_NAME_print(bp, ad->location) <= 0
| 0 | ||||||||||||||||||
269 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||
270 | } never executed: end of block | 0 | ||||||||||||||||||
271 | return executed 410 times by 1 test: 1;return 1; Executed by:
executed 410 times by 1 test: return 1; Executed by:
| 410 | ||||||||||||||||||
272 | err: | - | ||||||||||||||||||
273 | return executed 1562 times by 1 test: 0;return 0; Executed by:
executed 1562 times by 1 test: return 0; Executed by:
| 1562 | ||||||||||||||||||
274 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |