Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/dsa/dsa_asn1.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | static int | - | ||||||||||||
5 | sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | - | ||||||||||||
6 | { | - | ||||||||||||
7 | if (operation == 0
| 1-11 | ||||||||||||
8 | DSA_SIG *sig; | - | ||||||||||||
9 | - | |||||||||||||
10 | if ((
| 0-1 | ||||||||||||
11 | ((void *)0)
| 0-1 | ||||||||||||
12 | ) { | - | ||||||||||||
13 | ERR_put_error(10,(0xfff),((1|64)),__FILE__,75); | - | ||||||||||||
14 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
15 | } | - | ||||||||||||
16 | *pval = (ASN1_VALUE *)sig; | - | ||||||||||||
17 | return executed 1 time by 1 test: 2;return 2; Executed by:
executed 1 time by 1 test: return 2; Executed by:
| 1 | ||||||||||||
18 | } | - | ||||||||||||
19 | return executed 11 times by 2 tests: 1;return 1; Executed by:
executed 11 times by 2 tests: return 1; Executed by:
| 11 | ||||||||||||
20 | } | - | ||||||||||||
21 | - | |||||||||||||
22 | static const ASN1_AUX DSA_SIG_aux = { | - | ||||||||||||
23 | .app_data = | - | ||||||||||||
24 | ((void *)0) | - | ||||||||||||
25 | , | - | ||||||||||||
26 | .flags = 0, | - | ||||||||||||
27 | .ref_offset = 0, | - | ||||||||||||
28 | .ref_lock = 0, | - | ||||||||||||
29 | .asn1_cb = sig_cb, | - | ||||||||||||
30 | .enc_offset = 0, | - | ||||||||||||
31 | }; | - | ||||||||||||
32 | static const ASN1_TEMPLATE DSA_SIG_seq_tt[] = { | - | ||||||||||||
33 | { | - | ||||||||||||
34 | .flags = 0, | - | ||||||||||||
35 | .tag = 0, | - | ||||||||||||
36 | .offset = | - | ||||||||||||
37 | __builtin_offsetof ( | - | ||||||||||||
38 | DSA_SIG | - | ||||||||||||
39 | , | - | ||||||||||||
40 | r | - | ||||||||||||
41 | ) | - | ||||||||||||
42 | , | - | ||||||||||||
43 | .field_name = "r", | - | ||||||||||||
44 | .item = &CBIGNUM_it, | - | ||||||||||||
45 | }, | - | ||||||||||||
46 | { | - | ||||||||||||
47 | .flags = 0, | - | ||||||||||||
48 | .tag = 0, | - | ||||||||||||
49 | .offset = | - | ||||||||||||
50 | __builtin_offsetof ( | - | ||||||||||||
51 | DSA_SIG | - | ||||||||||||
52 | , | - | ||||||||||||
53 | s | - | ||||||||||||
54 | ) | - | ||||||||||||
55 | , | - | ||||||||||||
56 | .field_name = "s", | - | ||||||||||||
57 | .item = &CBIGNUM_it, | - | ||||||||||||
58 | }, | - | ||||||||||||
59 | }; | - | ||||||||||||
60 | - | |||||||||||||
61 | const ASN1_ITEM DSA_SIG_it = { | - | ||||||||||||
62 | .itype = 0x1, | - | ||||||||||||
63 | .utype = 16, | - | ||||||||||||
64 | .templates = DSA_SIG_seq_tt, | - | ||||||||||||
65 | .tcount = sizeof(DSA_SIG_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
66 | .funcs = &DSA_SIG_aux, | - | ||||||||||||
67 | .size = sizeof(DSA_SIG), | - | ||||||||||||
68 | .sname = "DSA_SIG", | - | ||||||||||||
69 | }; | - | ||||||||||||
70 | - | |||||||||||||
71 | - | |||||||||||||
72 | DSA_SIG * | - | ||||||||||||
73 | d2i_DSA_SIG(DSA_SIG **a, const unsigned char **in, long len) | - | ||||||||||||
74 | { | - | ||||||||||||
75 | return executed 2 times by 2 tests: (DSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (DSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSA_SIG_it); Executed by:
executed 2 times by 2 tests: return (DSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSA_SIG_it); Executed by:
| 2 | ||||||||||||
76 | &DSA_SIG_it); executed 2 times by 2 tests: return (DSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSA_SIG_it); Executed by:
| 2 | ||||||||||||
77 | } | - | ||||||||||||
78 | - | |||||||||||||
79 | int | - | ||||||||||||
80 | i2d_DSA_SIG(const DSA_SIG *a, unsigned char **out) | - | ||||||||||||
81 | { | - | ||||||||||||
82 | return executed 3 times by 2 tests: ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); Executed by:
executed 3 times by 2 tests: return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); Executed by:
| 3 | ||||||||||||
83 | } | - | ||||||||||||
84 | - | |||||||||||||
85 | void | - | ||||||||||||
86 | DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | - | ||||||||||||
87 | { | - | ||||||||||||
88 | if (pr !=
| 0 | ||||||||||||
89 | ((void *)0)
| 0 | ||||||||||||
90 | ) | - | ||||||||||||
91 | * never executed: pr = sig->r;*pr = sig->r; never executed: *pr = sig->r; | 0 | ||||||||||||
92 | if (ps !=
| 0 | ||||||||||||
93 | ((void *)0)
| 0 | ||||||||||||
94 | ) | - | ||||||||||||
95 | * never executed: ps = sig->s;*ps = sig->s; never executed: *ps = sig->s; | 0 | ||||||||||||
96 | } never executed: end of block | 0 | ||||||||||||
97 | - | |||||||||||||
98 | int | - | ||||||||||||
99 | DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) | - | ||||||||||||
100 | { | - | ||||||||||||
101 | if (r ==
| 0 | ||||||||||||
102 | ((void *)0)
| 0 | ||||||||||||
103 | || s ==
| 0 | ||||||||||||
104 | ((void *)0)
| 0 | ||||||||||||
105 | ) | - | ||||||||||||
106 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
107 | - | |||||||||||||
108 | BN_clear_free(sig->r); | - | ||||||||||||
109 | sig->r = r; | - | ||||||||||||
110 | BN_clear_free(sig->s); | - | ||||||||||||
111 | sig->s = s; | - | ||||||||||||
112 | - | |||||||||||||
113 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||
114 | } | - | ||||||||||||
115 | - | |||||||||||||
116 | - | |||||||||||||
117 | static int | - | ||||||||||||
118 | dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | - | ||||||||||||
119 | { | - | ||||||||||||
120 | if (operation == 0
| 3-22 | ||||||||||||
121 | *pval = (ASN1_VALUE *)DSA_new(); | - | ||||||||||||
122 | if (*
| 0-3 | ||||||||||||
123 | return executed 3 times by 1 test: 2;return 2; Executed by:
executed 3 times by 1 test: return 2; Executed by:
| 3 | ||||||||||||
124 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
125 | } else if (operation == 2
| 0-22 | ||||||||||||
126 | DSA_free((DSA *)*pval); | - | ||||||||||||
127 | *pval = | - | ||||||||||||
128 | ((void *)0) | - | ||||||||||||
129 | ; | - | ||||||||||||
130 | return never executed: 2;return 2; never executed: return 2; | 0 | ||||||||||||
131 | } | - | ||||||||||||
132 | return executed 22 times by 1 test: 1;return 1; Executed by:
executed 22 times by 1 test: return 1; Executed by:
| 22 | ||||||||||||
133 | } | - | ||||||||||||
134 | - | |||||||||||||
135 | static const ASN1_AUX DSAPrivateKey_aux = { | - | ||||||||||||
136 | .app_data = | - | ||||||||||||
137 | ((void *)0) | - | ||||||||||||
138 | , | - | ||||||||||||
139 | .flags = 0, | - | ||||||||||||
140 | .ref_offset = 0, | - | ||||||||||||
141 | .ref_lock = 0, | - | ||||||||||||
142 | .asn1_cb = dsa_cb, | - | ||||||||||||
143 | .enc_offset = 0, | - | ||||||||||||
144 | }; | - | ||||||||||||
145 | static const ASN1_TEMPLATE DSAPrivateKey_seq_tt[] = { | - | ||||||||||||
146 | { | - | ||||||||||||
147 | .flags = 0, | - | ||||||||||||
148 | .tag = 0, | - | ||||||||||||
149 | .offset = | - | ||||||||||||
150 | __builtin_offsetof ( | - | ||||||||||||
151 | DSA | - | ||||||||||||
152 | , | - | ||||||||||||
153 | version | - | ||||||||||||
154 | ) | - | ||||||||||||
155 | , | - | ||||||||||||
156 | .field_name = "version", | - | ||||||||||||
157 | .item = &LONG_it, | - | ||||||||||||
158 | }, | - | ||||||||||||
159 | { | - | ||||||||||||
160 | .flags = 0, | - | ||||||||||||
161 | .tag = 0, | - | ||||||||||||
162 | .offset = | - | ||||||||||||
163 | __builtin_offsetof ( | - | ||||||||||||
164 | DSA | - | ||||||||||||
165 | , | - | ||||||||||||
166 | p | - | ||||||||||||
167 | ) | - | ||||||||||||
168 | , | - | ||||||||||||
169 | .field_name = "p", | - | ||||||||||||
170 | .item = &BIGNUM_it, | - | ||||||||||||
171 | }, | - | ||||||||||||
172 | { | - | ||||||||||||
173 | .flags = 0, | - | ||||||||||||
174 | .tag = 0, | - | ||||||||||||
175 | .offset = | - | ||||||||||||
176 | __builtin_offsetof ( | - | ||||||||||||
177 | DSA | - | ||||||||||||
178 | , | - | ||||||||||||
179 | q | - | ||||||||||||
180 | ) | - | ||||||||||||
181 | , | - | ||||||||||||
182 | .field_name = "q", | - | ||||||||||||
183 | .item = &BIGNUM_it, | - | ||||||||||||
184 | }, | - | ||||||||||||
185 | { | - | ||||||||||||
186 | .flags = 0, | - | ||||||||||||
187 | .tag = 0, | - | ||||||||||||
188 | .offset = | - | ||||||||||||
189 | __builtin_offsetof ( | - | ||||||||||||
190 | DSA | - | ||||||||||||
191 | , | - | ||||||||||||
192 | g | - | ||||||||||||
193 | ) | - | ||||||||||||
194 | , | - | ||||||||||||
195 | .field_name = "g", | - | ||||||||||||
196 | .item = &BIGNUM_it, | - | ||||||||||||
197 | }, | - | ||||||||||||
198 | { | - | ||||||||||||
199 | .flags = 0, | - | ||||||||||||
200 | .tag = 0, | - | ||||||||||||
201 | .offset = | - | ||||||||||||
202 | __builtin_offsetof ( | - | ||||||||||||
203 | DSA | - | ||||||||||||
204 | , | - | ||||||||||||
205 | pub_key | - | ||||||||||||
206 | ) | - | ||||||||||||
207 | , | - | ||||||||||||
208 | .field_name = "pub_key", | - | ||||||||||||
209 | .item = &BIGNUM_it, | - | ||||||||||||
210 | }, | - | ||||||||||||
211 | { | - | ||||||||||||
212 | .flags = 0, | - | ||||||||||||
213 | .tag = 0, | - | ||||||||||||
214 | .offset = | - | ||||||||||||
215 | __builtin_offsetof ( | - | ||||||||||||
216 | DSA | - | ||||||||||||
217 | , | - | ||||||||||||
218 | priv_key | - | ||||||||||||
219 | ) | - | ||||||||||||
220 | , | - | ||||||||||||
221 | .field_name = "priv_key", | - | ||||||||||||
222 | .item = &BIGNUM_it, | - | ||||||||||||
223 | }, | - | ||||||||||||
224 | }; | - | ||||||||||||
225 | - | |||||||||||||
226 | const ASN1_ITEM DSAPrivateKey_it = { | - | ||||||||||||
227 | .itype = 0x1, | - | ||||||||||||
228 | .utype = 16, | - | ||||||||||||
229 | .templates = DSAPrivateKey_seq_tt, | - | ||||||||||||
230 | .tcount = sizeof(DSAPrivateKey_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
231 | .funcs = &DSAPrivateKey_aux, | - | ||||||||||||
232 | .size = sizeof(DSA), | - | ||||||||||||
233 | .sname = "DSA", | - | ||||||||||||
234 | }; | - | ||||||||||||
235 | - | |||||||||||||
236 | - | |||||||||||||
237 | DSA * | - | ||||||||||||
238 | d2i_DSAPrivateKey(DSA **a, const unsigned char **in, long len) | - | ||||||||||||
239 | { | - | ||||||||||||
240 | return never executed: (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPrivateKey_it); never executed: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPrivateKey_it); | 0 | ||||||||||||
241 | &DSAPrivateKey_it); never executed: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPrivateKey_it); | 0 | ||||||||||||
242 | } | - | ||||||||||||
243 | - | |||||||||||||
244 | int | - | ||||||||||||
245 | i2d_DSAPrivateKey(const DSA *a, unsigned char **out) | - | ||||||||||||
246 | { | - | ||||||||||||
247 | return never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPrivateKey_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPrivateKey_it); never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPrivateKey_it); | 0 | ||||||||||||
248 | } | - | ||||||||||||
249 | - | |||||||||||||
250 | static const ASN1_AUX DSAparams_aux = { | - | ||||||||||||
251 | .app_data = | - | ||||||||||||
252 | ((void *)0) | - | ||||||||||||
253 | , | - | ||||||||||||
254 | .flags = 0, | - | ||||||||||||
255 | .ref_offset = 0, | - | ||||||||||||
256 | .ref_lock = 0, | - | ||||||||||||
257 | .asn1_cb = dsa_cb, | - | ||||||||||||
258 | .enc_offset = 0, | - | ||||||||||||
259 | }; | - | ||||||||||||
260 | static const ASN1_TEMPLATE DSAparams_seq_tt[] = { | - | ||||||||||||
261 | { | - | ||||||||||||
262 | .flags = 0, | - | ||||||||||||
263 | .tag = 0, | - | ||||||||||||
264 | .offset = | - | ||||||||||||
265 | __builtin_offsetof ( | - | ||||||||||||
266 | DSA | - | ||||||||||||
267 | , | - | ||||||||||||
268 | p | - | ||||||||||||
269 | ) | - | ||||||||||||
270 | , | - | ||||||||||||
271 | .field_name = "p", | - | ||||||||||||
272 | .item = &BIGNUM_it, | - | ||||||||||||
273 | }, | - | ||||||||||||
274 | { | - | ||||||||||||
275 | .flags = 0, | - | ||||||||||||
276 | .tag = 0, | - | ||||||||||||
277 | .offset = | - | ||||||||||||
278 | __builtin_offsetof ( | - | ||||||||||||
279 | DSA | - | ||||||||||||
280 | , | - | ||||||||||||
281 | q | - | ||||||||||||
282 | ) | - | ||||||||||||
283 | , | - | ||||||||||||
284 | .field_name = "q", | - | ||||||||||||
285 | .item = &BIGNUM_it, | - | ||||||||||||
286 | }, | - | ||||||||||||
287 | { | - | ||||||||||||
288 | .flags = 0, | - | ||||||||||||
289 | .tag = 0, | - | ||||||||||||
290 | .offset = | - | ||||||||||||
291 | __builtin_offsetof ( | - | ||||||||||||
292 | DSA | - | ||||||||||||
293 | , | - | ||||||||||||
294 | g | - | ||||||||||||
295 | ) | - | ||||||||||||
296 | , | - | ||||||||||||
297 | .field_name = "g", | - | ||||||||||||
298 | .item = &BIGNUM_it, | - | ||||||||||||
299 | }, | - | ||||||||||||
300 | }; | - | ||||||||||||
301 | - | |||||||||||||
302 | const ASN1_ITEM DSAparams_it = { | - | ||||||||||||
303 | .itype = 0x1, | - | ||||||||||||
304 | .utype = 16, | - | ||||||||||||
305 | .templates = DSAparams_seq_tt, | - | ||||||||||||
306 | .tcount = sizeof(DSAparams_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
307 | .funcs = &DSAparams_aux, | - | ||||||||||||
308 | .size = sizeof(DSA), | - | ||||||||||||
309 | .sname = "DSA", | - | ||||||||||||
310 | }; | - | ||||||||||||
311 | - | |||||||||||||
312 | - | |||||||||||||
313 | DSA * | - | ||||||||||||
314 | d2i_DSAparams(DSA **a, const unsigned char **in, long len) | - | ||||||||||||
315 | { | - | ||||||||||||
316 | return executed 3 times by 1 test: (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAparams_it); Executed by:
executed 3 times by 1 test: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAparams_it); Executed by:
| 3 | ||||||||||||
317 | &DSAparams_it); executed 3 times by 1 test: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAparams_it); Executed by:
| 3 | ||||||||||||
318 | } | - | ||||||||||||
319 | - | |||||||||||||
320 | int | - | ||||||||||||
321 | i2d_DSAparams(const DSA *a, unsigned char **out) | - | ||||||||||||
322 | { | - | ||||||||||||
323 | return executed 5 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAparams_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAparams_it); Executed by:
executed 5 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAparams_it); Executed by:
| 5 | ||||||||||||
324 | } | - | ||||||||||||
325 | - | |||||||||||||
326 | DSA * | - | ||||||||||||
327 | d2i_DSAparams_bio(BIO *bp, DSA **a) | - | ||||||||||||
328 | { | - | ||||||||||||
329 | return never executed: ASN1_item_d2i_bio(&DSAparams_it, bp, a);return ASN1_item_d2i_bio(&DSAparams_it, bp, a); never executed: return ASN1_item_d2i_bio(&DSAparams_it, bp, a); | 0 | ||||||||||||
330 | } | - | ||||||||||||
331 | - | |||||||||||||
332 | int | - | ||||||||||||
333 | i2d_DSAparams_bio(BIO *bp, DSA *a) | - | ||||||||||||
334 | { | - | ||||||||||||
335 | return never executed: ASN1_item_i2d_bio(&DSAparams_it, bp, a);return ASN1_item_i2d_bio(&DSAparams_it, bp, a); never executed: return ASN1_item_i2d_bio(&DSAparams_it, bp, a); | 0 | ||||||||||||
336 | } | - | ||||||||||||
337 | - | |||||||||||||
338 | DSA * | - | ||||||||||||
339 | d2i_DSAparams_fp(FILE *fp, DSA **a) | - | ||||||||||||
340 | { | - | ||||||||||||
341 | return never executed: ASN1_item_d2i_fp(&DSAparams_it, fp, a);return ASN1_item_d2i_fp(&DSAparams_it, fp, a); never executed: return ASN1_item_d2i_fp(&DSAparams_it, fp, a); | 0 | ||||||||||||
342 | } | - | ||||||||||||
343 | - | |||||||||||||
344 | int | - | ||||||||||||
345 | i2d_DSAparams_fp(FILE *fp, DSA *a) | - | ||||||||||||
346 | { | - | ||||||||||||
347 | return never executed: ASN1_item_i2d_fp(&DSAparams_it, fp, a);return ASN1_item_i2d_fp(&DSAparams_it, fp, a); never executed: return ASN1_item_i2d_fp(&DSAparams_it, fp, a); | 0 | ||||||||||||
348 | } | - | ||||||||||||
349 | static const ASN1_TEMPLATE dsa_pub_internal_seq_tt[] = { | - | ||||||||||||
350 | { | - | ||||||||||||
351 | .flags = 0, | - | ||||||||||||
352 | .tag = 0, | - | ||||||||||||
353 | .offset = | - | ||||||||||||
354 | __builtin_offsetof ( | - | ||||||||||||
355 | DSA | - | ||||||||||||
356 | , | - | ||||||||||||
357 | pub_key | - | ||||||||||||
358 | ) | - | ||||||||||||
359 | , | - | ||||||||||||
360 | .field_name = "pub_key", | - | ||||||||||||
361 | .item = &BIGNUM_it, | - | ||||||||||||
362 | }, | - | ||||||||||||
363 | { | - | ||||||||||||
364 | .flags = 0, | - | ||||||||||||
365 | .tag = 0, | - | ||||||||||||
366 | .offset = | - | ||||||||||||
367 | __builtin_offsetof ( | - | ||||||||||||
368 | DSA | - | ||||||||||||
369 | , | - | ||||||||||||
370 | p | - | ||||||||||||
371 | ) | - | ||||||||||||
372 | , | - | ||||||||||||
373 | .field_name = "p", | - | ||||||||||||
374 | .item = &BIGNUM_it, | - | ||||||||||||
375 | }, | - | ||||||||||||
376 | { | - | ||||||||||||
377 | .flags = 0, | - | ||||||||||||
378 | .tag = 0, | - | ||||||||||||
379 | .offset = | - | ||||||||||||
380 | __builtin_offsetof ( | - | ||||||||||||
381 | DSA | - | ||||||||||||
382 | , | - | ||||||||||||
383 | q | - | ||||||||||||
384 | ) | - | ||||||||||||
385 | , | - | ||||||||||||
386 | .field_name = "q", | - | ||||||||||||
387 | .item = &BIGNUM_it, | - | ||||||||||||
388 | }, | - | ||||||||||||
389 | { | - | ||||||||||||
390 | .flags = 0, | - | ||||||||||||
391 | .tag = 0, | - | ||||||||||||
392 | .offset = | - | ||||||||||||
393 | __builtin_offsetof ( | - | ||||||||||||
394 | DSA | - | ||||||||||||
395 | , | - | ||||||||||||
396 | g | - | ||||||||||||
397 | ) | - | ||||||||||||
398 | , | - | ||||||||||||
399 | .field_name = "g", | - | ||||||||||||
400 | .item = &BIGNUM_it, | - | ||||||||||||
401 | }, | - | ||||||||||||
402 | }; | - | ||||||||||||
403 | - | |||||||||||||
404 | const ASN1_ITEM dsa_pub_internal_it = { | - | ||||||||||||
405 | .itype = 0x1, | - | ||||||||||||
406 | .utype = 16, | - | ||||||||||||
407 | .templates = dsa_pub_internal_seq_tt, | - | ||||||||||||
408 | .tcount = sizeof(dsa_pub_internal_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
409 | .funcs = | - | ||||||||||||
410 | ((void *)0) | - | ||||||||||||
411 | , | - | ||||||||||||
412 | .size = sizeof(DSA), | - | ||||||||||||
413 | .sname = "DSA", | - | ||||||||||||
414 | }; | - | ||||||||||||
415 | - | |||||||||||||
416 | static const ASN1_AUX DSAPublicKey_aux = { | - | ||||||||||||
417 | .app_data = | - | ||||||||||||
418 | ((void *)0) | - | ||||||||||||
419 | , | - | ||||||||||||
420 | .flags = 0, | - | ||||||||||||
421 | .ref_offset = 0, | - | ||||||||||||
422 | .ref_lock = 0, | - | ||||||||||||
423 | .asn1_cb = dsa_cb, | - | ||||||||||||
424 | .enc_offset = 0, | - | ||||||||||||
425 | }; | - | ||||||||||||
426 | static const ASN1_TEMPLATE DSAPublicKey_ch_tt[] = { | - | ||||||||||||
427 | { | - | ||||||||||||
428 | .flags = 0, | - | ||||||||||||
429 | .tag = 0, | - | ||||||||||||
430 | .offset = | - | ||||||||||||
431 | __builtin_offsetof ( | - | ||||||||||||
432 | DSA | - | ||||||||||||
433 | , | - | ||||||||||||
434 | pub_key | - | ||||||||||||
435 | ) | - | ||||||||||||
436 | , | - | ||||||||||||
437 | .field_name = "pub_key", | - | ||||||||||||
438 | .item = &BIGNUM_it, | - | ||||||||||||
439 | }, | - | ||||||||||||
440 | { | - | ||||||||||||
441 | .flags = 0 | (0x1<<10), | - | ||||||||||||
442 | .tag = 0, | - | ||||||||||||
443 | .offset = 0, | - | ||||||||||||
444 | .field_name = | - | ||||||||||||
445 | ((void *)0) | - | ||||||||||||
446 | , | - | ||||||||||||
447 | .item = &dsa_pub_internal_it, | - | ||||||||||||
448 | }, | - | ||||||||||||
449 | }; | - | ||||||||||||
450 | - | |||||||||||||
451 | const ASN1_ITEM DSAPublicKey_it = { | - | ||||||||||||
452 | .itype = 0x2, | - | ||||||||||||
453 | .utype = | - | ||||||||||||
454 | __builtin_offsetof ( | - | ||||||||||||
455 | DSA | - | ||||||||||||
456 | , | - | ||||||||||||
457 | write_params | - | ||||||||||||
458 | ) | - | ||||||||||||
459 | , | - | ||||||||||||
460 | .templates = DSAPublicKey_ch_tt, | - | ||||||||||||
461 | .tcount = sizeof(DSAPublicKey_ch_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
462 | .funcs = &DSAPublicKey_aux, | - | ||||||||||||
463 | .size = sizeof(DSA), | - | ||||||||||||
464 | .sname = "DSA", | - | ||||||||||||
465 | }; | - | ||||||||||||
466 | - | |||||||||||||
467 | - | |||||||||||||
468 | DSA * | - | ||||||||||||
469 | d2i_DSAPublicKey(DSA **a, const unsigned char **in, long len) | - | ||||||||||||
470 | { | - | ||||||||||||
471 | return never executed: (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPublicKey_it); never executed: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPublicKey_it); | 0 | ||||||||||||
472 | &DSAPublicKey_it); never executed: return (DSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &DSAPublicKey_it); | 0 | ||||||||||||
473 | } | - | ||||||||||||
474 | - | |||||||||||||
475 | int | - | ||||||||||||
476 | i2d_DSAPublicKey(const DSA *a, unsigned char **out) | - | ||||||||||||
477 | { | - | ||||||||||||
478 | return executed 2 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPublicKey_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPublicKey_it); Executed by:
executed 2 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSAPublicKey_it); Executed by:
| 2 | ||||||||||||
479 | } | - | ||||||||||||
480 | - | |||||||||||||
481 | DSA * | - | ||||||||||||
482 | DSAparams_dup(DSA *dsa) | - | ||||||||||||
483 | { | - | ||||||||||||
484 | return never executed: ASN1_item_dup(&DSAparams_it, dsa);return ASN1_item_dup(&DSAparams_it, dsa); never executed: return ASN1_item_dup(&DSAparams_it, dsa); | 0 | ||||||||||||
485 | } | - | ||||||||||||
486 | - | |||||||||||||
487 | int | - | ||||||||||||
488 | DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | - | ||||||||||||
489 | unsigned int *siglen, DSA *dsa) | - | ||||||||||||
490 | { | - | ||||||||||||
491 | DSA_SIG *s; | - | ||||||||||||
492 | - | |||||||||||||
493 | s = DSA_do_sign(dgst, dlen, dsa); | - | ||||||||||||
494 | if (s ==
| 0-2 | ||||||||||||
495 | ((void *)0)
| 0-2 | ||||||||||||
496 | ) { | - | ||||||||||||
497 | *siglen = 0; | - | ||||||||||||
498 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||
499 | } | - | ||||||||||||
500 | *siglen = i2d_DSA_SIG(s,&sig); | - | ||||||||||||
501 | DSA_SIG_free(s); | - | ||||||||||||
502 | return executed 2 times by 2 tests: 1;return 1; Executed by:
executed 2 times by 2 tests: return 1; Executed by:
| 2 | ||||||||||||
503 | } | - | ||||||||||||
504 | int | - | ||||||||||||
505 | DSA_verify(int type, const unsigned char *dgst, int dgst_len, | - | ||||||||||||
506 | const unsigned char *sigbuf, int siglen, DSA *dsa) | - | ||||||||||||
507 | { | - | ||||||||||||
508 | DSA_SIG *s; | - | ||||||||||||
509 | unsigned char *der = | - | ||||||||||||
510 | ((void *)0) | - | ||||||||||||
511 | ; | - | ||||||||||||
512 | const unsigned char *p = sigbuf; | - | ||||||||||||
513 | int derlen = -1; | - | ||||||||||||
514 | int ret = -1; | - | ||||||||||||
515 | - | |||||||||||||
516 | s = DSA_SIG_new(); | - | ||||||||||||
517 | if (s ==
| 0-1 | ||||||||||||
518 | ((void *)0)
| 0-1 | ||||||||||||
519 | ) | - | ||||||||||||
520 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||
521 | if (d2i_DSA_SIG(&s, &p, siglen) ==
| 0-1 | ||||||||||||
522 | ((void *)0)
| 0-1 | ||||||||||||
523 | ) | - | ||||||||||||
524 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
525 | - | |||||||||||||
526 | derlen = i2d_DSA_SIG(s, &der); | - | ||||||||||||
527 | if (derlen != siglen
| 0-1 | ||||||||||||
528 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||
529 | ret = DSA_do_verify(dgst, dgst_len, s, dsa); | - | ||||||||||||
530 | err: code before this statement executed 1 time by 1 test: err: Executed by:
| 1 | ||||||||||||
531 | freezero(der, derlen); | - | ||||||||||||
532 | DSA_SIG_free(s); | - | ||||||||||||
533 | return executed 1 time by 1 test: ret;return ret; Executed by:
executed 1 time by 1 test: return ret; Executed by:
| 1 | ||||||||||||
534 | } | - | ||||||||||||
Switch to Source code | Preprocessed file |