/src/openssl111/include/openssl/asn1t.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #ifndef HEADER_ASN1T_H |
11 | | # define HEADER_ASN1T_H |
12 | | |
13 | | # include <stddef.h> |
14 | | # include <openssl/e_os2.h> |
15 | | # include <openssl/asn1.h> |
16 | | |
17 | | # ifdef OPENSSL_BUILD_SHLIBCRYPTO |
18 | | # undef OPENSSL_EXTERN |
19 | | # define OPENSSL_EXTERN OPENSSL_EXPORT |
20 | | # endif |
21 | | |
22 | | /* ASN1 template defines, structures and functions */ |
23 | | |
24 | | #ifdef __cplusplus |
25 | | extern "C" { |
26 | | #endif |
27 | | |
28 | | # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION |
29 | | |
30 | | /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ |
31 | 0 | # define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) |
32 | | |
33 | | /* Macros for start and end of ASN1_ITEM definition */ |
34 | | |
35 | | # define ASN1_ITEM_start(itname) \ |
36 | | const ASN1_ITEM itname##_it = { |
37 | | |
38 | | # define static_ASN1_ITEM_start(itname) \ |
39 | | static const ASN1_ITEM itname##_it = { |
40 | | |
41 | | # define ASN1_ITEM_end(itname) \ |
42 | | }; |
43 | | |
44 | | # else |
45 | | |
46 | | /* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ |
47 | | # define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) |
48 | | |
49 | | /* Macros for start and end of ASN1_ITEM definition */ |
50 | | |
51 | | # define ASN1_ITEM_start(itname) \ |
52 | | const ASN1_ITEM * itname##_it(void) \ |
53 | | { \ |
54 | | static const ASN1_ITEM local_it = { |
55 | | |
56 | | # define static_ASN1_ITEM_start(itname) \ |
57 | | static ASN1_ITEM_start(itname) |
58 | | |
59 | | # define ASN1_ITEM_end(itname) \ |
60 | | }; \ |
61 | | return &local_it; \ |
62 | | } |
63 | | |
64 | | # endif |
65 | | |
66 | | /* Macros to aid ASN1 template writing */ |
67 | | |
68 | | # define ASN1_ITEM_TEMPLATE(tname) \ |
69 | | static const ASN1_TEMPLATE tname##_item_tt |
70 | | |
71 | | # define ASN1_ITEM_TEMPLATE_END(tname) \ |
72 | | ;\ |
73 | | ASN1_ITEM_start(tname) \ |
74 | | ASN1_ITYPE_PRIMITIVE,\ |
75 | | -1,\ |
76 | | &tname##_item_tt,\ |
77 | | 0,\ |
78 | | NULL,\ |
79 | | 0,\ |
80 | | #tname \ |
81 | | ASN1_ITEM_end(tname) |
82 | | # define static_ASN1_ITEM_TEMPLATE_END(tname) \ |
83 | | ;\ |
84 | | static_ASN1_ITEM_start(tname) \ |
85 | | ASN1_ITYPE_PRIMITIVE,\ |
86 | | -1,\ |
87 | | &tname##_item_tt,\ |
88 | | 0,\ |
89 | | NULL,\ |
90 | | 0,\ |
91 | | #tname \ |
92 | | ASN1_ITEM_end(tname) |
93 | | |
94 | | /* This is a ASN1 type which just embeds a template */ |
95 | | |
96 | | /*- |
97 | | * This pair helps declare a SEQUENCE. We can do: |
98 | | * |
99 | | * ASN1_SEQUENCE(stname) = { |
100 | | * ... SEQUENCE components ... |
101 | | * } ASN1_SEQUENCE_END(stname) |
102 | | * |
103 | | * This will produce an ASN1_ITEM called stname_it |
104 | | * for a structure called stname. |
105 | | * |
106 | | * If you want the same structure but a different |
107 | | * name then use: |
108 | | * |
109 | | * ASN1_SEQUENCE(itname) = { |
110 | | * ... SEQUENCE components ... |
111 | | * } ASN1_SEQUENCE_END_name(stname, itname) |
112 | | * |
113 | | * This will create an item called itname_it using |
114 | | * a structure called stname. |
115 | | */ |
116 | | |
117 | | # define ASN1_SEQUENCE(tname) \ |
118 | | static const ASN1_TEMPLATE tname##_seq_tt[] |
119 | | |
120 | | # define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) |
121 | | |
122 | | # define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) |
123 | | |
124 | | # define ASN1_SEQUENCE_END_name(stname, tname) \ |
125 | | ;\ |
126 | | ASN1_ITEM_start(tname) \ |
127 | | ASN1_ITYPE_SEQUENCE,\ |
128 | | V_ASN1_SEQUENCE,\ |
129 | | tname##_seq_tt,\ |
130 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
131 | | NULL,\ |
132 | | sizeof(stname),\ |
133 | | #tname \ |
134 | | ASN1_ITEM_end(tname) |
135 | | |
136 | | # define static_ASN1_SEQUENCE_END_name(stname, tname) \ |
137 | | ;\ |
138 | | static_ASN1_ITEM_start(tname) \ |
139 | | ASN1_ITYPE_SEQUENCE,\ |
140 | | V_ASN1_SEQUENCE,\ |
141 | | tname##_seq_tt,\ |
142 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
143 | | NULL,\ |
144 | | sizeof(stname),\ |
145 | | #stname \ |
146 | | ASN1_ITEM_end(tname) |
147 | | |
148 | | # define ASN1_NDEF_SEQUENCE(tname) \ |
149 | | ASN1_SEQUENCE(tname) |
150 | | |
151 | | # define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ |
152 | | ASN1_SEQUENCE_cb(tname, cb) |
153 | | |
154 | | # define ASN1_SEQUENCE_cb(tname, cb) \ |
155 | | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ |
156 | | ASN1_SEQUENCE(tname) |
157 | | |
158 | | # define ASN1_BROKEN_SEQUENCE(tname) \ |
159 | | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ |
160 | | ASN1_SEQUENCE(tname) |
161 | | |
162 | | # define ASN1_SEQUENCE_ref(tname, cb) \ |
163 | | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ |
164 | | ASN1_SEQUENCE(tname) |
165 | | |
166 | | # define ASN1_SEQUENCE_enc(tname, enc, cb) \ |
167 | | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ |
168 | | ASN1_SEQUENCE(tname) |
169 | | |
170 | | # define ASN1_NDEF_SEQUENCE_END(tname) \ |
171 | | ;\ |
172 | | ASN1_ITEM_start(tname) \ |
173 | | ASN1_ITYPE_NDEF_SEQUENCE,\ |
174 | | V_ASN1_SEQUENCE,\ |
175 | | tname##_seq_tt,\ |
176 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
177 | | NULL,\ |
178 | | sizeof(tname),\ |
179 | | #tname \ |
180 | | ASN1_ITEM_end(tname) |
181 | | # define static_ASN1_NDEF_SEQUENCE_END(tname) \ |
182 | | ;\ |
183 | | static_ASN1_ITEM_start(tname) \ |
184 | | ASN1_ITYPE_NDEF_SEQUENCE,\ |
185 | | V_ASN1_SEQUENCE,\ |
186 | | tname##_seq_tt,\ |
187 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
188 | | NULL,\ |
189 | | sizeof(tname),\ |
190 | | #tname \ |
191 | | ASN1_ITEM_end(tname) |
192 | | |
193 | | # define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) |
194 | | # define static_ASN1_BROKEN_SEQUENCE_END(stname) \ |
195 | | static_ASN1_SEQUENCE_END_ref(stname, stname) |
196 | | |
197 | | # define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) |
198 | | |
199 | | # define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) |
200 | | # define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) |
201 | | |
202 | | # define ASN1_SEQUENCE_END_ref(stname, tname) \ |
203 | | ;\ |
204 | | ASN1_ITEM_start(tname) \ |
205 | | ASN1_ITYPE_SEQUENCE,\ |
206 | | V_ASN1_SEQUENCE,\ |
207 | | tname##_seq_tt,\ |
208 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
209 | | &tname##_aux,\ |
210 | | sizeof(stname),\ |
211 | | #tname \ |
212 | | ASN1_ITEM_end(tname) |
213 | | # define static_ASN1_SEQUENCE_END_ref(stname, tname) \ |
214 | | ;\ |
215 | | static_ASN1_ITEM_start(tname) \ |
216 | | ASN1_ITYPE_SEQUENCE,\ |
217 | | V_ASN1_SEQUENCE,\ |
218 | | tname##_seq_tt,\ |
219 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
220 | | &tname##_aux,\ |
221 | | sizeof(stname),\ |
222 | | #stname \ |
223 | | ASN1_ITEM_end(tname) |
224 | | |
225 | | # define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ |
226 | | ;\ |
227 | | ASN1_ITEM_start(tname) \ |
228 | | ASN1_ITYPE_NDEF_SEQUENCE,\ |
229 | | V_ASN1_SEQUENCE,\ |
230 | | tname##_seq_tt,\ |
231 | | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
232 | | &tname##_aux,\ |
233 | | sizeof(stname),\ |
234 | | #stname \ |
235 | | ASN1_ITEM_end(tname) |
236 | | |
237 | | /*- |
238 | | * This pair helps declare a CHOICE type. We can do: |
239 | | * |
240 | | * ASN1_CHOICE(chname) = { |
241 | | * ... CHOICE options ... |
242 | | * ASN1_CHOICE_END(chname) |
243 | | * |
244 | | * This will produce an ASN1_ITEM called chname_it |
245 | | * for a structure called chname. The structure |
246 | | * definition must look like this: |
247 | | * typedef struct { |
248 | | * int type; |
249 | | * union { |
250 | | * ASN1_SOMETHING *opt1; |
251 | | * ASN1_SOMEOTHER *opt2; |
252 | | * } value; |
253 | | * } chname; |
254 | | * |
255 | | * the name of the selector must be 'type'. |
256 | | * to use an alternative selector name use the |
257 | | * ASN1_CHOICE_END_selector() version. |
258 | | */ |
259 | | |
260 | | # define ASN1_CHOICE(tname) \ |
261 | | static const ASN1_TEMPLATE tname##_ch_tt[] |
262 | | |
263 | | # define ASN1_CHOICE_cb(tname, cb) \ |
264 | | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ |
265 | | ASN1_CHOICE(tname) |
266 | | |
267 | | # define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) |
268 | | |
269 | | # define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) |
270 | | |
271 | | # define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) |
272 | | |
273 | | # define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) |
274 | | |
275 | | # define ASN1_CHOICE_END_selector(stname, tname, selname) \ |
276 | | ;\ |
277 | | ASN1_ITEM_start(tname) \ |
278 | | ASN1_ITYPE_CHOICE,\ |
279 | | offsetof(stname,selname) ,\ |
280 | | tname##_ch_tt,\ |
281 | | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
282 | | NULL,\ |
283 | | sizeof(stname),\ |
284 | | #stname \ |
285 | | ASN1_ITEM_end(tname) |
286 | | |
287 | | # define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ |
288 | | ;\ |
289 | | static_ASN1_ITEM_start(tname) \ |
290 | | ASN1_ITYPE_CHOICE,\ |
291 | | offsetof(stname,selname) ,\ |
292 | | tname##_ch_tt,\ |
293 | | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
294 | | NULL,\ |
295 | | sizeof(stname),\ |
296 | | #stname \ |
297 | | ASN1_ITEM_end(tname) |
298 | | |
299 | | # define ASN1_CHOICE_END_cb(stname, tname, selname) \ |
300 | | ;\ |
301 | | ASN1_ITEM_start(tname) \ |
302 | | ASN1_ITYPE_CHOICE,\ |
303 | | offsetof(stname,selname) ,\ |
304 | | tname##_ch_tt,\ |
305 | | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
306 | | &tname##_aux,\ |
307 | | sizeof(stname),\ |
308 | | #stname \ |
309 | | ASN1_ITEM_end(tname) |
310 | | |
311 | | /* This helps with the template wrapper form of ASN1_ITEM */ |
312 | | |
313 | | # define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ |
314 | | (flags), (tag), 0,\ |
315 | | #name, ASN1_ITEM_ref(type) } |
316 | | |
317 | | /* These help with SEQUENCE or CHOICE components */ |
318 | | |
319 | | /* used to declare other types */ |
320 | | |
321 | | # define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ |
322 | | (flags), (tag), offsetof(stname, field),\ |
323 | | #field, ASN1_ITEM_ref(type) } |
324 | | |
325 | | /* implicit and explicit helper macros */ |
326 | | |
327 | | # define ASN1_IMP_EX(stname, field, type, tag, ex) \ |
328 | | ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) |
329 | | |
330 | | # define ASN1_EXP_EX(stname, field, type, tag, ex) \ |
331 | | ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) |
332 | | |
333 | | /* Any defined by macros: the field used is in the table itself */ |
334 | | |
335 | | # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION |
336 | | # define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } |
337 | | # define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } |
338 | | # else |
339 | | # define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } |
340 | | # define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } |
341 | | # endif |
342 | | /* Plain simple type */ |
343 | | # define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) |
344 | | /* Embedded simple type */ |
345 | | # define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) |
346 | | |
347 | | /* OPTIONAL simple type */ |
348 | | # define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) |
349 | | # define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) |
350 | | |
351 | | /* IMPLICIT tagged simple type */ |
352 | | # define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) |
353 | | # define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) |
354 | | |
355 | | /* IMPLICIT tagged OPTIONAL simple type */ |
356 | | # define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) |
357 | | # define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) |
358 | | |
359 | | /* Same as above but EXPLICIT */ |
360 | | |
361 | | # define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) |
362 | | # define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) |
363 | | # define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) |
364 | | # define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) |
365 | | |
366 | | /* SEQUENCE OF type */ |
367 | | # define ASN1_SEQUENCE_OF(stname, field, type) \ |
368 | | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) |
369 | | |
370 | | /* OPTIONAL SEQUENCE OF */ |
371 | | # define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ |
372 | | ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) |
373 | | |
374 | | /* Same as above but for SET OF */ |
375 | | |
376 | | # define ASN1_SET_OF(stname, field, type) \ |
377 | | ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) |
378 | | |
379 | | # define ASN1_SET_OF_OPT(stname, field, type) \ |
380 | | ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) |
381 | | |
382 | | /* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ |
383 | | |
384 | | # define ASN1_IMP_SET_OF(stname, field, type, tag) \ |
385 | | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) |
386 | | |
387 | | # define ASN1_EXP_SET_OF(stname, field, type, tag) \ |
388 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) |
389 | | |
390 | | # define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ |
391 | | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) |
392 | | |
393 | | # define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ |
394 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) |
395 | | |
396 | | # define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ |
397 | | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) |
398 | | |
399 | | # define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ |
400 | | ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) |
401 | | |
402 | | # define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ |
403 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) |
404 | | |
405 | | # define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ |
406 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) |
407 | | |
408 | | /* EXPLICIT using indefinite length constructed form */ |
409 | | # define ASN1_NDEF_EXP(stname, field, type, tag) \ |
410 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) |
411 | | |
412 | | /* EXPLICIT OPTIONAL using indefinite length constructed form */ |
413 | | # define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ |
414 | | ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) |
415 | | |
416 | | /* Macros for the ASN1_ADB structure */ |
417 | | |
418 | | # define ASN1_ADB(name) \ |
419 | | static const ASN1_ADB_TABLE name##_adbtbl[] |
420 | | |
421 | | # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION |
422 | | |
423 | | # define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ |
424 | | ;\ |
425 | | static const ASN1_ADB name##_adb = {\ |
426 | | flags,\ |
427 | | offsetof(name, field),\ |
428 | | adb_cb,\ |
429 | | name##_adbtbl,\ |
430 | | sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ |
431 | | def,\ |
432 | | none\ |
433 | | } |
434 | | |
435 | | # else |
436 | | |
437 | | # define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ |
438 | | ;\ |
439 | | static const ASN1_ITEM *name##_adb(void) \ |
440 | | { \ |
441 | | static const ASN1_ADB internal_adb = \ |
442 | | {\ |
443 | | flags,\ |
444 | | offsetof(name, field),\ |
445 | | adb_cb,\ |
446 | | name##_adbtbl,\ |
447 | | sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ |
448 | | def,\ |
449 | | none\ |
450 | | }; \ |
451 | | return (const ASN1_ITEM *) &internal_adb; \ |
452 | | } \ |
453 | | void dummy_function(void) |
454 | | |
455 | | # endif |
456 | | |
457 | | # define ADB_ENTRY(val, template) {val, template} |
458 | | |
459 | | # define ASN1_ADB_TEMPLATE(name) \ |
460 | | static const ASN1_TEMPLATE name##_tt |
461 | | |
462 | | /* |
463 | | * This is the ASN1 template structure that defines a wrapper round the |
464 | | * actual type. It determines the actual position of the field in the value |
465 | | * structure, various flags such as OPTIONAL and the field name. |
466 | | */ |
467 | | |
468 | | struct ASN1_TEMPLATE_st { |
469 | | unsigned long flags; /* Various flags */ |
470 | | long tag; /* tag, not used if no tagging */ |
471 | | unsigned long offset; /* Offset of this field in structure */ |
472 | | const char *field_name; /* Field name */ |
473 | | ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ |
474 | | }; |
475 | | |
476 | | /* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ |
477 | | |
478 | | # define ASN1_TEMPLATE_item(t) (t->item_ptr) |
479 | | # define ASN1_TEMPLATE_adb(t) (t->item_ptr) |
480 | | |
481 | | typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; |
482 | | typedef struct ASN1_ADB_st ASN1_ADB; |
483 | | |
484 | | struct ASN1_ADB_st { |
485 | | unsigned long flags; /* Various flags */ |
486 | | unsigned long offset; /* Offset of selector field */ |
487 | | int (*adb_cb)(long *psel); /* Application callback */ |
488 | | const ASN1_ADB_TABLE *tbl; /* Table of possible types */ |
489 | | long tblcount; /* Number of entries in tbl */ |
490 | | const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ |
491 | | const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ |
492 | | }; |
493 | | |
494 | | struct ASN1_ADB_TABLE_st { |
495 | | long value; /* NID for an object or value for an int */ |
496 | | const ASN1_TEMPLATE tt; /* item for this value */ |
497 | | }; |
498 | | |
499 | | /* template flags */ |
500 | | |
501 | | /* Field is optional */ |
502 | 0 | # define ASN1_TFLG_OPTIONAL (0x1) |
503 | | |
504 | | /* Field is a SET OF */ |
505 | 0 | # define ASN1_TFLG_SET_OF (0x1 << 1) |
506 | | |
507 | | /* Field is a SEQUENCE OF */ |
508 | 0 | # define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) |
509 | | |
510 | | /* |
511 | | * Special case: this refers to a SET OF that will be sorted into DER order |
512 | | * when encoded *and* the corresponding STACK will be modified to match the |
513 | | * new order. |
514 | | */ |
515 | | # define ASN1_TFLG_SET_ORDER (0x3 << 1) |
516 | | |
517 | | /* Mask for SET OF or SEQUENCE OF */ |
518 | 0 | # define ASN1_TFLG_SK_MASK (0x3 << 1) |
519 | | |
520 | | /* |
521 | | * These flags mean the tag should be taken from the tag field. If EXPLICIT |
522 | | * then the underlying type is used for the inner tag. |
523 | | */ |
524 | | |
525 | | /* IMPLICIT tagging */ |
526 | 0 | # define ASN1_TFLG_IMPTAG (0x1 << 3) |
527 | | |
528 | | /* EXPLICIT tagging, inner tag from underlying type */ |
529 | 0 | # define ASN1_TFLG_EXPTAG (0x2 << 3) |
530 | | |
531 | 0 | # define ASN1_TFLG_TAG_MASK (0x3 << 3) |
532 | | |
533 | | /* context specific IMPLICIT */ |
534 | | # define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) |
535 | | |
536 | | /* context specific EXPLICIT */ |
537 | | # define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) |
538 | | |
539 | | /* |
540 | | * If tagging is in force these determine the type of tag to use. Otherwise |
541 | | * the tag is determined by the underlying type. These values reflect the |
542 | | * actual octet format. |
543 | | */ |
544 | | |
545 | | /* Universal tag */ |
546 | | # define ASN1_TFLG_UNIVERSAL (0x0<<6) |
547 | | /* Application tag */ |
548 | | # define ASN1_TFLG_APPLICATION (0x1<<6) |
549 | | /* Context specific tag */ |
550 | | # define ASN1_TFLG_CONTEXT (0x2<<6) |
551 | | /* Private tag */ |
552 | | # define ASN1_TFLG_PRIVATE (0x3<<6) |
553 | | |
554 | 0 | # define ASN1_TFLG_TAG_CLASS (0x3<<6) |
555 | | |
556 | | /* |
557 | | * These are for ANY DEFINED BY type. In this case the 'item' field points to |
558 | | * an ASN1_ADB structure which contains a table of values to decode the |
559 | | * relevant type |
560 | | */ |
561 | | |
562 | 0 | # define ASN1_TFLG_ADB_MASK (0x3<<8) |
563 | | |
564 | 0 | # define ASN1_TFLG_ADB_OID (0x1<<8) |
565 | | |
566 | | # define ASN1_TFLG_ADB_INT (0x1<<9) |
567 | | |
568 | | /* |
569 | | * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes |
570 | | * indefinite length constructed encoding to be used if required. |
571 | | */ |
572 | | |
573 | 966 | # define ASN1_TFLG_NDEF (0x1<<11) |
574 | | |
575 | | /* Field is embedded and not a pointer */ |
576 | 0 | # define ASN1_TFLG_EMBED (0x1 << 12) |
577 | | |
578 | | /* This is the actual ASN1 item itself */ |
579 | | |
580 | | struct ASN1_ITEM_st { |
581 | | char itype; /* The item type, primitive, SEQUENCE, CHOICE |
582 | | * or extern */ |
583 | | long utype; /* underlying type */ |
584 | | const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains |
585 | | * the contents */ |
586 | | long tcount; /* Number of templates if SEQUENCE or CHOICE */ |
587 | | const void *funcs; /* functions that handle this type */ |
588 | | long size; /* Structure size (usually) */ |
589 | | const char *sname; /* Structure name */ |
590 | | }; |
591 | | |
592 | | /*- |
593 | | * These are values for the itype field and |
594 | | * determine how the type is interpreted. |
595 | | * |
596 | | * For PRIMITIVE types the underlying type |
597 | | * determines the behaviour if items is NULL. |
598 | | * |
599 | | * Otherwise templates must contain a single |
600 | | * template and the type is treated in the |
601 | | * same way as the type specified in the template. |
602 | | * |
603 | | * For SEQUENCE types the templates field points |
604 | | * to the members, the size field is the |
605 | | * structure size. |
606 | | * |
607 | | * For CHOICE types the templates field points |
608 | | * to each possible member (typically a union) |
609 | | * and the 'size' field is the offset of the |
610 | | * selector. |
611 | | * |
612 | | * The 'funcs' field is used for application |
613 | | * specific functions. |
614 | | * |
615 | | * The EXTERN type uses a new style d2i/i2d. |
616 | | * The new style should be used where possible |
617 | | * because it avoids things like the d2i IMPLICIT |
618 | | * hack. |
619 | | * |
620 | | * MSTRING is a multiple string type, it is used |
621 | | * for a CHOICE of character strings where the |
622 | | * actual strings all occupy an ASN1_STRING |
623 | | * structure. In this case the 'utype' field |
624 | | * has a special meaning, it is used as a mask |
625 | | * of acceptable types using the B_ASN1 constants. |
626 | | * |
627 | | * NDEF_SEQUENCE is the same as SEQUENCE except |
628 | | * that it will use indefinite length constructed |
629 | | * encoding if requested. |
630 | | * |
631 | | */ |
632 | | |
633 | 5.14k | # define ASN1_ITYPE_PRIMITIVE 0x0 |
634 | | |
635 | 0 | # define ASN1_ITYPE_SEQUENCE 0x1 |
636 | | |
637 | 0 | # define ASN1_ITYPE_CHOICE 0x2 |
638 | | |
639 | 0 | # define ASN1_ITYPE_EXTERN 0x4 |
640 | | |
641 | 3.20k | # define ASN1_ITYPE_MSTRING 0x5 |
642 | | |
643 | 0 | # define ASN1_ITYPE_NDEF_SEQUENCE 0x6 |
644 | | |
645 | | /* |
646 | | * Cache for ASN1 tag and length, so we don't keep re-reading it for things |
647 | | * like CHOICE |
648 | | */ |
649 | | |
650 | | struct ASN1_TLC_st { |
651 | | char valid; /* Values below are valid */ |
652 | | int ret; /* return value */ |
653 | | long plen; /* length */ |
654 | | int ptag; /* class value */ |
655 | | int pclass; /* class value */ |
656 | | int hdrlen; /* header length */ |
657 | | }; |
658 | | |
659 | | /* Typedefs for ASN1 function pointers */ |
660 | | typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, |
661 | | const ASN1_ITEM *it, int tag, int aclass, char opt, |
662 | | ASN1_TLC *ctx); |
663 | | |
664 | | typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, |
665 | | const ASN1_ITEM *it, int tag, int aclass); |
666 | | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
667 | | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
668 | | |
669 | | typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, |
670 | | int indent, const char *fname, |
671 | | const ASN1_PCTX *pctx); |
672 | | |
673 | | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, |
674 | | int *putype, const ASN1_ITEM *it); |
675 | | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, |
676 | | int len, int utype, char *free_cont, |
677 | | const ASN1_ITEM *it); |
678 | | typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, |
679 | | const ASN1_ITEM *it, int indent, |
680 | | const ASN1_PCTX *pctx); |
681 | | |
682 | | typedef struct ASN1_EXTERN_FUNCS_st { |
683 | | void *app_data; |
684 | | ASN1_ex_new_func *asn1_ex_new; |
685 | | ASN1_ex_free_func *asn1_ex_free; |
686 | | ASN1_ex_free_func *asn1_ex_clear; |
687 | | ASN1_ex_d2i *asn1_ex_d2i; |
688 | | ASN1_ex_i2d *asn1_ex_i2d; |
689 | | ASN1_ex_print_func *asn1_ex_print; |
690 | | } ASN1_EXTERN_FUNCS; |
691 | | |
692 | | typedef struct ASN1_PRIMITIVE_FUNCS_st { |
693 | | void *app_data; |
694 | | unsigned long flags; |
695 | | ASN1_ex_new_func *prim_new; |
696 | | ASN1_ex_free_func *prim_free; |
697 | | ASN1_ex_free_func *prim_clear; |
698 | | ASN1_primitive_c2i *prim_c2i; |
699 | | ASN1_primitive_i2c *prim_i2c; |
700 | | ASN1_primitive_print *prim_print; |
701 | | } ASN1_PRIMITIVE_FUNCS; |
702 | | |
703 | | /* |
704 | | * This is the ASN1_AUX structure: it handles various miscellaneous |
705 | | * requirements. For example the use of reference counts and an informational |
706 | | * callback. The "informational callback" is called at various points during |
707 | | * the ASN1 encoding and decoding. It can be used to provide minor |
708 | | * customisation of the structures used. This is most useful where the |
709 | | * supplied routines *almost* do the right thing but need some extra help at |
710 | | * a few points. If the callback returns zero then it is assumed a fatal |
711 | | * error has occurred and the main operation should be abandoned. If major |
712 | | * changes in the default behaviour are required then an external type is |
713 | | * more appropriate. |
714 | | */ |
715 | | |
716 | | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, |
717 | | void *exarg); |
718 | | |
719 | | typedef struct ASN1_AUX_st { |
720 | | void *app_data; |
721 | | int flags; |
722 | | int ref_offset; /* Offset of reference value */ |
723 | | int ref_lock; /* Lock type to use */ |
724 | | ASN1_aux_cb *asn1_cb; |
725 | | int enc_offset; /* Offset of ASN1_ENCODING structure */ |
726 | | } ASN1_AUX; |
727 | | |
728 | | /* For print related callbacks exarg points to this structure */ |
729 | | typedef struct ASN1_PRINT_ARG_st { |
730 | | BIO *out; |
731 | | int indent; |
732 | | const ASN1_PCTX *pctx; |
733 | | } ASN1_PRINT_ARG; |
734 | | |
735 | | /* For streaming related callbacks exarg points to this structure */ |
736 | | typedef struct ASN1_STREAM_ARG_st { |
737 | | /* BIO to stream through */ |
738 | | BIO *out; |
739 | | /* BIO with filters appended */ |
740 | | BIO *ndef_bio; |
741 | | /* Streaming I/O boundary */ |
742 | | unsigned char **boundary; |
743 | | } ASN1_STREAM_ARG; |
744 | | |
745 | | /* Flags in ASN1_AUX */ |
746 | | |
747 | | /* Use a reference count */ |
748 | 0 | # define ASN1_AFLG_REFCOUNT 1 |
749 | | /* Save the encoding of structure (useful for signatures) */ |
750 | 0 | # define ASN1_AFLG_ENCODING 2 |
751 | | /* The Sequence length is invalid */ |
752 | 0 | # define ASN1_AFLG_BROKEN 4 |
753 | | |
754 | | /* operation values for asn1_cb */ |
755 | | |
756 | 0 | # define ASN1_OP_NEW_PRE 0 |
757 | 0 | # define ASN1_OP_NEW_POST 1 |
758 | 0 | # define ASN1_OP_FREE_PRE 2 |
759 | 0 | # define ASN1_OP_FREE_POST 3 |
760 | 0 | # define ASN1_OP_D2I_PRE 4 |
761 | 0 | # define ASN1_OP_D2I_POST 5 |
762 | 0 | # define ASN1_OP_I2D_PRE 6 |
763 | 0 | # define ASN1_OP_I2D_POST 7 |
764 | 0 | # define ASN1_OP_PRINT_PRE 8 |
765 | 0 | # define ASN1_OP_PRINT_POST 9 |
766 | 0 | # define ASN1_OP_STREAM_PRE 10 |
767 | 0 | # define ASN1_OP_STREAM_POST 11 |
768 | 0 | # define ASN1_OP_DETACHED_PRE 12 |
769 | 0 | # define ASN1_OP_DETACHED_POST 13 |
770 | | |
771 | | /* Macro to implement a primitive type */ |
772 | | # define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) |
773 | | # define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ |
774 | | ASN1_ITEM_start(itname) \ |
775 | | ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ |
776 | | ASN1_ITEM_end(itname) |
777 | | |
778 | | /* Macro to implement a multi string type */ |
779 | | # define IMPLEMENT_ASN1_MSTRING(itname, mask) \ |
780 | | ASN1_ITEM_start(itname) \ |
781 | | ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ |
782 | | ASN1_ITEM_end(itname) |
783 | | |
784 | | # define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ |
785 | | ASN1_ITEM_start(sname) \ |
786 | | ASN1_ITYPE_EXTERN, \ |
787 | | tag, \ |
788 | | NULL, \ |
789 | | 0, \ |
790 | | &fptrs, \ |
791 | | 0, \ |
792 | | #sname \ |
793 | | ASN1_ITEM_end(sname) |
794 | | |
795 | | /* Macro to implement standard functions in terms of ASN1_ITEM structures */ |
796 | | |
797 | | # define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) |
798 | | |
799 | | # define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) |
800 | | |
801 | | # define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ |
802 | | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) |
803 | | |
804 | | # define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ |
805 | | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) |
806 | | |
807 | | # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ |
808 | | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) |
809 | | |
810 | | # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ |
811 | | pre stname *fname##_new(void) \ |
812 | | { \ |
813 | | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ |
814 | | } \ |
815 | | pre void fname##_free(stname *a) \ |
816 | | { \ |
817 | | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ |
818 | | } |
819 | | |
820 | | # define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ |
821 | | stname *fname##_new(void) \ |
822 | 0 | { \ |
823 | 0 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ |
824 | 0 | } \ Unexecuted instantiation: X509_ATTRIBUTE_new Unexecuted instantiation: X509_EXTENSION_new Unexecuted instantiation: X509_NAME_ENTRY_new Unexecuted instantiation: X509_NAME_new Unexecuted instantiation: X509_PUBKEY_new Unexecuted instantiation: X509_CINF_new Unexecuted instantiation: X509_new Unexecuted instantiation: X509_CERT_AUX_new Unexecuted instantiation: IPAddressRange_new Unexecuted instantiation: IPAddressOrRange_new Unexecuted instantiation: IPAddressChoice_new Unexecuted instantiation: IPAddressFamily_new Unexecuted instantiation: AUTHORITY_KEYID_new Unexecuted instantiation: ASRange_new Unexecuted instantiation: ASIdOrRange_new Unexecuted instantiation: ASIdentifierChoice_new Unexecuted instantiation: ASIdentifiers_new Unexecuted instantiation: CERTIFICATEPOLICIES_new Unexecuted instantiation: POLICYINFO_new Unexecuted instantiation: POLICYQUALINFO_new Unexecuted instantiation: USERNOTICE_new Unexecuted instantiation: NOTICEREF_new Unexecuted instantiation: DIST_POINT_NAME_new Unexecuted instantiation: DIST_POINT_new Unexecuted instantiation: CRL_DIST_POINTS_new Unexecuted instantiation: ISSUING_DIST_POINT_new Unexecuted instantiation: OTHERNAME_new Unexecuted instantiation: EDIPARTYNAME_new Unexecuted instantiation: GENERAL_NAME_new Unexecuted instantiation: GENERAL_NAMES_new Unexecuted instantiation: GENERAL_SUBTREE_new Unexecuted instantiation: NAME_CONSTRAINTS_new Unexecuted instantiation: PROXY_POLICY_new Unexecuted instantiation: PROXY_CERT_INFO_EXTENSION_new Unexecuted instantiation: POLICY_CONSTRAINTS_new Unexecuted instantiation: PKEY_USAGE_PERIOD_new Unexecuted instantiation: POLICY_MAPPING_new Unexecuted instantiation: SXNETID_new Unexecuted instantiation: SXNET_new Unexecuted instantiation: TLS_FEATURE_new Unexecuted instantiation: ASN1_TIME_new Unexecuted instantiation: ASN1_NULL_new Unexecuted instantiation: ASN1_TYPE_new Unexecuted instantiation: ASN1_PRINTABLE_new Unexecuted instantiation: DISPLAYTEXT_new Unexecuted instantiation: DIRECTORYSTRING_new Unexecuted instantiation: X509_ALGOR_new Unexecuted instantiation: X509_SIG_new Unexecuted instantiation: X509_VAL_new Unexecuted instantiation: X9_62_PENTANOMIAL_new Unexecuted instantiation: X9_62_CHARACTERISTIC_TWO_new Unexecuted instantiation: ECPARAMETERS_new Unexecuted instantiation: ECPKPARAMETERS_new Unexecuted instantiation: EC_PRIVATEKEY_new Unexecuted instantiation: RSA_PSS_PARAMS_new Unexecuted instantiation: RSA_OAEP_PARAMS_new Unexecuted instantiation: SM2_Ciphertext_new Unexecuted instantiation: X509_REVOKED_new Unexecuted instantiation: X509_CRL_INFO_new Unexecuted instantiation: X509_CRL_new Unexecuted instantiation: X509_REQ_INFO_new Unexecuted instantiation: X509_REQ_new Unexecuted instantiation: NAMING_AUTHORITY_new Unexecuted instantiation: PROFESSION_INFO_new Unexecuted instantiation: ADMISSIONS_new Unexecuted instantiation: ADMISSION_SYNTAX_new Unexecuted instantiation: BASIC_CONSTRAINTS_new Unexecuted instantiation: EXTENDED_KEY_USAGE_new Unexecuted instantiation: ACCESS_DESCRIPTION_new Unexecuted instantiation: AUTHORITY_INFO_ACCESS_new Unexecuted instantiation: PBEPARAM_new Unexecuted instantiation: PBE2PARAM_new Unexecuted instantiation: PBKDF2PARAM_new Unexecuted instantiation: SCRYPT_PARAMS_new Unexecuted instantiation: PKCS8_PRIV_KEY_INFO_new Unexecuted instantiation: NETSCAPE_SPKAC_new Unexecuted instantiation: NETSCAPE_SPKI_new Unexecuted instantiation: CMS_ContentInfo_new Unexecuted instantiation: OCSP_SIGNATURE_new Unexecuted instantiation: OCSP_CERTID_new Unexecuted instantiation: OCSP_ONEREQ_new Unexecuted instantiation: OCSP_REQINFO_new Unexecuted instantiation: OCSP_REQUEST_new Unexecuted instantiation: OCSP_RESPBYTES_new Unexecuted instantiation: OCSP_RESPONSE_new Unexecuted instantiation: OCSP_RESPID_new Unexecuted instantiation: OCSP_REVOKEDINFO_new Unexecuted instantiation: OCSP_CERTSTATUS_new Unexecuted instantiation: OCSP_SINGLERESP_new Unexecuted instantiation: OCSP_RESPDATA_new Unexecuted instantiation: OCSP_BASICRESP_new Unexecuted instantiation: OCSP_CRLID_new Unexecuted instantiation: OCSP_SERVICELOC_new Unexecuted instantiation: PKCS12_new Unexecuted instantiation: PKCS12_MAC_DATA_new Unexecuted instantiation: PKCS12_BAGS_new Unexecuted instantiation: PKCS12_SAFEBAG_new Unexecuted instantiation: PKCS7_new Unexecuted instantiation: PKCS7_SIGNED_new Unexecuted instantiation: PKCS7_SIGNER_INFO_new Unexecuted instantiation: PKCS7_ISSUER_AND_SERIAL_new Unexecuted instantiation: PKCS7_ENVELOPE_new Unexecuted instantiation: PKCS7_RECIP_INFO_new Unexecuted instantiation: PKCS7_ENC_CONTENT_new Unexecuted instantiation: PKCS7_SIGN_ENVELOPE_new Unexecuted instantiation: PKCS7_ENCRYPT_new Unexecuted instantiation: PKCS7_DIGEST_new |
825 | | void fname##_free(stname *a) \ |
826 | 0 | { \ |
827 | 0 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ |
828 | 0 | } Unexecuted instantiation: X509_ATTRIBUTE_free Unexecuted instantiation: X509_EXTENSION_free Unexecuted instantiation: X509_NAME_ENTRY_free Unexecuted instantiation: X509_NAME_free Unexecuted instantiation: X509_PUBKEY_free Unexecuted instantiation: X509_CINF_free Unexecuted instantiation: X509_free Unexecuted instantiation: X509_CERT_AUX_free Unexecuted instantiation: IPAddressRange_free Unexecuted instantiation: IPAddressOrRange_free Unexecuted instantiation: IPAddressChoice_free Unexecuted instantiation: IPAddressFamily_free Unexecuted instantiation: AUTHORITY_KEYID_free Unexecuted instantiation: ASRange_free Unexecuted instantiation: ASIdOrRange_free Unexecuted instantiation: ASIdentifierChoice_free Unexecuted instantiation: ASIdentifiers_free Unexecuted instantiation: CERTIFICATEPOLICIES_free Unexecuted instantiation: POLICYINFO_free Unexecuted instantiation: POLICYQUALINFO_free Unexecuted instantiation: USERNOTICE_free Unexecuted instantiation: NOTICEREF_free Unexecuted instantiation: DIST_POINT_NAME_free Unexecuted instantiation: DIST_POINT_free Unexecuted instantiation: CRL_DIST_POINTS_free Unexecuted instantiation: ISSUING_DIST_POINT_free Unexecuted instantiation: OTHERNAME_free Unexecuted instantiation: EDIPARTYNAME_free Unexecuted instantiation: GENERAL_NAME_free Unexecuted instantiation: GENERAL_NAMES_free Unexecuted instantiation: GENERAL_SUBTREE_free Unexecuted instantiation: NAME_CONSTRAINTS_free Unexecuted instantiation: PROXY_POLICY_free Unexecuted instantiation: PROXY_CERT_INFO_EXTENSION_free Unexecuted instantiation: POLICY_CONSTRAINTS_free Unexecuted instantiation: PKEY_USAGE_PERIOD_free Unexecuted instantiation: POLICY_MAPPING_free Unexecuted instantiation: SXNETID_free Unexecuted instantiation: SXNET_free Unexecuted instantiation: TLS_FEATURE_free Unexecuted instantiation: ASN1_TIME_free Unexecuted instantiation: ASN1_NULL_free Unexecuted instantiation: ASN1_TYPE_free Unexecuted instantiation: ASN1_PRINTABLE_free Unexecuted instantiation: DISPLAYTEXT_free Unexecuted instantiation: DIRECTORYSTRING_free Unexecuted instantiation: X509_ALGOR_free Unexecuted instantiation: X509_SIG_free Unexecuted instantiation: X509_VAL_free Unexecuted instantiation: X9_62_PENTANOMIAL_free Unexecuted instantiation: X9_62_CHARACTERISTIC_TWO_free Unexecuted instantiation: ECPARAMETERS_free Unexecuted instantiation: ECPKPARAMETERS_free Unexecuted instantiation: EC_PRIVATEKEY_free Unexecuted instantiation: RSA_PSS_PARAMS_free Unexecuted instantiation: RSA_OAEP_PARAMS_free Unexecuted instantiation: SM2_Ciphertext_free Unexecuted instantiation: X509_REVOKED_free Unexecuted instantiation: X509_CRL_INFO_free Unexecuted instantiation: X509_CRL_free Unexecuted instantiation: X509_REQ_INFO_free Unexecuted instantiation: X509_REQ_free Unexecuted instantiation: NAMING_AUTHORITY_free Unexecuted instantiation: PROFESSION_INFO_free Unexecuted instantiation: ADMISSIONS_free Unexecuted instantiation: ADMISSION_SYNTAX_free Unexecuted instantiation: BASIC_CONSTRAINTS_free Unexecuted instantiation: EXTENDED_KEY_USAGE_free Unexecuted instantiation: ACCESS_DESCRIPTION_free Unexecuted instantiation: AUTHORITY_INFO_ACCESS_free Unexecuted instantiation: PBEPARAM_free Unexecuted instantiation: PBE2PARAM_free Unexecuted instantiation: PBKDF2PARAM_free Unexecuted instantiation: SCRYPT_PARAMS_free Unexecuted instantiation: PKCS8_PRIV_KEY_INFO_free Unexecuted instantiation: NETSCAPE_SPKAC_free Unexecuted instantiation: NETSCAPE_SPKI_free Unexecuted instantiation: CMS_ContentInfo_free Unexecuted instantiation: OCSP_SIGNATURE_free Unexecuted instantiation: OCSP_CERTID_free Unexecuted instantiation: OCSP_ONEREQ_free Unexecuted instantiation: OCSP_REQINFO_free Unexecuted instantiation: OCSP_REQUEST_free Unexecuted instantiation: OCSP_RESPBYTES_free Unexecuted instantiation: OCSP_RESPONSE_free Unexecuted instantiation: OCSP_RESPID_free Unexecuted instantiation: OCSP_REVOKEDINFO_free Unexecuted instantiation: OCSP_CERTSTATUS_free Unexecuted instantiation: OCSP_SINGLERESP_free Unexecuted instantiation: OCSP_RESPDATA_free Unexecuted instantiation: OCSP_BASICRESP_free Unexecuted instantiation: OCSP_CRLID_free Unexecuted instantiation: OCSP_SERVICELOC_free Unexecuted instantiation: PKCS12_free Unexecuted instantiation: PKCS12_MAC_DATA_free Unexecuted instantiation: PKCS12_BAGS_free Unexecuted instantiation: PKCS12_SAFEBAG_free Unexecuted instantiation: PKCS7_free Unexecuted instantiation: PKCS7_SIGNED_free Unexecuted instantiation: PKCS7_SIGNER_INFO_free Unexecuted instantiation: PKCS7_ISSUER_AND_SERIAL_free Unexecuted instantiation: PKCS7_ENVELOPE_free Unexecuted instantiation: PKCS7_RECIP_INFO_free Unexecuted instantiation: PKCS7_ENC_CONTENT_free Unexecuted instantiation: PKCS7_SIGN_ENVELOPE_free Unexecuted instantiation: PKCS7_ENCRYPT_free Unexecuted instantiation: PKCS7_DIGEST_free |
829 | | |
830 | | # define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ |
831 | | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ |
832 | | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) |
833 | | |
834 | | # define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ |
835 | | stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ |
836 | 1.59k | { \ |
837 | 1.59k | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ |
838 | 1.59k | } \ Unexecuted instantiation: d2i_X509_ATTRIBUTE Unexecuted instantiation: d2i_X509_EXTENSION Unexecuted instantiation: d2i_X509_EXTENSIONS Unexecuted instantiation: d2i_X509_NAME_ENTRY Unexecuted instantiation: d2i_X509_NAME Unexecuted instantiation: d2i_X509_PUBKEY Unexecuted instantiation: d2i_X509_CINF Unexecuted instantiation: d2i_X509 Unexecuted instantiation: d2i_X509_CERT_AUX Unexecuted instantiation: d2i_IPAddressRange Unexecuted instantiation: d2i_IPAddressOrRange Unexecuted instantiation: d2i_IPAddressChoice Unexecuted instantiation: d2i_IPAddressFamily Unexecuted instantiation: d2i_AUTHORITY_KEYID Unexecuted instantiation: d2i_ASRange Unexecuted instantiation: d2i_ASIdOrRange Unexecuted instantiation: d2i_ASIdentifierChoice Unexecuted instantiation: d2i_ASIdentifiers Unexecuted instantiation: d2i_CERTIFICATEPOLICIES Unexecuted instantiation: d2i_POLICYINFO Unexecuted instantiation: d2i_POLICYQUALINFO Unexecuted instantiation: d2i_USERNOTICE Unexecuted instantiation: d2i_NOTICEREF Unexecuted instantiation: d2i_DIST_POINT_NAME Unexecuted instantiation: d2i_DIST_POINT Unexecuted instantiation: d2i_CRL_DIST_POINTS Unexecuted instantiation: d2i_ISSUING_DIST_POINT Unexecuted instantiation: d2i_OTHERNAME Unexecuted instantiation: d2i_EDIPARTYNAME Unexecuted instantiation: d2i_GENERAL_NAME Unexecuted instantiation: d2i_GENERAL_NAMES Unexecuted instantiation: d2i_PROXY_POLICY Unexecuted instantiation: d2i_PROXY_CERT_INFO_EXTENSION Unexecuted instantiation: d2i_PKEY_USAGE_PERIOD Unexecuted instantiation: d2i_SXNETID Unexecuted instantiation: d2i_SXNET Unexecuted instantiation: d2i_ASN1_TIME Line | Count | Source | 836 | 1.59k | { \ | 837 | 1.59k | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ | 838 | 1.59k | } \ |
Unexecuted instantiation: d2i_ASN1_INTEGER Unexecuted instantiation: d2i_ASN1_ENUMERATED Unexecuted instantiation: d2i_ASN1_BIT_STRING Unexecuted instantiation: d2i_ASN1_UTF8STRING Unexecuted instantiation: d2i_ASN1_PRINTABLESTRING Unexecuted instantiation: d2i_ASN1_T61STRING Unexecuted instantiation: d2i_ASN1_IA5STRING Unexecuted instantiation: d2i_ASN1_GENERALSTRING Unexecuted instantiation: d2i_ASN1_UTCTIME Unexecuted instantiation: d2i_ASN1_GENERALIZEDTIME Unexecuted instantiation: d2i_ASN1_VISIBLESTRING Unexecuted instantiation: d2i_ASN1_UNIVERSALSTRING Unexecuted instantiation: d2i_ASN1_BMPSTRING Unexecuted instantiation: d2i_ASN1_NULL Unexecuted instantiation: d2i_ASN1_TYPE Unexecuted instantiation: d2i_ASN1_PRINTABLE Unexecuted instantiation: d2i_DISPLAYTEXT Unexecuted instantiation: d2i_DIRECTORYSTRING Unexecuted instantiation: d2i_X509_ALGOR Unexecuted instantiation: d2i_X509_ALGORS Unexecuted instantiation: d2i_X509_SIG Unexecuted instantiation: d2i_X509_VAL Unexecuted instantiation: d2i_RSA_PSS_PARAMS Unexecuted instantiation: d2i_RSA_OAEP_PARAMS Unexecuted instantiation: d2i_SM2_Ciphertext Unexecuted instantiation: d2i_X509_REVOKED Unexecuted instantiation: d2i_X509_CRL_INFO Unexecuted instantiation: d2i_X509_CRL Unexecuted instantiation: d2i_X509_REQ_INFO Unexecuted instantiation: d2i_X509_REQ Unexecuted instantiation: d2i_NAMING_AUTHORITY Unexecuted instantiation: d2i_PROFESSION_INFO Unexecuted instantiation: d2i_ADMISSIONS Unexecuted instantiation: d2i_ADMISSION_SYNTAX Unexecuted instantiation: d2i_BASIC_CONSTRAINTS Unexecuted instantiation: d2i_EXTENDED_KEY_USAGE Unexecuted instantiation: d2i_ACCESS_DESCRIPTION Unexecuted instantiation: d2i_AUTHORITY_INFO_ACCESS Unexecuted instantiation: d2i_PBEPARAM Unexecuted instantiation: d2i_PBE2PARAM Unexecuted instantiation: d2i_PBKDF2PARAM Unexecuted instantiation: d2i_SCRYPT_PARAMS Unexecuted instantiation: d2i_PKCS8_PRIV_KEY_INFO Unexecuted instantiation: d2i_NETSCAPE_SPKAC Unexecuted instantiation: d2i_NETSCAPE_SPKI Unexecuted instantiation: d2i_CMS_ContentInfo Unexecuted instantiation: d2i_OCSP_SIGNATURE Unexecuted instantiation: d2i_OCSP_CERTID Unexecuted instantiation: d2i_OCSP_ONEREQ Unexecuted instantiation: d2i_OCSP_REQINFO Unexecuted instantiation: d2i_OCSP_REQUEST Unexecuted instantiation: d2i_OCSP_RESPBYTES Unexecuted instantiation: d2i_OCSP_RESPONSE Unexecuted instantiation: d2i_OCSP_RESPID Unexecuted instantiation: d2i_OCSP_REVOKEDINFO Unexecuted instantiation: d2i_OCSP_CERTSTATUS Unexecuted instantiation: d2i_OCSP_SINGLERESP Unexecuted instantiation: d2i_OCSP_RESPDATA Unexecuted instantiation: d2i_OCSP_BASICRESP Unexecuted instantiation: d2i_OCSP_CRLID Unexecuted instantiation: d2i_OCSP_SERVICELOC Unexecuted instantiation: d2i_PKCS12 Unexecuted instantiation: d2i_PKCS12_MAC_DATA Unexecuted instantiation: d2i_PKCS12_BAGS Unexecuted instantiation: d2i_PKCS12_SAFEBAG Unexecuted instantiation: d2i_PKCS7 Unexecuted instantiation: d2i_PKCS7_SIGNED Unexecuted instantiation: d2i_PKCS7_SIGNER_INFO Unexecuted instantiation: d2i_PKCS7_ISSUER_AND_SERIAL Unexecuted instantiation: d2i_PKCS7_ENVELOPE Unexecuted instantiation: d2i_PKCS7_RECIP_INFO Unexecuted instantiation: d2i_PKCS7_ENC_CONTENT Unexecuted instantiation: d2i_PKCS7_SIGN_ENVELOPE Unexecuted instantiation: d2i_PKCS7_ENCRYPT Unexecuted instantiation: d2i_PKCS7_DIGEST |
839 | | int i2d_##fname(stname *a, unsigned char **out) \ |
840 | 322 | { \ |
841 | 322 | return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ |
842 | 322 | } Unexecuted instantiation: i2d_X509_ATTRIBUTE Unexecuted instantiation: i2d_X509_EXTENSION Unexecuted instantiation: i2d_X509_EXTENSIONS Unexecuted instantiation: i2d_X509_NAME_ENTRY Unexecuted instantiation: i2d_X509_NAME Unexecuted instantiation: i2d_X509_PUBKEY Unexecuted instantiation: i2d_X509_CINF Unexecuted instantiation: i2d_X509 Unexecuted instantiation: i2d_X509_CERT_AUX Unexecuted instantiation: i2d_IPAddressRange Unexecuted instantiation: i2d_IPAddressOrRange Unexecuted instantiation: i2d_IPAddressChoice Unexecuted instantiation: i2d_IPAddressFamily Unexecuted instantiation: i2d_AUTHORITY_KEYID Unexecuted instantiation: i2d_ASRange Unexecuted instantiation: i2d_ASIdOrRange Unexecuted instantiation: i2d_ASIdentifierChoice Unexecuted instantiation: i2d_ASIdentifiers Unexecuted instantiation: i2d_CERTIFICATEPOLICIES Unexecuted instantiation: i2d_POLICYINFO Unexecuted instantiation: i2d_POLICYQUALINFO Unexecuted instantiation: i2d_USERNOTICE Unexecuted instantiation: i2d_NOTICEREF Unexecuted instantiation: i2d_DIST_POINT_NAME Unexecuted instantiation: i2d_DIST_POINT Unexecuted instantiation: i2d_CRL_DIST_POINTS Unexecuted instantiation: i2d_ISSUING_DIST_POINT Unexecuted instantiation: i2d_OTHERNAME Unexecuted instantiation: i2d_EDIPARTYNAME Unexecuted instantiation: i2d_GENERAL_NAME Unexecuted instantiation: i2d_GENERAL_NAMES Unexecuted instantiation: i2d_PROXY_POLICY Unexecuted instantiation: i2d_PROXY_CERT_INFO_EXTENSION Unexecuted instantiation: i2d_PKEY_USAGE_PERIOD Unexecuted instantiation: i2d_SXNETID Unexecuted instantiation: i2d_SXNET Unexecuted instantiation: i2d_ASN1_TIME Line | Count | Source | 840 | 322 | { \ | 841 | 322 | return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ | 842 | 322 | } |
Unexecuted instantiation: i2d_ASN1_INTEGER Unexecuted instantiation: i2d_ASN1_ENUMERATED Unexecuted instantiation: i2d_ASN1_BIT_STRING Unexecuted instantiation: i2d_ASN1_UTF8STRING Unexecuted instantiation: i2d_ASN1_PRINTABLESTRING Unexecuted instantiation: i2d_ASN1_T61STRING Unexecuted instantiation: i2d_ASN1_IA5STRING Unexecuted instantiation: i2d_ASN1_GENERALSTRING Unexecuted instantiation: i2d_ASN1_UTCTIME Unexecuted instantiation: i2d_ASN1_GENERALIZEDTIME Unexecuted instantiation: i2d_ASN1_VISIBLESTRING Unexecuted instantiation: i2d_ASN1_UNIVERSALSTRING Unexecuted instantiation: i2d_ASN1_BMPSTRING Unexecuted instantiation: i2d_ASN1_NULL Unexecuted instantiation: i2d_ASN1_TYPE Unexecuted instantiation: i2d_ASN1_PRINTABLE Unexecuted instantiation: i2d_DISPLAYTEXT Unexecuted instantiation: i2d_DIRECTORYSTRING Unexecuted instantiation: i2d_X509_ALGOR Unexecuted instantiation: i2d_X509_ALGORS Unexecuted instantiation: i2d_X509_SIG Unexecuted instantiation: i2d_X509_VAL Unexecuted instantiation: i2d_RSA_PSS_PARAMS Unexecuted instantiation: i2d_RSA_OAEP_PARAMS Unexecuted instantiation: i2d_SM2_Ciphertext Unexecuted instantiation: i2d_X509_REVOKED Unexecuted instantiation: i2d_X509_CRL_INFO Unexecuted instantiation: i2d_X509_CRL Unexecuted instantiation: i2d_X509_REQ_INFO Unexecuted instantiation: i2d_X509_REQ Unexecuted instantiation: i2d_NAMING_AUTHORITY Unexecuted instantiation: i2d_PROFESSION_INFO Unexecuted instantiation: i2d_ADMISSIONS Unexecuted instantiation: i2d_ADMISSION_SYNTAX Unexecuted instantiation: i2d_BASIC_CONSTRAINTS Unexecuted instantiation: i2d_EXTENDED_KEY_USAGE Unexecuted instantiation: i2d_ACCESS_DESCRIPTION Unexecuted instantiation: i2d_AUTHORITY_INFO_ACCESS Unexecuted instantiation: i2d_PBEPARAM Unexecuted instantiation: i2d_PBE2PARAM Unexecuted instantiation: i2d_PBKDF2PARAM Unexecuted instantiation: i2d_SCRYPT_PARAMS Unexecuted instantiation: i2d_PKCS8_PRIV_KEY_INFO Unexecuted instantiation: i2d_NETSCAPE_SPKAC Unexecuted instantiation: i2d_NETSCAPE_SPKI Unexecuted instantiation: i2d_CMS_ContentInfo Unexecuted instantiation: i2d_OCSP_SIGNATURE Unexecuted instantiation: i2d_OCSP_CERTID Unexecuted instantiation: i2d_OCSP_ONEREQ Unexecuted instantiation: i2d_OCSP_REQINFO Unexecuted instantiation: i2d_OCSP_REQUEST Unexecuted instantiation: i2d_OCSP_RESPBYTES Unexecuted instantiation: i2d_OCSP_RESPONSE Unexecuted instantiation: i2d_OCSP_RESPID Unexecuted instantiation: i2d_OCSP_REVOKEDINFO Unexecuted instantiation: i2d_OCSP_CERTSTATUS Unexecuted instantiation: i2d_OCSP_SINGLERESP Unexecuted instantiation: i2d_OCSP_RESPDATA Unexecuted instantiation: i2d_OCSP_BASICRESP Unexecuted instantiation: i2d_OCSP_CRLID Unexecuted instantiation: i2d_OCSP_SERVICELOC Unexecuted instantiation: i2d_PKCS12 Unexecuted instantiation: i2d_PKCS12_MAC_DATA Unexecuted instantiation: i2d_PKCS12_BAGS Unexecuted instantiation: i2d_PKCS12_SAFEBAG Unexecuted instantiation: i2d_PKCS7 Unexecuted instantiation: i2d_PKCS7_SIGNED Unexecuted instantiation: i2d_PKCS7_SIGNER_INFO Unexecuted instantiation: i2d_PKCS7_ISSUER_AND_SERIAL Unexecuted instantiation: i2d_PKCS7_ENVELOPE Unexecuted instantiation: i2d_PKCS7_RECIP_INFO Unexecuted instantiation: i2d_PKCS7_ENC_CONTENT Unexecuted instantiation: i2d_PKCS7_SIGN_ENVELOPE Unexecuted instantiation: i2d_PKCS7_ENCRYPT Unexecuted instantiation: i2d_PKCS7_DIGEST |
843 | | |
844 | | # define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ |
845 | | int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ |
846 | 0 | { \ |
847 | 0 | return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ |
848 | 0 | } |
849 | | |
850 | | # define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ |
851 | | static stname *d2i_##stname(stname **a, \ |
852 | | const unsigned char **in, long len) \ |
853 | | { \ |
854 | | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ |
855 | | ASN1_ITEM_rptr(stname)); \ |
856 | | } \ |
857 | | static int i2d_##stname(stname *a, unsigned char **out) \ |
858 | | { \ |
859 | | return ASN1_item_i2d((ASN1_VALUE *)a, out, \ |
860 | | ASN1_ITEM_rptr(stname)); \ |
861 | | } |
862 | | |
863 | | /* |
864 | | * This includes evil casts to remove const: they will go away when full ASN1 |
865 | | * constification is done. |
866 | | */ |
867 | | # define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ |
868 | | stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ |
869 | 0 | { \ |
870 | 0 | return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ |
871 | 0 | } \ Unexecuted instantiation: d2i_ASN1_SEQUENCE_ANY Unexecuted instantiation: d2i_ASN1_SET_ANY Unexecuted instantiation: d2i_DHparams Unexecuted instantiation: d2i_int_dhx Unexecuted instantiation: d2i_DSA_SIG Unexecuted instantiation: d2i_DSAPrivateKey Unexecuted instantiation: d2i_DSAparams Unexecuted instantiation: d2i_DSAPublicKey Unexecuted instantiation: d2i_ECPKPARAMETERS Unexecuted instantiation: d2i_EC_PRIVATEKEY Unexecuted instantiation: d2i_ECDSA_SIG Unexecuted instantiation: d2i_RSAPrivateKey Unexecuted instantiation: d2i_RSAPublicKey |
872 | | int i2d_##fname(const stname *a, unsigned char **out) \ |
873 | 0 | { \ |
874 | 0 | return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ |
875 | 0 | } Unexecuted instantiation: i2d_ASN1_SEQUENCE_ANY Unexecuted instantiation: i2d_ASN1_SET_ANY Unexecuted instantiation: i2d_DHparams Unexecuted instantiation: i2d_int_dhx Unexecuted instantiation: i2d_DSA_SIG Unexecuted instantiation: i2d_DSAPrivateKey Unexecuted instantiation: i2d_DSAparams Unexecuted instantiation: i2d_DSAPublicKey Unexecuted instantiation: i2d_ECPKPARAMETERS Unexecuted instantiation: i2d_EC_PRIVATEKEY Unexecuted instantiation: i2d_ECDSA_SIG Unexecuted instantiation: i2d_RSAPrivateKey Unexecuted instantiation: i2d_RSAPublicKey |
876 | | |
877 | | # define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ |
878 | | stname * stname##_dup(stname *x) \ |
879 | 0 | { \ |
880 | 0 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ |
881 | 0 | } Unexecuted instantiation: X509_ATTRIBUTE_dup Unexecuted instantiation: X509_EXTENSION_dup Unexecuted instantiation: X509_NAME_ENTRY_dup Unexecuted instantiation: X509_NAME_dup Unexecuted instantiation: X509_dup Unexecuted instantiation: X509_ALGOR_dup Unexecuted instantiation: X509_REVOKED_dup Unexecuted instantiation: X509_CRL_dup Unexecuted instantiation: X509_REQ_dup Unexecuted instantiation: PKCS7_dup |
882 | | |
883 | | # define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ |
884 | | IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) |
885 | | |
886 | | # define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ |
887 | | int fname##_print_ctx(BIO *out, stname *x, int indent, \ |
888 | | const ASN1_PCTX *pctx) \ |
889 | 0 | { \ |
890 | 0 | return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ |
891 | 0 | ASN1_ITEM_rptr(itname), pctx); \ |
892 | 0 | } Unexecuted instantiation: CMS_ContentInfo_print_ctx Unexecuted instantiation: PKCS7_print_ctx |
893 | | |
894 | | # define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ |
895 | | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) |
896 | | |
897 | | # define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ |
898 | | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ |
899 | | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) |
900 | | |
901 | | /* external definitions for primitive types */ |
902 | | |
903 | | DECLARE_ASN1_ITEM(ASN1_BOOLEAN) |
904 | | DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) |
905 | | DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) |
906 | | DECLARE_ASN1_ITEM(ASN1_SEQUENCE) |
907 | | DECLARE_ASN1_ITEM(CBIGNUM) |
908 | | DECLARE_ASN1_ITEM(BIGNUM) |
909 | | DECLARE_ASN1_ITEM(INT32) |
910 | | DECLARE_ASN1_ITEM(ZINT32) |
911 | | DECLARE_ASN1_ITEM(UINT32) |
912 | | DECLARE_ASN1_ITEM(ZUINT32) |
913 | | DECLARE_ASN1_ITEM(INT64) |
914 | | DECLARE_ASN1_ITEM(ZINT64) |
915 | | DECLARE_ASN1_ITEM(UINT64) |
916 | | DECLARE_ASN1_ITEM(ZUINT64) |
917 | | |
918 | | # if OPENSSL_API_COMPAT < 0x10200000L |
919 | | /* |
920 | | * LONG and ZLONG are strongly discouraged for use as stored data, as the |
921 | | * underlying C type (long) differs in size depending on the architecture. |
922 | | * They are designed with 32-bit longs in mind. |
923 | | */ |
924 | | DECLARE_ASN1_ITEM(LONG) |
925 | | DECLARE_ASN1_ITEM(ZLONG) |
926 | | # endif |
927 | | |
928 | | DEFINE_STACK_OF(ASN1_VALUE) |
929 | | |
930 | | /* Functions used internally by the ASN1 code */ |
931 | | |
932 | | int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); |
933 | | void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); |
934 | | |
935 | | int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, |
936 | | const ASN1_ITEM *it, int tag, int aclass, char opt, |
937 | | ASN1_TLC *ctx); |
938 | | |
939 | | int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, |
940 | | const ASN1_ITEM *it, int tag, int aclass); |
941 | | |
942 | | #ifdef __cplusplus |
943 | | } |
944 | | #endif |
945 | | #endif |