GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libcrypto/crypto/../../libssl/src/crypto/krb5/krb5_asn.c Lines: 0 44 0.0 %
Date: 2016-12-06 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: krb5_asn.c,v 1.4 2015/07/25 14:49:45 jsing Exp $ */
2
/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project,
3
** using ocsp/{*.h,*asn*.c} as a starting point
4
*/
5
/* ====================================================================
6
 * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions
10
 * are met:
11
 *
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 *
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19
 *
20
 * 3. All advertising materials mentioning features or use of this
21
 *    software must display the following acknowledgment:
22
 *    "This product includes software developed by the OpenSSL Project
23
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24
 *
25
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    licensing@OpenSSL.org.
29
 *
30
 * 5. Products derived from this software may not be called "OpenSSL"
31
 *    nor may "OpenSSL" appear in their names without prior written
32
 *    permission of the OpenSSL Project.
33
 *
34
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36
 *    "This product includes software developed by the OpenSSL Project
37
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38
 *
39
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50
 * OF THE POSSIBILITY OF SUCH DAMAGE.
51
 * ====================================================================
52
 *
53
 * This product includes cryptographic software written by Eric Young
54
 * (eay@cryptsoft.com).  This product includes software written by Tim
55
 * Hudson (tjh@cryptsoft.com).
56
 *
57
 */
58
#include <openssl/asn1.h>
59
#include <openssl/asn1t.h>
60
#include <openssl/krb5_asn.h>
61
62
63
static const ASN1_TEMPLATE KRB5_ENCDATA_seq_tt[] = {
64
	{
65
		.flags = ASN1_TFLG_EXPLICIT,
66
		.tag = 0,
67
		.offset = offsetof(KRB5_ENCDATA, etype),
68
		.field_name = "etype",
69
		.item = &ASN1_INTEGER_it,
70
	},
71
	{
72
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL,
73
		.tag = 1,
74
		.offset = offsetof(KRB5_ENCDATA, kvno),
75
		.field_name = "kvno",
76
		.item = &ASN1_INTEGER_it,
77
	},
78
	{
79
		.flags = ASN1_TFLG_EXPLICIT,
80
		.tag = 2,
81
		.offset = offsetof(KRB5_ENCDATA, cipher),
82
		.field_name = "cipher",
83
		.item = &ASN1_OCTET_STRING_it,
84
	},
85
};
86
87
const ASN1_ITEM KRB5_ENCDATA_it = {
88
	.itype = ASN1_ITYPE_SEQUENCE,
89
	.utype = V_ASN1_SEQUENCE,
90
	.templates = KRB5_ENCDATA_seq_tt,
91
	.tcount = sizeof(KRB5_ENCDATA_seq_tt) / sizeof(ASN1_TEMPLATE),
92
	.funcs = NULL,
93
	.size = sizeof(KRB5_ENCDATA),
94
	.sname = "KRB5_ENCDATA",
95
};
96
97
98
KRB5_ENCDATA *
99
d2i_KRB5_ENCDATA(KRB5_ENCDATA **a, const unsigned char **in, long len)
100
{
101
	return (KRB5_ENCDATA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
102
	    &KRB5_ENCDATA_it);
103
}
104
105
int
106
i2d_KRB5_ENCDATA(KRB5_ENCDATA *a, unsigned char **out)
107
{
108
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_ENCDATA_it);
109
}
110
111
KRB5_ENCDATA *
112
KRB5_ENCDATA_new(void)
113
{
114
	return (KRB5_ENCDATA *)ASN1_item_new(&KRB5_ENCDATA_it);
115
}
116
117
void
118
KRB5_ENCDATA_free(KRB5_ENCDATA *a)
119
{
120
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_ENCDATA_it);
121
}
122
123
124
static const ASN1_TEMPLATE KRB5_PRINCNAME_seq_tt[] = {
125
	{
126
		.flags = ASN1_TFLG_EXPLICIT,
127
		.tag = 0,
128
		.offset = offsetof(KRB5_PRINCNAME, nametype),
129
		.field_name = "nametype",
130
		.item = &ASN1_INTEGER_it,
131
	},
132
	{
133
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_SEQUENCE_OF,
134
		.tag = 1,
135
		.offset = offsetof(KRB5_PRINCNAME, namestring),
136
		.field_name = "namestring",
137
		.item = &ASN1_GENERALSTRING_it,
138
	},
139
};
140
141
const ASN1_ITEM KRB5_PRINCNAME_it = {
142
	.itype = ASN1_ITYPE_SEQUENCE,
143
	.utype = V_ASN1_SEQUENCE,
144
	.templates = KRB5_PRINCNAME_seq_tt,
145
	.tcount = sizeof(KRB5_PRINCNAME_seq_tt) / sizeof(ASN1_TEMPLATE),
146
	.funcs = NULL,
147
	.size = sizeof(KRB5_PRINCNAME),
148
	.sname = "KRB5_PRINCNAME",
149
};
150
151
152
KRB5_PRINCNAME *
153
d2i_KRB5_PRINCNAME(KRB5_PRINCNAME **a, const unsigned char **in, long len)
154
{
155
	return (KRB5_PRINCNAME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
156
	    &KRB5_PRINCNAME_it);
157
}
158
159
int
160
i2d_KRB5_PRINCNAME(KRB5_PRINCNAME *a, unsigned char **out)
161
{
162
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_PRINCNAME_it);
163
}
164
165
KRB5_PRINCNAME *
166
KRB5_PRINCNAME_new(void)
167
{
168
	return (KRB5_PRINCNAME *)ASN1_item_new(&KRB5_PRINCNAME_it);
169
}
170
171
void
172
KRB5_PRINCNAME_free(KRB5_PRINCNAME *a)
173
{
174
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_PRINCNAME_it);
175
}
176
177
178
/* [APPLICATION 1] = 0x61 */
179
static const ASN1_TEMPLATE KRB5_TKTBODY_seq_tt[] = {
180
	{
181
		.flags = ASN1_TFLG_EXPLICIT,
182
		.tag = 0,
183
		.offset = offsetof(KRB5_TKTBODY, tktvno),
184
		.field_name = "tktvno",
185
		.item = &ASN1_INTEGER_it,
186
	},
187
	{
188
		.flags = ASN1_TFLG_EXPLICIT,
189
		.tag = 1,
190
		.offset = offsetof(KRB5_TKTBODY, realm),
191
		.field_name = "realm",
192
		.item = &ASN1_GENERALSTRING_it,
193
	},
194
	{
195
		.flags = ASN1_TFLG_EXPLICIT,
196
		.tag = 2,
197
		.offset = offsetof(KRB5_TKTBODY, sname),
198
		.field_name = "sname",
199
		.item = &KRB5_PRINCNAME_it,
200
	},
201
	{
202
		.flags = ASN1_TFLG_EXPLICIT,
203
		.tag = 3,
204
		.offset = offsetof(KRB5_TKTBODY, encdata),
205
		.field_name = "encdata",
206
		.item = &KRB5_ENCDATA_it,
207
	},
208
};
209
210
const ASN1_ITEM KRB5_TKTBODY_it = {
211
	.itype = ASN1_ITYPE_SEQUENCE,
212
	.utype = V_ASN1_SEQUENCE,
213
	.templates = KRB5_TKTBODY_seq_tt,
214
	.tcount = sizeof(KRB5_TKTBODY_seq_tt) / sizeof(ASN1_TEMPLATE),
215
	.funcs = NULL,
216
	.size = sizeof(KRB5_TKTBODY),
217
	.sname = "KRB5_TKTBODY",
218
};
219
220
221
KRB5_TKTBODY *
222
d2i_KRB5_TKTBODY(KRB5_TKTBODY **a, const unsigned char **in, long len)
223
{
224
	return (KRB5_TKTBODY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
225
	    &KRB5_TKTBODY_it);
226
}
227
228
int
229
i2d_KRB5_TKTBODY(KRB5_TKTBODY *a, unsigned char **out)
230
{
231
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_TKTBODY_it);
232
}
233
234
KRB5_TKTBODY *
235
KRB5_TKTBODY_new(void)
236
{
237
	return (KRB5_TKTBODY *)ASN1_item_new(&KRB5_TKTBODY_it);
238
}
239
240
void
241
KRB5_TKTBODY_free(KRB5_TKTBODY *a)
242
{
243
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_TKTBODY_it);
244
}
245
246
247
static const ASN1_TEMPLATE KRB5_TICKET_item_tt =  {
248
	.flags = ASN1_TFLG_EXPTAG | ASN1_TFLG_APPLICATION,
249
	.tag = 1,
250
	.offset = 0,
251
	.field_name = "KRB5_TICKET",
252
	.item = &KRB5_TKTBODY_it,
253
};
254
255
const ASN1_ITEM KRB5_TICKET_it = {
256
	.itype = ASN1_ITYPE_PRIMITIVE,
257
	.utype = -1,
258
	.templates = &KRB5_TICKET_item_tt,
259
	.tcount = 0,
260
	.funcs = NULL,
261
	.size = 0,
262
	.sname = "KRB5_TICKET",
263
};
264
265
266
KRB5_TICKET *
267
d2i_KRB5_TICKET(KRB5_TICKET **a, const unsigned char **in, long len)
268
{
269
	return (KRB5_TICKET *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
270
	    &KRB5_TICKET_it);
271
}
272
273
int
274
i2d_KRB5_TICKET(KRB5_TICKET *a, unsigned char **out)
275
{
276
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_TICKET_it);
277
}
278
279
KRB5_TICKET *
280
KRB5_TICKET_new(void)
281
{
282
	return (KRB5_TICKET *)ASN1_item_new(&KRB5_TICKET_it);
283
}
284
285
void
286
KRB5_TICKET_free(KRB5_TICKET *a)
287
{
288
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_TICKET_it);
289
}
290
291
292
/* [APPLICATION 14] = 0x6e */
293
static const ASN1_TEMPLATE KRB5_APREQBODY_seq_tt[] = {
294
	{
295
		.flags = ASN1_TFLG_EXPLICIT,
296
		.tag = 0,
297
		.offset = offsetof(KRB5_APREQBODY, pvno),
298
		.field_name = "pvno",
299
		.item = &ASN1_INTEGER_it,
300
	},
301
	{
302
		.flags = ASN1_TFLG_EXPLICIT,
303
		.tag = 1,
304
		.offset = offsetof(KRB5_APREQBODY, msgtype),
305
		.field_name = "msgtype",
306
		.item = &ASN1_INTEGER_it,
307
	},
308
	{
309
		.flags = ASN1_TFLG_EXPLICIT,
310
		.tag = 2,
311
		.offset = offsetof(KRB5_APREQBODY, apoptions),
312
		.field_name = "apoptions",
313
		.item = &ASN1_BIT_STRING_it,
314
	},
315
	{
316
		.flags = ASN1_TFLG_EXPLICIT,
317
		.tag = 3,
318
		.offset = offsetof(KRB5_APREQBODY, ticket),
319
		.field_name = "ticket",
320
		.item = &KRB5_TICKET_it,
321
	},
322
	{
323
		.flags = ASN1_TFLG_EXPLICIT,
324
		.tag = 4,
325
		.offset = offsetof(KRB5_APREQBODY, authenticator),
326
		.field_name = "authenticator",
327
		.item = &KRB5_ENCDATA_it,
328
	},
329
};
330
331
const ASN1_ITEM KRB5_APREQBODY_it = {
332
	.itype = ASN1_ITYPE_SEQUENCE,
333
	.utype = V_ASN1_SEQUENCE,
334
	.templates = KRB5_APREQBODY_seq_tt,
335
	.tcount = sizeof(KRB5_APREQBODY_seq_tt) / sizeof(ASN1_TEMPLATE),
336
	.funcs = NULL,
337
	.size = sizeof(KRB5_APREQBODY),
338
	.sname = "KRB5_APREQBODY",
339
};
340
341
342
KRB5_APREQBODY *
343
d2i_KRB5_APREQBODY(KRB5_APREQBODY **a, const unsigned char **in, long len)
344
{
345
	return (KRB5_APREQBODY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
346
	    &KRB5_APREQBODY_it);
347
}
348
349
int
350
i2d_KRB5_APREQBODY(KRB5_APREQBODY *a, unsigned char **out)
351
{
352
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_APREQBODY_it);
353
}
354
355
KRB5_APREQBODY *
356
KRB5_APREQBODY_new(void)
357
{
358
	return (KRB5_APREQBODY *)ASN1_item_new(&KRB5_APREQBODY_it);
359
}
360
361
void
362
KRB5_APREQBODY_free(KRB5_APREQBODY *a)
363
{
364
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_APREQBODY_it);
365
}
366
367
static const ASN1_TEMPLATE KRB5_APREQ_item_tt =  {
368
	.flags = ASN1_TFLG_EXPTAG | ASN1_TFLG_APPLICATION,
369
	.tag = 14,
370
	.offset = 0,
371
	.field_name = "KRB5_APREQ",
372
	.item = &KRB5_APREQBODY_it,
373
};
374
375
const ASN1_ITEM KRB5_APREQ_it = {
376
	.itype = ASN1_ITYPE_PRIMITIVE,
377
	.utype = -1,
378
	.templates = &KRB5_APREQ_item_tt,
379
	.tcount = 0,
380
	.funcs = NULL,
381
	.size = 0,
382
	.sname = "KRB5_APREQ",
383
};
384
385
386
KRB5_APREQ *
387
d2i_KRB5_APREQ(KRB5_APREQ **a, const unsigned char **in, long len)
388
{
389
	return (KRB5_APREQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
390
	    &KRB5_APREQ_it);
391
}
392
393
int
394
i2d_KRB5_APREQ(KRB5_APREQ *a, unsigned char **out)
395
{
396
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_APREQ_it);
397
}
398
399
KRB5_APREQ *
400
KRB5_APREQ_new(void)
401
{
402
	return (KRB5_APREQ *)ASN1_item_new(&KRB5_APREQ_it);
403
}
404
405
void
406
KRB5_APREQ_free(KRB5_APREQ *a)
407
{
408
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_APREQ_it);
409
}
410
411
412
/*  Authenticator stuff 	*/
413
414
static const ASN1_TEMPLATE KRB5_CHECKSUM_seq_tt[] = {
415
	{
416
		.flags = ASN1_TFLG_EXPLICIT,
417
		.tag = 0,
418
		.offset = offsetof(KRB5_CHECKSUM, ctype),
419
		.field_name = "ctype",
420
		.item = &ASN1_INTEGER_it,
421
	},
422
	{
423
		.flags = ASN1_TFLG_EXPLICIT,
424
		.tag = 1,
425
		.offset = offsetof(KRB5_CHECKSUM, checksum),
426
		.field_name = "checksum",
427
		.item = &ASN1_OCTET_STRING_it,
428
	},
429
};
430
431
const ASN1_ITEM KRB5_CHECKSUM_it = {
432
	.itype = ASN1_ITYPE_SEQUENCE,
433
	.utype = V_ASN1_SEQUENCE,
434
	.templates = KRB5_CHECKSUM_seq_tt,
435
	.tcount = sizeof(KRB5_CHECKSUM_seq_tt) / sizeof(ASN1_TEMPLATE),
436
	.funcs = NULL,
437
	.size = sizeof(KRB5_CHECKSUM),
438
	.sname = "KRB5_CHECKSUM",
439
};
440
441
442
KRB5_CHECKSUM *
443
d2i_KRB5_CHECKSUM(KRB5_CHECKSUM **a, const unsigned char **in, long len)
444
{
445
	return (KRB5_CHECKSUM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
446
	    &KRB5_CHECKSUM_it);
447
}
448
449
int
450
i2d_KRB5_CHECKSUM(KRB5_CHECKSUM *a, unsigned char **out)
451
{
452
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_CHECKSUM_it);
453
}
454
455
KRB5_CHECKSUM *
456
KRB5_CHECKSUM_new(void)
457
{
458
	return (KRB5_CHECKSUM *)ASN1_item_new(&KRB5_CHECKSUM_it);
459
}
460
461
void
462
KRB5_CHECKSUM_free(KRB5_CHECKSUM *a)
463
{
464
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_CHECKSUM_it);
465
}
466
467
468
static const ASN1_TEMPLATE KRB5_ENCKEY_seq_tt[] = {
469
	{
470
		.flags = ASN1_TFLG_EXPLICIT,
471
		.tag = 0,
472
		.offset = offsetof(KRB5_ENCKEY, ktype),
473
		.field_name = "ktype",
474
		.item = &ASN1_INTEGER_it,
475
	},
476
	{
477
		.flags = ASN1_TFLG_EXPLICIT,
478
		.tag = 1,
479
		.offset = offsetof(KRB5_ENCKEY, keyvalue),
480
		.field_name = "keyvalue",
481
		.item = &ASN1_OCTET_STRING_it,
482
	},
483
};
484
485
const ASN1_ITEM KRB5_ENCKEY_it = {
486
	.itype = ASN1_ITYPE_SEQUENCE,
487
	.utype = V_ASN1_SEQUENCE,
488
	.templates = KRB5_ENCKEY_seq_tt,
489
	.tcount = sizeof(KRB5_ENCKEY_seq_tt) / sizeof(ASN1_TEMPLATE),
490
	.funcs = NULL,
491
	.size = sizeof(KRB5_ENCKEY),
492
	.sname = "KRB5_ENCKEY",
493
};
494
495
496
KRB5_ENCKEY *
497
d2i_KRB5_ENCKEY(KRB5_ENCKEY **a, const unsigned char **in, long len)
498
{
499
	return (KRB5_ENCKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
500
	    &KRB5_ENCKEY_it);
501
}
502
503
int
504
i2d_KRB5_ENCKEY(KRB5_ENCKEY *a, unsigned char **out)
505
{
506
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_ENCKEY_it);
507
}
508
509
KRB5_ENCKEY *
510
KRB5_ENCKEY_new(void)
511
{
512
	return (KRB5_ENCKEY *)ASN1_item_new(&KRB5_ENCKEY_it);
513
}
514
515
void
516
KRB5_ENCKEY_free(KRB5_ENCKEY *a)
517
{
518
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_ENCKEY_it);
519
}
520
521
522
/* SEQ OF SEQ; see ASN1_EXP_SEQUENCE_OF_OPT() below */
523
static const ASN1_TEMPLATE KRB5_AUTHDATA_seq_tt[] = {
524
	{
525
		.flags = ASN1_TFLG_EXPLICIT,
526
		.tag = 0,
527
		.offset = offsetof(KRB5_AUTHDATA, adtype),
528
		.field_name = "adtype",
529
		.item = &ASN1_INTEGER_it,
530
	},
531
	{
532
		.flags = ASN1_TFLG_EXPLICIT,
533
		.tag = 1,
534
		.offset = offsetof(KRB5_AUTHDATA, addata),
535
		.field_name = "addata",
536
		.item = &ASN1_OCTET_STRING_it,
537
	},
538
};
539
540
const ASN1_ITEM KRB5_AUTHDATA_it = {
541
	.itype = ASN1_ITYPE_SEQUENCE,
542
	.utype = V_ASN1_SEQUENCE,
543
	.templates = KRB5_AUTHDATA_seq_tt,
544
	.tcount = sizeof(KRB5_AUTHDATA_seq_tt) / sizeof(ASN1_TEMPLATE),
545
	.funcs = NULL,
546
	.size = sizeof(KRB5_AUTHDATA),
547
	.sname = "KRB5_AUTHDATA",
548
};
549
550
551
KRB5_AUTHDATA *
552
d2i_KRB5_AUTHDATA(KRB5_AUTHDATA **a, const unsigned char **in, long len)
553
{
554
	return (KRB5_AUTHDATA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
555
	    &KRB5_AUTHDATA_it);
556
}
557
558
int
559
i2d_KRB5_AUTHDATA(KRB5_AUTHDATA *a, unsigned char **out)
560
{
561
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_AUTHDATA_it);
562
}
563
564
KRB5_AUTHDATA *
565
KRB5_AUTHDATA_new(void)
566
{
567
	return (KRB5_AUTHDATA *)ASN1_item_new(&KRB5_AUTHDATA_it);
568
}
569
570
void
571
KRB5_AUTHDATA_free(KRB5_AUTHDATA *a)
572
{
573
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_AUTHDATA_it);
574
}
575
576
577
/* [APPLICATION 2] = 0x62 */
578
static const ASN1_TEMPLATE KRB5_AUTHENTBODY_seq_tt[] = {
579
	{
580
		.flags = ASN1_TFLG_EXPLICIT,
581
		.tag = 0,
582
		.offset = offsetof(KRB5_AUTHENTBODY, avno),
583
		.field_name = "avno",
584
		.item = &ASN1_INTEGER_it,
585
	},
586
	{
587
		.flags = ASN1_TFLG_EXPLICIT,
588
		.tag = 1,
589
		.offset = offsetof(KRB5_AUTHENTBODY, crealm),
590
		.field_name = "crealm",
591
		.item = &ASN1_GENERALSTRING_it,
592
	},
593
	{
594
		.flags = ASN1_TFLG_EXPLICIT,
595
		.tag = 2,
596
		.offset = offsetof(KRB5_AUTHENTBODY, cname),
597
		.field_name = "cname",
598
		.item = &KRB5_PRINCNAME_it,
599
	},
600
	{
601
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL,
602
		.tag = 3,
603
		.offset = offsetof(KRB5_AUTHENTBODY, cksum),
604
		.field_name = "cksum",
605
		.item = &KRB5_CHECKSUM_it,
606
	},
607
	{
608
		.flags = ASN1_TFLG_EXPLICIT,
609
		.tag = 4,
610
		.offset = offsetof(KRB5_AUTHENTBODY, cusec),
611
		.field_name = "cusec",
612
		.item = &ASN1_INTEGER_it,
613
	},
614
	{
615
		.flags = ASN1_TFLG_EXPLICIT,
616
		.tag = 5,
617
		.offset = offsetof(KRB5_AUTHENTBODY, ctime),
618
		.field_name = "ctime",
619
		.item = &ASN1_GENERALIZEDTIME_it,
620
	},
621
	{
622
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL,
623
		.tag = 6,
624
		.offset = offsetof(KRB5_AUTHENTBODY, subkey),
625
		.field_name = "subkey",
626
		.item = &KRB5_ENCKEY_it,
627
	},
628
	{
629
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL,
630
		.tag = 7,
631
		.offset = offsetof(KRB5_AUTHENTBODY, seqnum),
632
		.field_name = "seqnum",
633
		.item = &ASN1_INTEGER_it,
634
	},
635
	{
636
		.flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_SEQUENCE_OF | ASN1_TFLG_OPTIONAL,
637
		.tag = 8,
638
		.offset = offsetof(KRB5_AUTHENTBODY, authorization),
639
		.field_name = "authorization",
640
		.item = &KRB5_AUTHDATA_it,
641
	},
642
};
643
644
const ASN1_ITEM KRB5_AUTHENTBODY_it = {
645
	.itype = ASN1_ITYPE_SEQUENCE,
646
	.utype = V_ASN1_SEQUENCE,
647
	.templates = KRB5_AUTHENTBODY_seq_tt,
648
	.tcount = sizeof(KRB5_AUTHENTBODY_seq_tt) / sizeof(ASN1_TEMPLATE),
649
	.funcs = NULL,
650
	.size = sizeof(KRB5_AUTHENTBODY),
651
	.sname = "KRB5_AUTHENTBODY",
652
};
653
654
655
KRB5_AUTHENTBODY *
656
d2i_KRB5_AUTHENTBODY(KRB5_AUTHENTBODY **a, const unsigned char **in, long len)
657
{
658
	return (KRB5_AUTHENTBODY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
659
	    &KRB5_AUTHENTBODY_it);
660
}
661
662
int
663
i2d_KRB5_AUTHENTBODY(KRB5_AUTHENTBODY *a, unsigned char **out)
664
{
665
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_AUTHENTBODY_it);
666
}
667
668
KRB5_AUTHENTBODY *
669
KRB5_AUTHENTBODY_new(void)
670
{
671
	return (KRB5_AUTHENTBODY *)ASN1_item_new(&KRB5_AUTHENTBODY_it);
672
}
673
674
void
675
KRB5_AUTHENTBODY_free(KRB5_AUTHENTBODY *a)
676
{
677
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_AUTHENTBODY_it);
678
}
679
680
static const ASN1_TEMPLATE KRB5_AUTHENT_item_tt =  {
681
	.flags = ASN1_TFLG_EXPTAG | ASN1_TFLG_APPLICATION,
682
	.tag = 2,
683
	.offset = 0,
684
	.field_name = "KRB5_AUTHENT",
685
	.item = &KRB5_AUTHENTBODY_it,
686
};
687
688
const ASN1_ITEM KRB5_AUTHENT_it = {
689
	.itype = ASN1_ITYPE_PRIMITIVE,
690
	.utype = -1,
691
	.templates = &KRB5_AUTHENT_item_tt,
692
	.tcount = 0,
693
	.funcs = NULL,
694
	.size = 0,
695
	.sname = "KRB5_AUTHENT",
696
};
697
698
699
KRB5_AUTHENT *
700
d2i_KRB5_AUTHENT(KRB5_AUTHENT **a, const unsigned char **in, long len)
701
{
702
	return (KRB5_AUTHENT *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
703
	    &KRB5_AUTHENT_it);
704
}
705
706
int
707
i2d_KRB5_AUTHENT(KRB5_AUTHENT *a, unsigned char **out)
708
{
709
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &KRB5_AUTHENT_it);
710
}
711
712
KRB5_AUTHENT *
713
KRB5_AUTHENT_new(void)
714
{
715
	return (KRB5_AUTHENT *)ASN1_item_new(&KRB5_AUTHENT_it);
716
}
717
718
void
719
KRB5_AUTHENT_free(KRB5_AUTHENT *a)
720
{
721
	ASN1_item_free((ASN1_VALUE *)a, &KRB5_AUTHENT_it);
722
}