Line data Source code
1 : /* Generated from /builds/eaglegai/samba/third_party/heimdal/lib/asn1/pkcs8.asn1 */
2 : /* Do not edit */
3 :
4 : #if defined(_WIN32) && !defined(ASN1_LIB)
5 : # error "ASN1_LIB must be defined"
6 : #endif
7 : #include <stdio.h>
8 : #include <stdlib.h>
9 : #include <time.h>
10 : #include <string.h>
11 : #include <errno.h>
12 : #include <limits.h>
13 : #include <krb5-types.h>
14 : #include "pkcs8_asn1.h"
15 : #include "pkcs8_asn1-priv.h"
16 : #include <asn1_err.h>
17 : #include <der.h>
18 : #include <asn1-template.h>
19 :
20 : #include <parse_units.h>
21 :
22 : static const struct asn1_type_func asn1_extern_Attribute = {
23 : (asn1_type_encode)encode_Attribute,
24 : (asn1_type_decode)decode_Attribute,
25 : (asn1_type_length)length_Attribute,
26 : (asn1_type_copy)copy_Attribute,
27 : (asn1_type_release)free_Attribute,
28 : (asn1_type_print)print_Attribute,
29 : sizeof(Attribute)
30 : };
31 : static const struct asn1_type_func asn1_extern_AlgorithmIdentifier = {
32 : (asn1_type_encode)encode_AlgorithmIdentifier,
33 : (asn1_type_decode)decode_AlgorithmIdentifier,
34 : (asn1_type_length)length_AlgorithmIdentifier,
35 : (asn1_type_copy)copy_AlgorithmIdentifier,
36 : (asn1_type_release)free_AlgorithmIdentifier,
37 : (asn1_type_print)print_AlgorithmIdentifier,
38 : sizeof(AlgorithmIdentifier)
39 : };
40 : extern const struct asn1_template asn1_PKCS8PrivateKeyAlgorithmIdentifier[];
41 : extern const struct asn1_template asn1_PKCS8PrivateKeyAlgorithmIdentifier[];
42 : extern const struct asn1_template asn1_PKCS8PrivateKey[];
43 : extern const struct asn1_template asn1_PKCS8PrivateKey[];
44 : extern const struct asn1_template asn1_PKCS8Attributes[];
45 : extern const struct asn1_template asn1_PKCS8PrivateKeyInfo[];
46 : extern const struct asn1_template asn1_PKCS8EncryptedData[];
47 : extern const struct asn1_template asn1_PKCS8EncryptedData[];
48 : extern const struct asn1_template asn1_PKCS8EncryptedPrivateKeyInfo[];
49 : /* generate_template_type: PKCS8PrivateKeyAlgorithmIdentifier */
50 : const struct asn1_template asn1_PKCS8PrivateKeyAlgorithmIdentifier[] = {
51 : /* 0 */ { 0, sizeof(PKCS8PrivateKeyAlgorithmIdentifier), ((void *)(uintptr_t)1) },
52 : /* 1 */ { A1_OP_TYPE_EXTERN , 0, &asn1_extern_AlgorithmIdentifier}
53 : };
54 :
55 : int ASN1CALL
56 0 : decode_PKCS8PrivateKeyAlgorithmIdentifier(const unsigned char *p, size_t len, PKCS8PrivateKeyAlgorithmIdentifier *data, size_t *size)
57 : {
58 0 : memset(data, 0, sizeof(*data));
59 0 : return _asn1_decode_top(asn1_PKCS8PrivateKeyAlgorithmIdentifier, 0|0, p, len, data, size);
60 : }
61 :
62 :
63 : int ASN1CALL
64 0 : encode_PKCS8PrivateKeyAlgorithmIdentifier(unsigned char *p, size_t len, const PKCS8PrivateKeyAlgorithmIdentifier *data, size_t *size)
65 : {
66 0 : return _asn1_encode(asn1_PKCS8PrivateKeyAlgorithmIdentifier, p, len, data, size);
67 : }
68 :
69 :
70 : size_t ASN1CALL
71 0 : length_PKCS8PrivateKeyAlgorithmIdentifier(const PKCS8PrivateKeyAlgorithmIdentifier *data)
72 : {
73 0 : return _asn1_length(asn1_PKCS8PrivateKeyAlgorithmIdentifier, data);
74 : }
75 :
76 :
77 : void ASN1CALL
78 0 : free_PKCS8PrivateKeyAlgorithmIdentifier(PKCS8PrivateKeyAlgorithmIdentifier *data)
79 : {
80 0 : _asn1_free_top(asn1_PKCS8PrivateKeyAlgorithmIdentifier, data);
81 0 : }
82 :
83 :
84 : int ASN1CALL
85 0 : copy_PKCS8PrivateKeyAlgorithmIdentifier(const PKCS8PrivateKeyAlgorithmIdentifier *from, PKCS8PrivateKeyAlgorithmIdentifier *to)
86 : {
87 0 : return _asn1_copy_top(asn1_PKCS8PrivateKeyAlgorithmIdentifier, from, to);
88 : }
89 :
90 :
91 : char * ASN1CALL
92 0 : print_PKCS8PrivateKeyAlgorithmIdentifier(const PKCS8PrivateKeyAlgorithmIdentifier *data, int flags)
93 : {
94 0 : return _asn1_print_top(asn1_PKCS8PrivateKeyAlgorithmIdentifier, flags, data);
95 : }
96 :
97 : /* template_members: PKCS8PrivateKey exp exp */
98 : /* generate_template_type: PKCS8PrivateKey_tag__0 */
99 : const struct asn1_template asn1_PKCS8PrivateKey_tag__0[] = {
100 : /* 0 */ { 0, sizeof(heim_octet_string), ((void *)(uintptr_t)1) },
101 : /* 1 */ { A1_PARSE_T(A1T_OCTET_STRING), 0, NULL }
102 : };
103 : /* generate_template_type: PKCS8PrivateKey */
104 : const struct asn1_template asn1_PKCS8PrivateKey[] = {
105 : /* 0 */ { 0, sizeof(PKCS8PrivateKey), ((void *)(uintptr_t)1) },
106 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,PRIM,UT_OctetString), 0, asn1_PKCS8PrivateKey_tag__0 }
107 : };
108 :
109 : int ASN1CALL
110 0 : decode_PKCS8PrivateKey(const unsigned char *p, size_t len, PKCS8PrivateKey *data, size_t *size)
111 : {
112 0 : memset(data, 0, sizeof(*data));
113 0 : return _asn1_decode_top(asn1_PKCS8PrivateKey, 0|0, p, len, data, size);
114 : }
115 :
116 :
117 : int ASN1CALL
118 0 : encode_PKCS8PrivateKey(unsigned char *p, size_t len, const PKCS8PrivateKey *data, size_t *size)
119 : {
120 0 : return _asn1_encode(asn1_PKCS8PrivateKey, p, len, data, size);
121 : }
122 :
123 :
124 : size_t ASN1CALL
125 0 : length_PKCS8PrivateKey(const PKCS8PrivateKey *data)
126 : {
127 0 : return _asn1_length(asn1_PKCS8PrivateKey, data);
128 : }
129 :
130 :
131 : void ASN1CALL
132 0 : free_PKCS8PrivateKey(PKCS8PrivateKey *data)
133 : {
134 0 : _asn1_free_top(asn1_PKCS8PrivateKey, data);
135 0 : }
136 :
137 :
138 : int ASN1CALL
139 0 : copy_PKCS8PrivateKey(const PKCS8PrivateKey *from, PKCS8PrivateKey *to)
140 : {
141 0 : return _asn1_copy_top(asn1_PKCS8PrivateKey, from, to);
142 : }
143 :
144 :
145 : char * ASN1CALL
146 0 : print_PKCS8PrivateKey(const PKCS8PrivateKey *data, int flags)
147 : {
148 0 : return _asn1_print_top(asn1_PKCS8PrivateKey, flags, data);
149 : }
150 :
151 : /* template_members: PKCS8Attributes exp exp */
152 : /* generate_template_type: Attribute_seofTstruct_0 */
153 : const struct asn1_template asn1_Attribute_seofTstruct_0[] = {
154 : /* 0 */ { 0, sizeof(Attribute), ((void *)(uintptr_t)1) },
155 : /* 1 */ { A1_OP_TYPE_EXTERN , 0, &asn1_extern_Attribute}
156 : };
157 : /* generate_template_type: PKCS8Attributes_tag__1 */
158 : const struct asn1_template asn1_PKCS8Attributes_tag__1[] = {
159 : /* 0 */ { 0, sizeof(Attribute), ((void *)(uintptr_t)1) },
160 : /* 1 */ { A1_OP_SETOF, 0, asn1_Attribute_seofTstruct_0 }
161 : };
162 : /* generate_template_type: PKCS8Attributes */
163 : const struct asn1_template asn1_PKCS8Attributes[] = {
164 : /* 0 */ { 0, sizeof(PKCS8Attributes), ((void *)(uintptr_t)1) },
165 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,CONS,UT_Set), 0, asn1_PKCS8Attributes_tag__1 }
166 : };
167 :
168 : int ASN1CALL
169 0 : decode_PKCS8Attributes(const unsigned char *p, size_t len, PKCS8Attributes *data, size_t *size)
170 : {
171 0 : memset(data, 0, sizeof(*data));
172 0 : return _asn1_decode_top(asn1_PKCS8Attributes, 0|0, p, len, data, size);
173 : }
174 :
175 :
176 : int ASN1CALL
177 0 : encode_PKCS8Attributes(unsigned char *p, size_t len, const PKCS8Attributes *data, size_t *size)
178 : {
179 0 : return _asn1_encode(asn1_PKCS8Attributes, p, len, data, size);
180 : }
181 :
182 :
183 : size_t ASN1CALL
184 0 : length_PKCS8Attributes(const PKCS8Attributes *data)
185 : {
186 0 : return _asn1_length(asn1_PKCS8Attributes, data);
187 : }
188 :
189 :
190 : void ASN1CALL
191 0 : free_PKCS8Attributes(PKCS8Attributes *data)
192 : {
193 0 : _asn1_free_top(asn1_PKCS8Attributes, data);
194 0 : }
195 :
196 :
197 : int ASN1CALL
198 0 : copy_PKCS8Attributes(const PKCS8Attributes *from, PKCS8Attributes *to)
199 : {
200 0 : return _asn1_copy_top(asn1_PKCS8Attributes, from, to);
201 : }
202 :
203 :
204 : char * ASN1CALL
205 0 : print_PKCS8Attributes(const PKCS8Attributes *data, int flags)
206 : {
207 0 : return _asn1_print_top(asn1_PKCS8Attributes, flags, data);
208 : }
209 :
210 : /* template_members: PKCS8PrivateKeyInfo exp exp */
211 : /* tsequence: members isstruct: 1 */
212 : /* template_members: PKCS8PrivateKeyInfo exp exp */
213 : /* generate_template_type: PKCS8PrivateKeyInfo_tag_version_3 */
214 : const struct asn1_template asn1_PKCS8PrivateKeyInfo_tag_version_3[] = {
215 : /* 0 */ { 0, sizeof(heim_integer), ((void *)(uintptr_t)1) },
216 : /* 1 */ { A1_PARSE_T(A1T_HEIM_INTEGER), 0, NULL }
217 : };
218 : /* template_members: PKCS8PrivateKeyInfo exp imp */
219 : /* template_members: PKCS8PrivateKeyInfo exp exp */
220 : /* generate_template_type: PKCS8PrivateKeyInfo_attributes_1 */
221 : /* generate_template_type: PKCS8PrivateKeyInfo_tag_attributes_5 */
222 : const struct asn1_template asn1_PKCS8PrivateKeyInfo_tag_attributes_5[] = {
223 : /* 0 */ { 0, sizeof(struct PKCS8PrivateKeyInfo_attributes), ((void *)(uintptr_t)1) },
224 : /* 1 */ { A1_OP_SETOF, 0, asn1_Attribute_seofTstruct_0 }
225 : };
226 : /* generate_template_type: PKCS8PrivateKeyInfo_tag_attributes_4 */
227 : const struct asn1_template asn1_PKCS8PrivateKeyInfo_tag_attributes_4[] = {
228 : /* 0 */ { 0, sizeof(struct PKCS8PrivateKeyInfo_attributes), ((void *)(uintptr_t)1) },
229 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,CONS,UT_Set), 0, asn1_PKCS8PrivateKeyInfo_tag_attributes_5 }
230 : };
231 : /* generate_template_type: PKCS8PrivateKeyInfo_tag__2 */
232 : const struct asn1_template asn1_PKCS8PrivateKeyInfo_tag__2[] = {
233 : /* 0 */ { 0, sizeof(struct PKCS8PrivateKeyInfo), ((void *)(uintptr_t)9) },
234 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,PRIM,UT_Integer), offsetof(struct PKCS8PrivateKeyInfo, version), asn1_PKCS8PrivateKeyInfo_tag_version_3 },
235 : /* 2 */ { A1_OP_TYPE , offsetof(struct PKCS8PrivateKeyInfo, privateKeyAlgorithm), asn1_PKCS8PrivateKeyAlgorithmIdentifier },
236 : /* 3 */ { A1_OP_TYPE , offsetof(struct PKCS8PrivateKeyInfo, privateKey), asn1_PKCS8PrivateKey },
237 : /* 4 */ { A1_TAG_T(ASN1_C_CONTEXT,CONS,0)|A1_FLAG_OPTIONAL|A1_FLAG_IMPLICIT, offsetof(struct PKCS8PrivateKeyInfo, attributes), asn1_PKCS8PrivateKeyInfo_tag_attributes_4 },
238 : /* 5 */ { A1_OP_NAME, 0, "PKCS8PrivateKeyInfo" },
239 : /* 6 */ { A1_OP_NAME, 0, "version" },
240 : /* 7 */ { A1_OP_NAME, 0, "privateKeyAlgorithm" },
241 : /* 8 */ { A1_OP_NAME, 0, "privateKey" },
242 : /* 9 */ { A1_OP_NAME, 0, "attributes" }
243 : };
244 : /* generate_template_type: PKCS8PrivateKeyInfo */
245 : const struct asn1_template asn1_PKCS8PrivateKeyInfo[] = {
246 : /* 0 */ { 0, sizeof(PKCS8PrivateKeyInfo), ((void *)(uintptr_t)1) },
247 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,CONS,UT_Sequence), 0, asn1_PKCS8PrivateKeyInfo_tag__2 }
248 : };
249 :
250 : int ASN1CALL
251 0 : decode_PKCS8PrivateKeyInfo(const unsigned char *p, size_t len, PKCS8PrivateKeyInfo *data, size_t *size)
252 : {
253 0 : memset(data, 0, sizeof(*data));
254 0 : return _asn1_decode_top(asn1_PKCS8PrivateKeyInfo, 0|0, p, len, data, size);
255 : }
256 :
257 :
258 : int ASN1CALL
259 0 : encode_PKCS8PrivateKeyInfo(unsigned char *p, size_t len, const PKCS8PrivateKeyInfo *data, size_t *size)
260 : {
261 0 : return _asn1_encode(asn1_PKCS8PrivateKeyInfo, p, len, data, size);
262 : }
263 :
264 :
265 : size_t ASN1CALL
266 0 : length_PKCS8PrivateKeyInfo(const PKCS8PrivateKeyInfo *data)
267 : {
268 0 : return _asn1_length(asn1_PKCS8PrivateKeyInfo, data);
269 : }
270 :
271 :
272 : void ASN1CALL
273 0 : free_PKCS8PrivateKeyInfo(PKCS8PrivateKeyInfo *data)
274 : {
275 0 : _asn1_free_top(asn1_PKCS8PrivateKeyInfo, data);
276 0 : }
277 :
278 :
279 : int ASN1CALL
280 0 : copy_PKCS8PrivateKeyInfo(const PKCS8PrivateKeyInfo *from, PKCS8PrivateKeyInfo *to)
281 : {
282 0 : return _asn1_copy_top(asn1_PKCS8PrivateKeyInfo, from, to);
283 : }
284 :
285 :
286 : char * ASN1CALL
287 0 : print_PKCS8PrivateKeyInfo(const PKCS8PrivateKeyInfo *data, int flags)
288 : {
289 0 : return _asn1_print_top(asn1_PKCS8PrivateKeyInfo, flags, data);
290 : }
291 :
292 : /* template_members: PKCS8EncryptedData exp exp */
293 : /* generate_template_type: PKCS8EncryptedData_tag__6 */
294 : /* generate_template_type: PKCS8EncryptedData */
295 : const struct asn1_template asn1_PKCS8EncryptedData[] = {
296 : /* 0 */ { 0, sizeof(PKCS8EncryptedData), ((void *)(uintptr_t)1) },
297 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,PRIM,UT_OctetString), 0, asn1_PKCS8PrivateKey_tag__0 }
298 : };
299 :
300 : int ASN1CALL
301 0 : decode_PKCS8EncryptedData(const unsigned char *p, size_t len, PKCS8EncryptedData *data, size_t *size)
302 : {
303 0 : memset(data, 0, sizeof(*data));
304 0 : return _asn1_decode_top(asn1_PKCS8EncryptedData, 0|0, p, len, data, size);
305 : }
306 :
307 :
308 : int ASN1CALL
309 0 : encode_PKCS8EncryptedData(unsigned char *p, size_t len, const PKCS8EncryptedData *data, size_t *size)
310 : {
311 0 : return _asn1_encode(asn1_PKCS8EncryptedData, p, len, data, size);
312 : }
313 :
314 :
315 : size_t ASN1CALL
316 0 : length_PKCS8EncryptedData(const PKCS8EncryptedData *data)
317 : {
318 0 : return _asn1_length(asn1_PKCS8EncryptedData, data);
319 : }
320 :
321 :
322 : void ASN1CALL
323 0 : free_PKCS8EncryptedData(PKCS8EncryptedData *data)
324 : {
325 0 : _asn1_free_top(asn1_PKCS8EncryptedData, data);
326 0 : }
327 :
328 :
329 : int ASN1CALL
330 0 : copy_PKCS8EncryptedData(const PKCS8EncryptedData *from, PKCS8EncryptedData *to)
331 : {
332 0 : return _asn1_copy_top(asn1_PKCS8EncryptedData, from, to);
333 : }
334 :
335 :
336 : char * ASN1CALL
337 0 : print_PKCS8EncryptedData(const PKCS8EncryptedData *data, int flags)
338 : {
339 0 : return _asn1_print_top(asn1_PKCS8EncryptedData, flags, data);
340 : }
341 :
342 : /* template_members: PKCS8EncryptedPrivateKeyInfo exp exp */
343 : /* tsequence: members isstruct: 1 */
344 : /* generate_template_type: PKCS8EncryptedPrivateKeyInfo_tag__7 */
345 : const struct asn1_template asn1_PKCS8EncryptedPrivateKeyInfo_tag__7[] = {
346 : /* 0 */ { 0, sizeof(struct PKCS8EncryptedPrivateKeyInfo), ((void *)(uintptr_t)5) },
347 : /* 1 */ { A1_OP_TYPE_EXTERN , offsetof(struct PKCS8EncryptedPrivateKeyInfo, encryptionAlgorithm), &asn1_extern_AlgorithmIdentifier},
348 : /* 2 */ { A1_OP_TYPE , offsetof(struct PKCS8EncryptedPrivateKeyInfo, encryptedData), asn1_PKCS8EncryptedData },
349 : /* 3 */ { A1_OP_NAME, 0, "PKCS8EncryptedPrivateKeyInfo" },
350 : /* 4 */ { A1_OP_NAME, 0, "encryptionAlgorithm" },
351 : /* 5 */ { A1_OP_NAME, 0, "encryptedData" }
352 : };
353 : /* generate_template_type: PKCS8EncryptedPrivateKeyInfo */
354 : const struct asn1_template asn1_PKCS8EncryptedPrivateKeyInfo[] = {
355 : /* 0 */ { 0, sizeof(PKCS8EncryptedPrivateKeyInfo), ((void *)(uintptr_t)1) },
356 : /* 1 */ { A1_TAG_T(ASN1_C_UNIV,CONS,UT_Sequence), 0, asn1_PKCS8EncryptedPrivateKeyInfo_tag__7 }
357 : };
358 :
359 : int ASN1CALL
360 0 : decode_PKCS8EncryptedPrivateKeyInfo(const unsigned char *p, size_t len, PKCS8EncryptedPrivateKeyInfo *data, size_t *size)
361 : {
362 0 : memset(data, 0, sizeof(*data));
363 0 : return _asn1_decode_top(asn1_PKCS8EncryptedPrivateKeyInfo, 0|0, p, len, data, size);
364 : }
365 :
366 :
367 : int ASN1CALL
368 0 : encode_PKCS8EncryptedPrivateKeyInfo(unsigned char *p, size_t len, const PKCS8EncryptedPrivateKeyInfo *data, size_t *size)
369 : {
370 0 : return _asn1_encode(asn1_PKCS8EncryptedPrivateKeyInfo, p, len, data, size);
371 : }
372 :
373 :
374 : size_t ASN1CALL
375 0 : length_PKCS8EncryptedPrivateKeyInfo(const PKCS8EncryptedPrivateKeyInfo *data)
376 : {
377 0 : return _asn1_length(asn1_PKCS8EncryptedPrivateKeyInfo, data);
378 : }
379 :
380 :
381 : void ASN1CALL
382 0 : free_PKCS8EncryptedPrivateKeyInfo(PKCS8EncryptedPrivateKeyInfo *data)
383 : {
384 0 : _asn1_free_top(asn1_PKCS8EncryptedPrivateKeyInfo, data);
385 0 : }
386 :
387 :
388 : int ASN1CALL
389 0 : copy_PKCS8EncryptedPrivateKeyInfo(const PKCS8EncryptedPrivateKeyInfo *from, PKCS8EncryptedPrivateKeyInfo *to)
390 : {
391 0 : return _asn1_copy_top(asn1_PKCS8EncryptedPrivateKeyInfo, from, to);
392 : }
393 :
394 :
395 : char * ASN1CALL
396 0 : print_PKCS8EncryptedPrivateKeyInfo(const PKCS8EncryptedPrivateKeyInfo *data, int flags)
397 : {
398 0 : return _asn1_print_top(asn1_PKCS8EncryptedPrivateKeyInfo, flags, data);
399 : }
400 :
|