Coverage Report

Created: 2024-02-25 06:25

/src/openssl/include/openssl/asn1t.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * WARNING: do not edit!
3
 * Generated by Makefile from include/openssl/asn1t.h.in
4
 *
5
 * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
6
 *
7
 * Licensed under the Apache License 2.0 (the "License").  You may not use
8
 * this file except in compliance with the License.  You can obtain a copy
9
 * in the file LICENSE in the source distribution or at
10
 * https://www.openssl.org/source/license.html
11
 */
12
13
14
15
#ifndef OPENSSL_ASN1T_H
16
# define OPENSSL_ASN1T_H
17
# pragma once
18
19
# include <openssl/macros.h>
20
# ifndef OPENSSL_NO_DEPRECATED_3_0
21
#  define HEADER_ASN1T_H
22
# endif
23
24
# include <stddef.h>
25
# include <openssl/e_os2.h>
26
# include <openssl/asn1.h>
27
28
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
29
#  undef OPENSSL_EXTERN
30
#  define OPENSSL_EXTERN OPENSSL_EXPORT
31
# endif
32
33
/* ASN1 template defines, structures and functions */
34
35
#ifdef  __cplusplus
36
extern "C" {
37
#endif
38
39
/*-
40
 * These are the possible values for the itype field of the
41
 * ASN1_ITEM structure and determine how it is interpreted.
42
 *
43
 * For PRIMITIVE types the underlying type
44
 * determines the behaviour if items is NULL.
45
 *
46
 * Otherwise templates must contain a single
47
 * template and the type is treated in the
48
 * same way as the type specified in the template.
49
 *
50
 * For SEQUENCE types the templates field points
51
 * to the members, the size field is the
52
 * structure size.
53
 *
54
 * For CHOICE types the templates field points
55
 * to each possible member (typically a union)
56
 * and the 'size' field is the offset of the
57
 * selector.
58
 *
59
 * The 'funcs' field is used for application-specific
60
 * data and functions.
61
 *
62
 * The EXTERN type uses a new style d2i/i2d.
63
 * The new style should be used where possible
64
 * because it avoids things like the d2i IMPLICIT
65
 * hack.
66
 *
67
 * MSTRING is a multiple string type, it is used
68
 * for a CHOICE of character strings where the
69
 * actual strings all occupy an ASN1_STRING
70
 * structure. In this case the 'utype' field
71
 * has a special meaning, it is used as a mask
72
 * of acceptable types using the B_ASN1 constants.
73
 *
74
 * NDEF_SEQUENCE is the same as SEQUENCE except
75
 * that it will use indefinite length constructed
76
 * encoding if requested.
77
 *
78
 */
79
80
606k
# define ASN1_ITYPE_PRIMITIVE            0x0
81
443k
# define ASN1_ITYPE_SEQUENCE             0x1
82
0
# define ASN1_ITYPE_CHOICE               0x2
83
/* unused value                          0x3 */
84
0
# define ASN1_ITYPE_EXTERN               0x4
85
185k
# define ASN1_ITYPE_MSTRING              0x5
86
0
# define ASN1_ITYPE_NDEF_SEQUENCE        0x6
87
88
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
89
0
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
90
91
/* Macros for start and end of ASN1_ITEM definition */
92
93
# define ASN1_ITEM_start(itname) \
94
        const ASN1_ITEM * itname##_it(void) \
95
430k
        { \
96
430k
                static const ASN1_ITEM local_it = {
97
98
# define static_ASN1_ITEM_start(itname) \
99
0
        static ASN1_ITEM_start(itname)
100
101
# define ASN1_ITEM_end(itname) \
102
430k
                }; \
103
430k
        return &local_it; \
104
430k
        }
105
106
/* Macros to aid ASN1 template writing */
107
108
# define ASN1_ITEM_TEMPLATE(tname) \
109
        static const ASN1_TEMPLATE tname##_item_tt
110
111
# define ASN1_ITEM_TEMPLATE_END(tname) \
112
        ;\
113
0
        ASN1_ITEM_start(tname) \
114
0
                ASN1_ITYPE_PRIMITIVE,\
115
0
                -1,\
116
0
                &tname##_item_tt,\
117
0
                0,\
118
0
                NULL,\
119
0
                0,\
120
0
                #tname \
121
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: ASN1_SEQUENCE_ANY_it
Unexecuted instantiation: ASN1_SET_ANY_it
Unexecuted instantiation: X509_ALGORS_it
Unexecuted instantiation: GENERAL_NAMES_it
Unexecuted instantiation: AUTHORITY_INFO_ACCESS_it
Unexecuted instantiation: POLICY_MAPPINGS_it
Unexecuted instantiation: X509_EXTENSIONS_it
Unexecuted instantiation: PKCS12_SAFEBAGS_it
Unexecuted instantiation: PKCS12_AUTHSAFES_it
Unexecuted instantiation: PKCS7_ATTR_SIGN_it
Unexecuted instantiation: PKCS7_ATTR_VERIFY_it
Unexecuted instantiation: CERTIFICATEPOLICIES_it
Unexecuted instantiation: CRL_DIST_POINTS_it
Unexecuted instantiation: EXTENDED_KEY_USAGE_it
122
# define static_ASN1_ITEM_TEMPLATE_END(tname) \
123
        ;\
124
0
        static_ASN1_ITEM_start(tname) \
125
0
                ASN1_ITYPE_PRIMITIVE,\
126
0
                -1,\
127
0
                &tname##_item_tt,\
128
0
                0,\
129
0
                NULL,\
130
0
                0,\
131
0
                #tname \
132
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: v3_tlsf.c:TLS_FEATURE_it
Unexecuted instantiation: x_name.c:X509_NAME_INTERNAL_it
Unexecuted instantiation: x_name.c:X509_NAME_ENTRIES_it
Unexecuted instantiation: v3_addr.c:IPAddrBlocks_it
133
134
/* This is a ASN1 type which just embeds a template */
135
136
/*-
137
 * This pair helps declare a SEQUENCE. We can do:
138
 *
139
 *      ASN1_SEQUENCE(stname) = {
140
 *              ... SEQUENCE components ...
141
 *      } ASN1_SEQUENCE_END(stname)
142
 *
143
 *      This will produce an ASN1_ITEM called stname_it
144
 *      for a structure called stname.
145
 *
146
 *      If you want the same structure but a different
147
 *      name then use:
148
 *
149
 *      ASN1_SEQUENCE(itname) = {
150
 *              ... SEQUENCE components ...
151
 *      } ASN1_SEQUENCE_END_name(stname, itname)
152
 *
153
 *      This will create an item called itname_it using
154
 *      a structure called stname.
155
 */
156
157
# define ASN1_SEQUENCE(tname) \
158
        static const ASN1_TEMPLATE tname##_seq_tt[]
159
160
# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
161
162
# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
163
164
# define ASN1_SEQUENCE_END_name(stname, tname) \
165
        ;\
166
0
        ASN1_ITEM_start(tname) \
167
0
                ASN1_ITYPE_SEQUENCE,\
168
0
                V_ASN1_SEQUENCE,\
169
0
                tname##_seq_tt,\
170
0
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
171
0
                NULL,\
172
0
                sizeof(stname),\
173
0
                #tname \
174
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: GOST_KX_MESSAGE_it
Unexecuted instantiation: X509_ALGOR_it
Unexecuted instantiation: ECPARAMETERS_it
Unexecuted instantiation: OCSP_SIGNATURE_it
Unexecuted instantiation: OCSP_CERTID_it
Unexecuted instantiation: OCSP_ONEREQ_it
Unexecuted instantiation: OCSP_REQINFO_it
Unexecuted instantiation: OCSP_REQUEST_it
Unexecuted instantiation: OCSP_RESPBYTES_it
Unexecuted instantiation: OCSP_RESPONSE_it
Unexecuted instantiation: OCSP_REVOKEDINFO_it
Unexecuted instantiation: OCSP_SINGLERESP_it
Unexecuted instantiation: OCSP_RESPDATA_it
Unexecuted instantiation: OCSP_BASICRESP_it
Unexecuted instantiation: OCSP_CRLID_it
Unexecuted instantiation: OCSP_SERVICELOC_it
Unexecuted instantiation: RSA_PRIME_INFO_it
Unexecuted instantiation: OTHERNAME_it
Unexecuted instantiation: EDIPARTYNAME_it
Unexecuted instantiation: ACCESS_DESCRIPTION_it
Unexecuted instantiation: GENERAL_SUBTREE_it
Unexecuted instantiation: NAME_CONSTRAINTS_it
Unexecuted instantiation: PROXY_POLICY_it
Unexecuted instantiation: PROXY_CERT_INFO_EXTENSION_it
Unexecuted instantiation: POLICY_CONSTRAINTS_it
Unexecuted instantiation: PKEY_USAGE_PERIOD_it
Unexecuted instantiation: POLICY_MAPPING_it
Unexecuted instantiation: SXNETID_it
Unexecuted instantiation: SXNET_it
Unexecuted instantiation: X509_ATTRIBUTE_it
Unexecuted instantiation: X509_REVOKED_it
Unexecuted instantiation: X509_EXTENSION_it
Unexecuted instantiation: X509_NAME_ENTRY_it
Unexecuted instantiation: X509_CERT_AUX_it
Unexecuted instantiation: PBE2PARAM_it
Unexecuted instantiation: PBKDF2PARAM_it
Unexecuted instantiation: X509_SIG_it
Unexecuted instantiation: NETSCAPE_SPKAC_it
Unexecuted instantiation: NETSCAPE_SPKI_it
Unexecuted instantiation: X509_VAL_it
Unexecuted instantiation: PKCS12_it
Unexecuted instantiation: PKCS12_MAC_DATA_it
Unexecuted instantiation: PKCS12_BAGS_it
Unexecuted instantiation: PKCS12_SAFEBAG_it
Unexecuted instantiation: PKCS7_ISSUER_AND_SERIAL_it
Unexecuted instantiation: SM2_Ciphertext_it
Unexecuted instantiation: IPAddressRange_it
Unexecuted instantiation: IPAddressFamily_it
Unexecuted instantiation: NAMING_AUTHORITY_it
Unexecuted instantiation: PROFESSION_INFO_it
Unexecuted instantiation: ADMISSIONS_it
Unexecuted instantiation: ADMISSION_SYNTAX_it
Unexecuted instantiation: AUTHORITY_KEYID_it
Unexecuted instantiation: ASRange_it
Unexecuted instantiation: ASIdentifiers_it
Unexecuted instantiation: BASIC_CONSTRAINTS_it
Unexecuted instantiation: POLICYINFO_it
Unexecuted instantiation: POLICYQUALINFO_it
Unexecuted instantiation: USERNOTICE_it
Unexecuted instantiation: NOTICEREF_it
Unexecuted instantiation: DIST_POINT_it
Unexecuted instantiation: ISSUING_DIST_POINT_it
Unexecuted instantiation: ISSUER_SIGN_TOOL_it
Unexecuted instantiation: PBEPARAM_it
Unexecuted instantiation: SCRYPT_PARAMS_it
175
176
# define static_ASN1_SEQUENCE_END_name(stname, tname) \
177
        ;\
178
0
        static_ASN1_ITEM_start(tname) \
179
0
                ASN1_ITYPE_SEQUENCE,\
180
0
                V_ASN1_SEQUENCE,\
181
0
                tname##_seq_tt,\
182
0
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
183
0
                NULL,\
184
0
                sizeof(stname),\
185
0
                #stname \
186
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: ssl_asn1.c:SSL_SESSION_ASN1_it
Unexecuted instantiation: dh_asn1.c:DHxparams_it
Unexecuted instantiation: dh_asn1.c:DHvparams_it
Unexecuted instantiation: ec_asn1.c:X9_62_PENTANOMIAL_it
Unexecuted instantiation: ec_asn1.c:X9_62_CHARACTERISTIC_TWO_it
Unexecuted instantiation: ec_asn1.c:X9_62_FIELDID_it
Unexecuted instantiation: ec_asn1.c:X9_62_CURVE_it
Unexecuted instantiation: ec_asn1.c:EC_PRIVATEKEY_it
Unexecuted instantiation: x_pubkey.c:X509_PUBKEY_INTERNAL_it
Unexecuted instantiation: evp_asn1.c:asn1_int_oct_it
Unexecuted instantiation: evp_asn1.c:asn1_oct_int_it
187
188
# define ASN1_NDEF_SEQUENCE(tname) \
189
        ASN1_SEQUENCE(tname)
190
191
# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
192
        ASN1_SEQUENCE_cb(tname, cb)
193
194
# define ASN1_SEQUENCE_cb(tname, cb) \
195
        static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
196
        ASN1_SEQUENCE(tname)
197
198
# define ASN1_SEQUENCE_const_cb(tname, const_cb) \
199
        static const ASN1_AUX tname##_aux = \
200
            {NULL, ASN1_AFLG_CONST_CB, 0, 0, NULL, 0, const_cb}; \
201
        ASN1_SEQUENCE(tname)
202
203
# define ASN1_SEQUENCE_cb_const_cb(tname, cb, const_cb) \
204
        static const ASN1_AUX tname##_aux = \
205
            {NULL, ASN1_AFLG_CONST_CB, 0, 0, cb, 0, const_cb}; \
206
        ASN1_SEQUENCE(tname)
207
208
# define ASN1_SEQUENCE_ref(tname, cb) \
209
        static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0, NULL}; \
210
        ASN1_SEQUENCE(tname)
211
212
# define ASN1_SEQUENCE_enc(tname, enc, cb) \
213
        static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc), NULL}; \
214
        ASN1_SEQUENCE(tname)
215
216
# define ASN1_NDEF_SEQUENCE_END(tname) \
217
        ;\
218
0
        ASN1_ITEM_start(tname) \
219
0
                ASN1_ITYPE_NDEF_SEQUENCE,\
220
0
                V_ASN1_SEQUENCE,\
221
0
                tname##_seq_tt,\
222
0
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
223
0
                NULL,\
224
0
                sizeof(tname),\
225
0
                #tname \
226
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: PKCS7_SIGNED_it
Unexecuted instantiation: PKCS7_ENVELOPE_it
Unexecuted instantiation: PKCS7_ENC_CONTENT_it
Unexecuted instantiation: PKCS7_SIGN_ENVELOPE_it
Unexecuted instantiation: PKCS7_ENCRYPT_it
Unexecuted instantiation: PKCS7_DIGEST_it
227
# define static_ASN1_NDEF_SEQUENCE_END(tname) \
228
        ;\
229
        static_ASN1_ITEM_start(tname) \
230
                ASN1_ITYPE_NDEF_SEQUENCE,\
231
                V_ASN1_SEQUENCE,\
232
                tname##_seq_tt,\
233
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
234
                NULL,\
235
                sizeof(tname),\
236
                #tname \
237
        ASN1_ITEM_end(tname)
238
239
240
# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
241
242
# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
243
# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
244
245
# define ASN1_SEQUENCE_END_ref(stname, tname) \
246
        ;\
247
209k
        ASN1_ITEM_start(tname) \
248
209k
                ASN1_ITYPE_SEQUENCE,\
249
209k
                V_ASN1_SEQUENCE,\
250
209k
                tname##_seq_tt,\
251
209k
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
252
209k
                &tname##_aux,\
253
209k
                sizeof(stname),\
254
209k
                #tname \
255
209k
        ASN1_ITEM_end(tname)
Unexecuted instantiation: PKCS8_PRIV_KEY_INFO_it
Unexecuted instantiation: DHparams_it
Unexecuted instantiation: RSAPrivateKey_it
RSAPublicKey_it
Line
Count
Source
247
111k
        ASN1_ITEM_start(tname) \
248
111k
                ASN1_ITYPE_SEQUENCE,\
249
111k
                V_ASN1_SEQUENCE,\
250
111k
                tname##_seq_tt,\
251
111k
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
252
111k
                &tname##_aux,\
253
111k
                sizeof(stname),\
254
111k
                #tname \
255
111k
        ASN1_ITEM_end(tname)
RSA_PSS_PARAMS_it
Line
Count
Source
247
97.2k
        ASN1_ITEM_start(tname) \
248
97.2k
                ASN1_ITYPE_SEQUENCE,\
249
97.2k
                V_ASN1_SEQUENCE,\
250
97.2k
                tname##_seq_tt,\
251
97.2k
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
252
97.2k
                &tname##_aux,\
253
97.2k
                sizeof(stname),\
254
97.2k
                #tname \
255
97.2k
        ASN1_ITEM_end(tname)
Unexecuted instantiation: RSA_OAEP_PARAMS_it
Unexecuted instantiation: X509_CRL_INFO_it
Unexecuted instantiation: X509_CRL_it
Unexecuted instantiation: X509_REQ_INFO_it
Unexecuted instantiation: X509_REQ_it
Unexecuted instantiation: X509_CINF_it
Unexecuted instantiation: X509_it
Unexecuted instantiation: PKCS7_SIGNER_INFO_it
Unexecuted instantiation: PKCS7_RECIP_INFO_it
Unexecuted instantiation: NETSCAPE_CERT_SEQUENCE_it
256
# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
257
        ;\
258
0
        static_ASN1_ITEM_start(tname) \
259
0
                ASN1_ITYPE_SEQUENCE,\
260
0
                V_ASN1_SEQUENCE,\
261
0
                tname##_seq_tt,\
262
0
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
263
0
                &tname##_aux,\
264
0
                sizeof(stname),\
265
0
                #stname \
266
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: dsa_asn1.c:DSAPrivateKey_it
Unexecuted instantiation: dsa_asn1.c:DSAparams_it
Unexecuted instantiation: dsa_asn1.c:DSAPublicKey_it
267
268
# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
269
        ;\
270
0
        ASN1_ITEM_start(tname) \
271
0
                ASN1_ITYPE_NDEF_SEQUENCE,\
272
0
                V_ASN1_SEQUENCE,\
273
0
                tname##_seq_tt,\
274
0
                sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
275
0
                &tname##_aux,\
276
0
                sizeof(stname),\
277
0
                #stname \
278
0
        ASN1_ITEM_end(tname)
279
280
/*-
281
 * This pair helps declare a CHOICE type. We can do:
282
 *
283
 *      ASN1_CHOICE(chname) = {
284
 *              ... CHOICE options ...
285
 *      ASN1_CHOICE_END(chname)
286
 *
287
 *      This will produce an ASN1_ITEM called chname_it
288
 *      for a structure called chname. The structure
289
 *      definition must look like this:
290
 *      typedef struct {
291
 *              int type;
292
 *              union {
293
 *                      ASN1_SOMETHING *opt1;
294
 *                      ASN1_SOMEOTHER *opt2;
295
 *              } value;
296
 *      } chname;
297
 *
298
 *      the name of the selector must be 'type'.
299
 *      to use an alternative selector name use the
300
 *      ASN1_CHOICE_END_selector() version.
301
 */
302
303
# define ASN1_CHOICE(tname) \
304
        static const ASN1_TEMPLATE tname##_ch_tt[]
305
306
# define ASN1_CHOICE_cb(tname, cb) \
307
        static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
308
        ASN1_CHOICE(tname)
309
310
# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
311
312
# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
313
314
# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
315
316
# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
317
318
# define ASN1_CHOICE_END_selector(stname, tname, selname) \
319
        ;\
320
0
        ASN1_ITEM_start(tname) \
321
0
                ASN1_ITYPE_CHOICE,\
322
0
                offsetof(stname,selname) ,\
323
0
                tname##_ch_tt,\
324
0
                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
325
0
                NULL,\
326
0
                sizeof(stname),\
327
0
                #stname \
328
0
        ASN1_ITEM_end(tname)
Unexecuted instantiation: ECPKPARAMETERS_it
Unexecuted instantiation: OCSP_RESPID_it
Unexecuted instantiation: OCSP_CERTSTATUS_it
Unexecuted instantiation: GENERAL_NAME_it
Unexecuted instantiation: IPAddressOrRange_it
Unexecuted instantiation: IPAddressChoice_it
Unexecuted instantiation: ASIdOrRange_it
Unexecuted instantiation: ASIdentifierChoice_it
329
330
# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
331
        ;\
332
        static_ASN1_ITEM_start(tname) \
333
                ASN1_ITYPE_CHOICE,\
334
                offsetof(stname,selname) ,\
335
                tname##_ch_tt,\
336
                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
337
                NULL,\
338
                sizeof(stname),\
339
                #stname \
340
        ASN1_ITEM_end(tname)
341
342
# define ASN1_CHOICE_END_cb(stname, tname, selname) \
343
        ;\
344
0
        ASN1_ITEM_start(tname) \
345
0
                ASN1_ITYPE_CHOICE,\
346
0
                offsetof(stname,selname) ,\
347
0
                tname##_ch_tt,\
348
0
                sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
349
0
                &tname##_aux,\
350
0
                sizeof(stname),\
351
0
                #stname \
352
0
        ASN1_ITEM_end(tname)
353
354
/* This helps with the template wrapper form of ASN1_ITEM */
355
356
# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
357
        (flags), (tag), 0,\
358
        #name, ASN1_ITEM_ref(type) }
359
360
/* These help with SEQUENCE or CHOICE components */
361
362
/* used to declare other types */
363
364
# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
365
        (flags), (tag), offsetof(stname, field),\
366
        #field, ASN1_ITEM_ref(type) }
367
368
/* implicit and explicit helper macros */
369
370
# define ASN1_IMP_EX(stname, field, type, tag, ex) \
371
         ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type)
372
373
# define ASN1_EXP_EX(stname, field, type, tag, ex) \
374
         ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type)
375
376
/* Any defined by macros: the field used is in the table itself */
377
378
# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
379
# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
380
381
/* Plain simple type */
382
# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
383
/* Embedded simple type */
384
# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type)
385
386
/* OPTIONAL simple type */
387
# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
388
# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type)
389
390
/* IMPLICIT tagged simple type */
391
# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
392
# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
393
394
/* IMPLICIT tagged OPTIONAL simple type */
395
# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
396
# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
397
398
/* Same as above but EXPLICIT */
399
400
# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
401
# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
402
# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
403
# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
404
405
/* SEQUENCE OF type */
406
# define ASN1_SEQUENCE_OF(stname, field, type) \
407
                ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
408
409
/* OPTIONAL SEQUENCE OF */
410
# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
411
                ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
412
413
/* Same as above but for SET OF */
414
415
# define ASN1_SET_OF(stname, field, type) \
416
                ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
417
418
# define ASN1_SET_OF_OPT(stname, field, type) \
419
                ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
420
421
/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
422
423
# define ASN1_IMP_SET_OF(stname, field, type, tag) \
424
                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
425
426
# define ASN1_EXP_SET_OF(stname, field, type, tag) \
427
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
428
429
# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
430
                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
431
432
# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
433
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
434
435
# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
436
                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
437
438
# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
439
                        ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
440
441
# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
442
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
443
444
# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
445
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
446
447
/* EXPLICIT using indefinite length constructed form */
448
# define ASN1_NDEF_EXP(stname, field, type, tag) \
449
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
450
451
/* EXPLICIT OPTIONAL using indefinite length constructed form */
452
# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
453
                        ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
454
455
/* Macros for the ASN1_ADB structure */
456
457
# define ASN1_ADB(name) \
458
        static const ASN1_ADB_TABLE name##_adbtbl[]
459
460
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
461
        ;\
462
        static const ASN1_ITEM *name##_adb(void) \
463
0
        { \
464
0
        static const ASN1_ADB internal_adb = \
465
0
                {\
466
0
                flags,\
467
0
                offsetof(name, field),\
468
0
                adb_cb,\
469
0
                name##_adbtbl,\
470
0
                sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
471
0
                def,\
472
0
                none\
473
0
                }; \
474
0
                return (const ASN1_ITEM *) &internal_adb; \
475
0
        } \
Unexecuted instantiation: ec_asn1.c:X9_62_CHARACTERISTIC_TWO_adb
Unexecuted instantiation: ec_asn1.c:X9_62_FIELDID_adb
Unexecuted instantiation: p12_asn.c:PKCS12_BAGS_adb
Unexecuted instantiation: p12_asn.c:PKCS12_SAFEBAG_adb
Unexecuted instantiation: pk7_asn1.c:PKCS7_adb
Unexecuted instantiation: v3_cpols.c:POLICYQUALINFO_adb
476
        void dummy_function(void)
477
478
# define ADB_ENTRY(val, template) {val, template}
479
480
# define ASN1_ADB_TEMPLATE(name) \
481
        static const ASN1_TEMPLATE name##_tt
482
483
/*
484
 * This is the ASN1 template structure that defines a wrapper round the
485
 * actual type. It determines the actual position of the field in the value
486
 * structure, various flags such as OPTIONAL and the field name.
487
 */
488
489
struct ASN1_TEMPLATE_st {
490
    unsigned long flags;        /* Various flags */
491
    long tag;                   /* tag, not used if no tagging */
492
    unsigned long offset;       /* Offset of this field in structure */
493
    const char *field_name;     /* Field name */
494
    ASN1_ITEM_EXP *item;        /* Relevant ASN1_ITEM or ASN1_ADB */
495
};
496
497
/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
498
499
# define ASN1_TEMPLATE_item(t) (t->item_ptr)
500
# define ASN1_TEMPLATE_adb(t) (t->item_ptr)
501
502
typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
503
typedef struct ASN1_ADB_st ASN1_ADB;
504
505
struct ASN1_ADB_st {
506
    unsigned long flags;        /* Various flags */
507
    unsigned long offset;       /* Offset of selector field */
508
    int (*adb_cb)(long *psel);  /* Application callback */
509
    const ASN1_ADB_TABLE *tbl;  /* Table of possible types */
510
    long tblcount;              /* Number of entries in tbl */
511
    const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
512
    const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
513
};
514
515
struct ASN1_ADB_TABLE_st {
516
    long value;                 /* NID for an object or value for an int */
517
    const ASN1_TEMPLATE tt;     /* item for this value */
518
};
519
520
/* template flags */
521
522
/* Field is optional */
523
96.6k
# define ASN1_TFLG_OPTIONAL      (0x1)
524
525
/* Field is a SET OF */
526
0
# define ASN1_TFLG_SET_OF        (0x1 << 1)
527
528
/* Field is a SEQUENCE OF */
529
0
# define ASN1_TFLG_SEQUENCE_OF   (0x2 << 1)
530
531
/*
532
 * Special case: this refers to a SET OF that will be sorted into DER order
533
 * when encoded *and* the corresponding STACK will be modified to match the
534
 * new order.
535
 */
536
# define ASN1_TFLG_SET_ORDER     (0x3 << 1)
537
538
/* Mask for SET OF or SEQUENCE OF */
539
221k
# define ASN1_TFLG_SK_MASK       (0x3 << 1)
540
541
/*
542
 * These flags mean the tag should be taken from the tag field. If EXPLICIT
543
 * then the underlying type is used for the inner tag.
544
 */
545
546
/* IMPLICIT tagging */
547
185k
# define ASN1_TFLG_IMPTAG        (0x1 << 3)
548
549
/* EXPLICIT tagging, inner tag from underlying type */
550
221k
# define ASN1_TFLG_EXPTAG        (0x2 << 3)
551
552
35.8k
# define ASN1_TFLG_TAG_MASK      (0x3 << 3)
553
554
/* context specific IMPLICIT */
555
# define ASN1_TFLG_IMPLICIT      (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
556
557
/* context specific EXPLICIT */
558
# define ASN1_TFLG_EXPLICIT      (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
559
560
/*
561
 * If tagging is in force these determine the type of tag to use. Otherwise
562
 * the tag is determined by the underlying type. These values reflect the
563
 * actual octet format.
564
 */
565
566
/* Universal tag */
567
# define ASN1_TFLG_UNIVERSAL     (0x0<<6)
568
/* Application tag */
569
# define ASN1_TFLG_APPLICATION   (0x1<<6)
570
/* Context specific tag */
571
# define ASN1_TFLG_CONTEXT       (0x2<<6)
572
/* Private tag */
573
# define ASN1_TFLG_PRIVATE       (0x3<<6)
574
575
418k
# define ASN1_TFLG_TAG_CLASS     (0x3<<6)
576
577
/*
578
 * These are for ANY DEFINED BY type. In this case the 'item' field points to
579
 * an ASN1_ADB structure which contains a table of values to decode the
580
 * relevant type
581
 */
582
583
421k
# define ASN1_TFLG_ADB_MASK      (0x3<<8)
584
585
0
# define ASN1_TFLG_ADB_OID       (0x1<<8)
586
587
# define ASN1_TFLG_ADB_INT       (0x1<<9)
588
589
/*
590
 * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
591
 * indefinite length constructed encoding to be used if required.
592
 */
593
594
35.8k
# define ASN1_TFLG_NDEF          (0x1<<11)
595
596
/* Field is embedded and not a pointer */
597
221k
# define ASN1_TFLG_EMBED         (0x1 << 12)
598
599
/* This is the actual ASN1 item itself */
600
601
struct ASN1_ITEM_st {
602
    char itype;                 /* The item type, primitive, SEQUENCE, CHOICE
603
                                 * or extern */
604
    long utype;                 /* underlying type */
605
    const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains
606
                                     * the contents */
607
    long tcount;                /* Number of templates if SEQUENCE or CHOICE */
608
    const void *funcs;          /* further data and type-specific functions */
609
    /* funcs can be ASN1_PRIMITIVE_FUNCS*, ASN1_EXTERN_FUNCS*, or ASN1_AUX* */
610
    long size;                  /* Structure size (usually) */
611
    const char *sname;          /* Structure name */
612
};
613
614
/*
615
 * Cache for ASN1 tag and length, so we don't keep re-reading it for things
616
 * like CHOICE
617
 */
618
619
struct ASN1_TLC_st {
620
    char valid;                 /* Values below are valid */
621
    int ret;                    /* return value */
622
    long plen;                  /* length */
623
    int ptag;                   /* class value */
624
    int pclass;                 /* class value */
625
    int hdrlen;                 /* header length */
626
};
627
628
/* Typedefs for ASN1 function pointers */
629
typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
630
                        const ASN1_ITEM *it, int tag, int aclass, char opt,
631
                        ASN1_TLC *ctx);
632
633
typedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len,
634
                           const ASN1_ITEM *it, int tag, int aclass, char opt,
635
                           ASN1_TLC *ctx, OSSL_LIB_CTX *libctx,
636
                           const char *propq);
637
typedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
638
                        const ASN1_ITEM *it, int tag, int aclass);
639
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
640
typedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it,
641
                                OSSL_LIB_CTX *libctx, const char *propq);
642
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
643
644
typedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval,
645
                               int indent, const char *fname,
646
                               const ASN1_PCTX *pctx);
647
648
typedef int ASN1_primitive_i2c(const ASN1_VALUE **pval, unsigned char *cont,
649
                               int *putype, const ASN1_ITEM *it);
650
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont,
651
                               int len, int utype, char *free_cont,
652
                               const ASN1_ITEM *it);
653
typedef int ASN1_primitive_print(BIO *out, const ASN1_VALUE **pval,
654
                                 const ASN1_ITEM *it, int indent,
655
                                 const ASN1_PCTX *pctx);
656
657
typedef struct ASN1_EXTERN_FUNCS_st {
658
    void *app_data;
659
    ASN1_ex_new_func *asn1_ex_new;
660
    ASN1_ex_free_func *asn1_ex_free;
661
    ASN1_ex_free_func *asn1_ex_clear;
662
    ASN1_ex_d2i *asn1_ex_d2i;
663
    ASN1_ex_i2d *asn1_ex_i2d;
664
    ASN1_ex_print_func *asn1_ex_print;
665
    ASN1_ex_new_ex_func *asn1_ex_new_ex;
666
    ASN1_ex_d2i_ex *asn1_ex_d2i_ex;
667
} ASN1_EXTERN_FUNCS;
668
669
typedef struct ASN1_PRIMITIVE_FUNCS_st {
670
    void *app_data;
671
    unsigned long flags;
672
    ASN1_ex_new_func *prim_new;
673
    ASN1_ex_free_func *prim_free;
674
    ASN1_ex_free_func *prim_clear;
675
    ASN1_primitive_c2i *prim_c2i;
676
    ASN1_primitive_i2c *prim_i2c;
677
    ASN1_primitive_print *prim_print;
678
} ASN1_PRIMITIVE_FUNCS;
679
680
/*
681
 * This is the ASN1_AUX structure: it handles various miscellaneous
682
 * requirements. For example the use of reference counts and an informational
683
 * callback. The "informational callback" is called at various points during
684
 * the ASN1 encoding and decoding. It can be used to provide minor
685
 * customisation of the structures used. This is most useful where the
686
 * supplied routines *almost* do the right thing but need some extra help at
687
 * a few points. If the callback returns zero then it is assumed a fatal
688
 * error has occurred and the main operation should be abandoned. If major
689
 * changes in the default behaviour are required then an external type is
690
 * more appropriate.
691
 * For the operations ASN1_OP_I2D_PRE, ASN1_OP_I2D_POST, ASN1_OP_PRINT_PRE, and
692
 * ASN1_OP_PRINT_POST, meanwhile a variant of the callback with const parameter
693
 * 'in' is provided to make clear statically that its input is not modified. If
694
 * and only if this variant is in use the flag ASN1_AFLG_CONST_CB must be set.
695
 */
696
697
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
698
                        void *exarg);
699
typedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,
700
                              const ASN1_ITEM *it, void *exarg);
701
702
typedef struct ASN1_AUX_st {
703
    void *app_data;
704
    int flags;
705
    int ref_offset;             /* Offset of reference value */
706
    int ref_lock;               /* Offset of lock value */
707
    ASN1_aux_cb *asn1_cb;
708
    int enc_offset;             /* Offset of ASN1_ENCODING structure */
709
    ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */
710
} ASN1_AUX;
711
712
/* For print related callbacks exarg points to this structure */
713
typedef struct ASN1_PRINT_ARG_st {
714
    BIO *out;
715
    int indent;
716
    const ASN1_PCTX *pctx;
717
} ASN1_PRINT_ARG;
718
719
/* For streaming related callbacks exarg points to this structure */
720
typedef struct ASN1_STREAM_ARG_st {
721
    /* BIO to stream through */
722
    BIO *out;
723
    /* BIO with filters appended */
724
    BIO *ndef_bio;
725
    /* Streaming I/O boundary */
726
    unsigned char **boundary;
727
} ASN1_STREAM_ARG;
728
729
/* Flags in ASN1_AUX */
730
731
/* Use a reference count */
732
10.0k
# define ASN1_AFLG_REFCOUNT      1
733
/* Save the encoding of structure (useful for signatures) */
734
99.1k
# define ASN1_AFLG_ENCODING      2
735
/* The Sequence length is invalid */
736
97.6k
# define ASN1_AFLG_BROKEN        4
737
/* Use the new asn1_const_cb */
738
47.8k
# define ASN1_AFLG_CONST_CB      8
739
740
/* operation values for asn1_cb */
741
742
406k
# define ASN1_OP_NEW_PRE         0
743
0
# define ASN1_OP_NEW_POST        1
744
222k
# define ASN1_OP_FREE_PRE        2
745
0
# define ASN1_OP_FREE_POST       3
746
97.2k
# define ASN1_OP_D2I_PRE         4
747
289k
# define ASN1_OP_D2I_POST        5
748
11.9k
# define ASN1_OP_I2D_PRE         6
749
5.97k
# define ASN1_OP_I2D_POST        7
750
0
# define ASN1_OP_PRINT_PRE       8
751
0
# define ASN1_OP_PRINT_POST      9
752
0
# define ASN1_OP_STREAM_PRE      10
753
0
# define ASN1_OP_STREAM_POST     11
754
0
# define ASN1_OP_DETACHED_PRE    12
755
0
# define ASN1_OP_DETACHED_POST   13
756
0
# define ASN1_OP_DUP_PRE         14
757
0
# define ASN1_OP_DUP_POST        15
758
0
# define ASN1_OP_GET0_LIBCTX     16
759
0
# define ASN1_OP_GET0_PROPQ      17
760
761
/* Macro to implement a primitive type */
762
# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
763
# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
764
0
                                ASN1_ITEM_start(itname) \
765
0
                                        ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
766
0
                                ASN1_ITEM_end(itname)
Unexecuted instantiation: ASN1_OCTET_STRING_it
Unexecuted instantiation: ASN1_INTEGER_it
Unexecuted instantiation: ASN1_ENUMERATED_it
Unexecuted instantiation: ASN1_BIT_STRING_it
Unexecuted instantiation: ASN1_UTF8STRING_it
Unexecuted instantiation: ASN1_PRINTABLESTRING_it
Unexecuted instantiation: ASN1_T61STRING_it
Unexecuted instantiation: ASN1_IA5STRING_it
Unexecuted instantiation: ASN1_GENERALSTRING_it
Unexecuted instantiation: ASN1_UTCTIME_it
Unexecuted instantiation: ASN1_GENERALIZEDTIME_it
Unexecuted instantiation: ASN1_VISIBLESTRING_it
Unexecuted instantiation: ASN1_UNIVERSALSTRING_it
Unexecuted instantiation: ASN1_BMPSTRING_it
Unexecuted instantiation: ASN1_NULL_it
Unexecuted instantiation: ASN1_OBJECT_it
Unexecuted instantiation: ASN1_ANY_it
Unexecuted instantiation: ASN1_SEQUENCE_it
Unexecuted instantiation: ASN1_BOOLEAN_it
Unexecuted instantiation: ASN1_TBOOLEAN_it
Unexecuted instantiation: ASN1_FBOOLEAN_it
Unexecuted instantiation: ASN1_OCTET_STRING_NDEF_it
767
768
/* Macro to implement a multi string type */
769
# define IMPLEMENT_ASN1_MSTRING(itname, mask) \
770
0
                                ASN1_ITEM_start(itname) \
771
0
                                        ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
772
0
                                ASN1_ITEM_end(itname)
Unexecuted instantiation: ASN1_TIME_it
Unexecuted instantiation: ASN1_PRINTABLE_it
Unexecuted instantiation: DISPLAYTEXT_it
Unexecuted instantiation: DIRECTORYSTRING_it
773
774
# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
775
0
        ASN1_ITEM_start(sname) \
776
0
                ASN1_ITYPE_EXTERN, \
777
0
                tag, \
778
0
                NULL, \
779
0
                0, \
780
0
                &fptrs, \
781
0
                0, \
782
0
                #sname \
783
0
        ASN1_ITEM_end(sname)
Unexecuted instantiation: X509_NAME_it
Unexecuted instantiation: X509_PUBKEY_it
784
785
/* Macro to implement standard functions in terms of ASN1_ITEM structures */
786
787
# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
788
789
# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
790
791
# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
792
                        IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
793
794
# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
795
                IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
796
797
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
798
                IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
799
800
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
801
        pre stname *fname##_new(void) \
802
        { \
803
                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
804
        } \
805
        pre void fname##_free(stname *a) \
806
        { \
807
                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
808
        }
809
810
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
811
        stname *fname##_new(void) \
812
0
        { \
813
0
                return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
814
0
        } \
Unexecuted instantiation: GOST_KX_MESSAGE_new
Unexecuted instantiation: ASN1_TIME_new
Unexecuted instantiation: PKCS8_PRIV_KEY_INFO_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: 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: 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: RSA_PSS_PARAMS_new
Unexecuted instantiation: RSA_OAEP_PARAMS_new
Unexecuted instantiation: OTHERNAME_new
Unexecuted instantiation: EDIPARTYNAME_new
Unexecuted instantiation: GENERAL_NAME_new
Unexecuted instantiation: GENERAL_NAMES_new
Unexecuted instantiation: ACCESS_DESCRIPTION_new
Unexecuted instantiation: AUTHORITY_INFO_ACCESS_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: X509_ATTRIBUTE_new
Unexecuted instantiation: X509_REVOKED_new
Unexecuted instantiation: X509_CRL_INFO_new
Unexecuted instantiation: X509_CRL_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_REQ_INFO_new
Unexecuted instantiation: X509_REQ_new
Unexecuted instantiation: X509_CINF_new
Unexecuted instantiation: X509_new
Unexecuted instantiation: X509_CERT_AUX_new
Unexecuted instantiation: PBE2PARAM_new
Unexecuted instantiation: PBKDF2PARAM_new
Unexecuted instantiation: X509_SIG_new
Unexecuted instantiation: NETSCAPE_SPKAC_new
Unexecuted instantiation: NETSCAPE_SPKI_new
Unexecuted instantiation: X509_VAL_new
Unexecuted instantiation: PKCS12_MAC_DATA_new
Unexecuted instantiation: PKCS12_BAGS_new
Unexecuted instantiation: PKCS12_SAFEBAG_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
Unexecuted instantiation: SM2_Ciphertext_new
Unexecuted instantiation: IPAddressRange_new
Unexecuted instantiation: IPAddressOrRange_new
Unexecuted instantiation: IPAddressChoice_new
Unexecuted instantiation: IPAddressFamily_new
Unexecuted instantiation: NAMING_AUTHORITY_new
Unexecuted instantiation: PROFESSION_INFO_new
Unexecuted instantiation: ADMISSIONS_new
Unexecuted instantiation: ADMISSION_SYNTAX_new
Unexecuted instantiation: AUTHORITY_KEYID_new
Unexecuted instantiation: ASRange_new
Unexecuted instantiation: ASIdOrRange_new
Unexecuted instantiation: ASIdentifierChoice_new
Unexecuted instantiation: ASIdentifiers_new
Unexecuted instantiation: BASIC_CONSTRAINTS_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: EXTENDED_KEY_USAGE_new
Unexecuted instantiation: ISSUER_SIGN_TOOL_new
Unexecuted instantiation: NETSCAPE_CERT_SEQUENCE_new
Unexecuted instantiation: PBEPARAM_new
Unexecuted instantiation: SCRYPT_PARAMS_new
815
        void fname##_free(stname *a) \
816
97.2k
        { \
817
97.2k
                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
818
97.2k
        }
Unexecuted instantiation: GOST_KX_MESSAGE_free
Unexecuted instantiation: ASN1_TIME_free
Unexecuted instantiation: PKCS8_PRIV_KEY_INFO_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: 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: 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
RSA_PSS_PARAMS_free
Line
Count
Source
816
97.2k
        { \
817
97.2k
                ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
818
97.2k
        }
Unexecuted instantiation: RSA_OAEP_PARAMS_free
Unexecuted instantiation: OTHERNAME_free
Unexecuted instantiation: EDIPARTYNAME_free
Unexecuted instantiation: GENERAL_NAME_free
Unexecuted instantiation: GENERAL_NAMES_free
Unexecuted instantiation: ACCESS_DESCRIPTION_free
Unexecuted instantiation: AUTHORITY_INFO_ACCESS_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: X509_ATTRIBUTE_free
Unexecuted instantiation: X509_REVOKED_free
Unexecuted instantiation: X509_CRL_INFO_free
Unexecuted instantiation: X509_CRL_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_REQ_INFO_free
Unexecuted instantiation: X509_REQ_free
Unexecuted instantiation: X509_CINF_free
Unexecuted instantiation: X509_free
Unexecuted instantiation: X509_CERT_AUX_free
Unexecuted instantiation: PBE2PARAM_free
Unexecuted instantiation: PBKDF2PARAM_free
Unexecuted instantiation: X509_SIG_free
Unexecuted instantiation: NETSCAPE_SPKAC_free
Unexecuted instantiation: NETSCAPE_SPKI_free
Unexecuted instantiation: X509_VAL_free
Unexecuted instantiation: PKCS12_MAC_DATA_free
Unexecuted instantiation: PKCS12_BAGS_free
Unexecuted instantiation: PKCS12_SAFEBAG_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
Unexecuted instantiation: SM2_Ciphertext_free
Unexecuted instantiation: IPAddressRange_free
Unexecuted instantiation: IPAddressOrRange_free
Unexecuted instantiation: IPAddressChoice_free
Unexecuted instantiation: IPAddressFamily_free
Unexecuted instantiation: NAMING_AUTHORITY_free
Unexecuted instantiation: PROFESSION_INFO_free
Unexecuted instantiation: ADMISSIONS_free
Unexecuted instantiation: ADMISSION_SYNTAX_free
Unexecuted instantiation: AUTHORITY_KEYID_free
Unexecuted instantiation: ASRange_free
Unexecuted instantiation: ASIdOrRange_free
Unexecuted instantiation: ASIdentifierChoice_free
Unexecuted instantiation: ASIdentifiers_free
Unexecuted instantiation: BASIC_CONSTRAINTS_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: EXTENDED_KEY_USAGE_free
Unexecuted instantiation: ISSUER_SIGN_TOOL_free
Unexecuted instantiation: NETSCAPE_CERT_SEQUENCE_free
Unexecuted instantiation: PBEPARAM_free
Unexecuted instantiation: SCRYPT_PARAMS_free
819
820
# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
821
        IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
822
        IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
823
824
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
825
        stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
826
105k
        { \
827
105k
                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
828
105k
        } \
Unexecuted instantiation: d2i_GOST_KX_MESSAGE
Unexecuted instantiation: d2i_ASN1_TIME
Unexecuted instantiation: d2i_PKCS8_PRIV_KEY_INFO
Unexecuted instantiation: d2i_ASN1_OCTET_STRING
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_ASN1_SEQUENCE_ANY
Unexecuted instantiation: d2i_ASN1_SET_ANY
Unexecuted instantiation: d2i_X509_ALGOR
Unexecuted instantiation: d2i_X509_ALGORS
Unexecuted instantiation: d2i_DHparams
Unexecuted instantiation: d2i_int_dhx
Unexecuted instantiation: d2i_DSAPrivateKey
Unexecuted instantiation: d2i_DSAparams
Unexecuted instantiation: d2i_DSAPublicKey
Unexecuted instantiation: d2i_ECPKPARAMETERS
Unexecuted instantiation: d2i_EC_PRIVATEKEY
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_RSA_PSS_PARAMS
Unexecuted instantiation: d2i_RSA_OAEP_PARAMS
Unexecuted instantiation: d2i_RSAPrivateKey
d2i_RSAPublicKey
Line
Count
Source
826
105k
        { \
827
105k
                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
828
105k
        } \
Unexecuted instantiation: d2i_OTHERNAME
Unexecuted instantiation: d2i_EDIPARTYNAME
Unexecuted instantiation: d2i_GENERAL_NAME
Unexecuted instantiation: d2i_GENERAL_NAMES
Unexecuted instantiation: d2i_ACCESS_DESCRIPTION
Unexecuted instantiation: d2i_AUTHORITY_INFO_ACCESS
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_X509_ATTRIBUTE
Unexecuted instantiation: d2i_X509_REVOKED
Unexecuted instantiation: d2i_X509_CRL_INFO
Unexecuted instantiation: d2i_X509_CRL
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_REQ_INFO
Unexecuted instantiation: d2i_X509_REQ
Unexecuted instantiation: d2i_X509_CINF
Unexecuted instantiation: d2i_X509
Unexecuted instantiation: d2i_X509_CERT_AUX
Unexecuted instantiation: d2i_PBE2PARAM
Unexecuted instantiation: d2i_PBKDF2PARAM
Unexecuted instantiation: d2i_X509_SIG
Unexecuted instantiation: d2i_NETSCAPE_SPKAC
Unexecuted instantiation: d2i_NETSCAPE_SPKI
Unexecuted instantiation: d2i_X509_VAL
Unexecuted instantiation: d2i_PKCS12
Unexecuted instantiation: d2i_PKCS12_MAC_DATA
Unexecuted instantiation: d2i_PKCS12_BAGS
Unexecuted instantiation: d2i_PKCS12_SAFEBAG
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
Unexecuted instantiation: d2i_SM2_Ciphertext
Unexecuted instantiation: d2i_IPAddressRange
Unexecuted instantiation: d2i_IPAddressOrRange
Unexecuted instantiation: d2i_IPAddressChoice
Unexecuted instantiation: d2i_IPAddressFamily
Unexecuted instantiation: d2i_NAMING_AUTHORITY
Unexecuted instantiation: d2i_PROFESSION_INFO
Unexecuted instantiation: d2i_ADMISSIONS
Unexecuted instantiation: d2i_ADMISSION_SYNTAX
Unexecuted instantiation: d2i_AUTHORITY_KEYID
Unexecuted instantiation: d2i_ASRange
Unexecuted instantiation: d2i_ASIdOrRange
Unexecuted instantiation: d2i_ASIdentifierChoice
Unexecuted instantiation: d2i_ASIdentifiers
Unexecuted instantiation: d2i_BASIC_CONSTRAINTS
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_EXTENDED_KEY_USAGE
Unexecuted instantiation: d2i_ISSUER_SIGN_TOOL
Unexecuted instantiation: d2i_NETSCAPE_CERT_SEQUENCE
Unexecuted instantiation: d2i_PBEPARAM
Unexecuted instantiation: d2i_SCRYPT_PARAMS
829
        int i2d_##fname(const stname *a, unsigned char **out) \
830
5.97k
        { \
831
5.97k
                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
832
5.97k
        }
Unexecuted instantiation: i2d_GOST_KX_MESSAGE
Unexecuted instantiation: i2d_ASN1_TIME
Unexecuted instantiation: i2d_PKCS8_PRIV_KEY_INFO
Unexecuted instantiation: i2d_ASN1_OCTET_STRING
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_ASN1_SEQUENCE_ANY
Unexecuted instantiation: i2d_ASN1_SET_ANY
Unexecuted instantiation: i2d_X509_ALGOR
Unexecuted instantiation: i2d_X509_ALGORS
Unexecuted instantiation: i2d_DHparams
Unexecuted instantiation: i2d_int_dhx
Unexecuted instantiation: i2d_DSAPrivateKey
Unexecuted instantiation: i2d_DSAparams
Unexecuted instantiation: i2d_DSAPublicKey
Unexecuted instantiation: i2d_ECPKPARAMETERS
Unexecuted instantiation: i2d_EC_PRIVATEKEY
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_RSA_PSS_PARAMS
Unexecuted instantiation: i2d_RSA_OAEP_PARAMS
Unexecuted instantiation: i2d_RSAPrivateKey
i2d_RSAPublicKey
Line
Count
Source
830
5.97k
        { \
831
5.97k
                return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
832
5.97k
        }
Unexecuted instantiation: i2d_OTHERNAME
Unexecuted instantiation: i2d_EDIPARTYNAME
Unexecuted instantiation: i2d_GENERAL_NAME
Unexecuted instantiation: i2d_GENERAL_NAMES
Unexecuted instantiation: i2d_ACCESS_DESCRIPTION
Unexecuted instantiation: i2d_AUTHORITY_INFO_ACCESS
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_X509_ATTRIBUTE
Unexecuted instantiation: i2d_X509_REVOKED
Unexecuted instantiation: i2d_X509_CRL_INFO
Unexecuted instantiation: i2d_X509_CRL
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_REQ_INFO
Unexecuted instantiation: i2d_X509_REQ
Unexecuted instantiation: i2d_X509_CINF
Unexecuted instantiation: i2d_X509
Unexecuted instantiation: i2d_X509_CERT_AUX
Unexecuted instantiation: i2d_PBE2PARAM
Unexecuted instantiation: i2d_PBKDF2PARAM
Unexecuted instantiation: i2d_X509_SIG
Unexecuted instantiation: i2d_NETSCAPE_SPKAC
Unexecuted instantiation: i2d_NETSCAPE_SPKI
Unexecuted instantiation: i2d_X509_VAL
Unexecuted instantiation: i2d_PKCS12
Unexecuted instantiation: i2d_PKCS12_MAC_DATA
Unexecuted instantiation: i2d_PKCS12_BAGS
Unexecuted instantiation: i2d_PKCS12_SAFEBAG
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
Unexecuted instantiation: i2d_SM2_Ciphertext
Unexecuted instantiation: i2d_IPAddressRange
Unexecuted instantiation: i2d_IPAddressOrRange
Unexecuted instantiation: i2d_IPAddressChoice
Unexecuted instantiation: i2d_IPAddressFamily
Unexecuted instantiation: i2d_NAMING_AUTHORITY
Unexecuted instantiation: i2d_PROFESSION_INFO
Unexecuted instantiation: i2d_ADMISSIONS
Unexecuted instantiation: i2d_ADMISSION_SYNTAX
Unexecuted instantiation: i2d_AUTHORITY_KEYID
Unexecuted instantiation: i2d_ASRange
Unexecuted instantiation: i2d_ASIdOrRange
Unexecuted instantiation: i2d_ASIdentifierChoice
Unexecuted instantiation: i2d_ASIdentifiers
Unexecuted instantiation: i2d_BASIC_CONSTRAINTS
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_EXTENDED_KEY_USAGE
Unexecuted instantiation: i2d_ISSUER_SIGN_TOOL
Unexecuted instantiation: i2d_NETSCAPE_CERT_SEQUENCE
Unexecuted instantiation: i2d_PBEPARAM
Unexecuted instantiation: i2d_SCRYPT_PARAMS
833
834
# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
835
        int i2d_##stname##_NDEF(const stname *a, unsigned char **out) \
836
0
        { \
837
0
                return ASN1_item_ndef_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
838
0
        }
839
840
# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \
841
        static stname *d2i_##stname(stname **a, \
842
                                   const unsigned char **in, long len) \
843
0
        { \
844
0
                return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
845
0
                                               ASN1_ITEM_rptr(stname)); \
846
0
        } \
847
        static int i2d_##stname(const stname *a, unsigned char **out) \
848
0
        { \
849
0
                return ASN1_item_i2d((const ASN1_VALUE *)a, out, \
850
0
                                     ASN1_ITEM_rptr(stname)); \
851
0
        }
852
853
# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
854
        stname * stname##_dup(const stname *x) \
855
0
        { \
856
0
        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
857
0
        }
Unexecuted instantiation: ASN1_TIME_dup
Unexecuted instantiation: ASN1_UTCTIME_dup
Unexecuted instantiation: X509_ALGOR_dup
Unexecuted instantiation: OCSP_CERTID_dup
Unexecuted instantiation: RSA_PSS_PARAMS_dup
Unexecuted instantiation: X509_ATTRIBUTE_dup
Unexecuted instantiation: X509_REVOKED_dup
Unexecuted instantiation: X509_CRL_dup
Unexecuted instantiation: X509_EXTENSION_dup
Unexecuted instantiation: X509_NAME_ENTRY_dup
Unexecuted instantiation: X509_NAME_dup
Unexecuted instantiation: X509_REQ_dup
Unexecuted instantiation: X509_dup
Unexecuted instantiation: ASN1_GENERALIZEDTIME_dup
Unexecuted instantiation: PKCS7_dup
858
859
# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
860
        IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
861
862
# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
863
        int fname##_print_ctx(BIO *out, const stname *x, int indent, \
864
                                                const ASN1_PCTX *pctx) \
865
0
        { \
866
0
                return ASN1_item_print(out, (const ASN1_VALUE *)x, indent, \
867
0
                        ASN1_ITEM_rptr(itname), pctx); \
868
0
        }
869
870
/* external definitions for primitive types */
871
872
DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
873
DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
874
DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
875
DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
876
DECLARE_ASN1_ITEM(CBIGNUM)
877
DECLARE_ASN1_ITEM(BIGNUM)
878
DECLARE_ASN1_ITEM(INT32)
879
DECLARE_ASN1_ITEM(ZINT32)
880
DECLARE_ASN1_ITEM(UINT32)
881
DECLARE_ASN1_ITEM(ZUINT32)
882
DECLARE_ASN1_ITEM(INT64)
883
DECLARE_ASN1_ITEM(ZINT64)
884
DECLARE_ASN1_ITEM(UINT64)
885
DECLARE_ASN1_ITEM(ZUINT64)
886
887
# ifndef OPENSSL_NO_DEPRECATED_3_0
888
/*
889
 * LONG and ZLONG are strongly discouraged for use as stored data, as the
890
 * underlying C type (long) differs in size depending on the architecture.
891
 * They are designed with 32-bit longs in mind.
892
 */
893
DECLARE_ASN1_ITEM(LONG)
894
DECLARE_ASN1_ITEM(ZLONG)
895
# endif
896
897
SKM_DEFINE_STACK_OF_INTERNAL(ASN1_VALUE, ASN1_VALUE, ASN1_VALUE)
898
0
#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
899
0
#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx)))
900
#define sk_ASN1_VALUE_new(cmp) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new(ossl_check_ASN1_VALUE_compfunc_type(cmp)))
901
0
#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null())
902
#define sk_ASN1_VALUE_new_reserve(cmp, n) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_VALUE_compfunc_type(cmp), (n)))
903
#define sk_ASN1_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_VALUE_sk_type(sk), (n))
904
0
#define sk_ASN1_VALUE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_VALUE_sk_type(sk))
905
#define sk_ASN1_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_VALUE_sk_type(sk))
906
#define sk_ASN1_VALUE_delete(sk, i) ((ASN1_VALUE *)OPENSSL_sk_delete(ossl_check_ASN1_VALUE_sk_type(sk), (i)))
907
#define sk_ASN1_VALUE_delete_ptr(sk, ptr) ((ASN1_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)))
908
0
#define sk_ASN1_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
909
#define sk_ASN1_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
910
0
#define sk_ASN1_VALUE_pop(sk) ((ASN1_VALUE *)OPENSSL_sk_pop(ossl_check_ASN1_VALUE_sk_type(sk)))
911
#define sk_ASN1_VALUE_shift(sk) ((ASN1_VALUE *)OPENSSL_sk_shift(ossl_check_ASN1_VALUE_sk_type(sk)))
912
#define sk_ASN1_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_VALUE_sk_type(sk),ossl_check_ASN1_VALUE_freefunc_type(freefunc))
913
#define sk_ASN1_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), (idx))
914
#define sk_ASN1_VALUE_set(sk, idx, ptr) ((ASN1_VALUE *)OPENSSL_sk_set(ossl_check_ASN1_VALUE_sk_type(sk), (idx), ossl_check_ASN1_VALUE_type(ptr)))
915
#define sk_ASN1_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
916
#define sk_ASN1_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
917
#define sk_ASN1_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), pnum)
918
#define sk_ASN1_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_VALUE_sk_type(sk))
919
#define sk_ASN1_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_VALUE_sk_type(sk))
920
#define sk_ASN1_VALUE_dup(sk) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_VALUE_sk_type(sk)))
921
#define sk_ASN1_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_copyfunc_type(copyfunc), ossl_check_ASN1_VALUE_freefunc_type(freefunc)))
922
#define sk_ASN1_VALUE_set_cmp_func(sk, cmp) ((sk_ASN1_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_compfunc_type(cmp)))
923
924
925
926
/* Functions used internally by the ASN1 code */
927
928
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
929
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
930
931
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
932
                     const ASN1_ITEM *it, int tag, int aclass, char opt,
933
                     ASN1_TLC *ctx);
934
935
int ASN1_item_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
936
                     const ASN1_ITEM *it, int tag, int aclass);
937
938
/* Legacy compatibility */
939
# define IMPLEMENT_ASN1_FUNCTIONS_const(name) IMPLEMENT_ASN1_FUNCTIONS(name)
940
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
941
         IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname)
942
943
#ifdef  __cplusplus
944
}
945
#endif
946
#endif