xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/krb5/asn.1/krbasn1.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 #ifndef __KRBASN1_H__
2 #define __KRBASN1_H__
3 
4 #pragma ident	"%Z%%M%	%I%	%E% SMI"
5 
6 #include <k5-int.h>
7 #include <stdio.h>
8 #include <errno.h>
9 #include <limits.h>		/* For INT_MAX */
10 #ifdef HAVE_STDLIB_H
11 #include <stdlib.h>
12 #endif
13 /*
14  * Older versions of the Kerberos are always sending the
15  * enc_kdc_rep_part structure with an application tag of #26, instead
16  * of using the application tag of #25 (AS REP) or #26 (AS REP) as
17  * necessary.  Worse yet, they will only accept a tag of #26, so we
18  * need to follow this for backwards compatibility.  #defining
19  * KRB5_ENCKRB5KDCREPPART_COMPAT will preserve this wrong (but
20  * compatible) behavior.
21  */
22 #define KRB5_ENCKRB5KDCREPPART_COMPAT
23 
24 /*
25  * If KRB5_MSGTYPE_STRICT is defined, then be strict about checking
26  * the msgtype fields.  Unfortunately, there old versions of Kerberos
27  * don't set these fields correctly, so we have to make allowances for
28  * them.
29  */
30 /* #define KRB5_MSGTYPE_STRICT */
31 
32 typedef krb5_octet asn1_octet;
33 typedef krb5_error_code asn1_error_code;
34 
35 typedef enum { PRIMITIVE = 0x00, CONSTRUCTED = 0x20 } asn1_construction;
36 
37 typedef enum { UNIVERSAL = 0x00, APPLICATION = 0x40,
38 		 CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class;
39 
40 typedef int asn1_tagnum;
41 #define ASN1_TAGNUM_CEILING INT_MAX
42 #define ASN1_TAGNUM_MAX (ASN1_TAGNUM_CEILING-1)
43 
44 /* This is Kerberos Version 5 */
45 #define KVNO 5
46 
47 /* Universal Tag Numbers */
48 #define ASN1_INTEGER		2
49 #define ASN1_BITSTRING		3
50 #define ASN1_OCTETSTRING	4
51 #define ASN1_NULL		5
52 #define ASN1_OBJECTIDENTIFIER	6
53 #define	ASN1_ENUMERATED		10
54 #define ASN1_SEQUENCE		16
55 #define ASN1_SET		17
56 #define ASN1_PRINTABLESTRING	19
57 #define ASN1_IA5STRING		22
58 #define ASN1_UTCTIME		23
59 #define ASN1_GENERALTIME	24
60 #define ASN1_GENERALSTRING	27
61 
62 /* Kerberos Message Types */
63 #define ASN1_KRB_AS_REQ		10
64 #define ASN1_KRB_AS_REP		11
65 #define ASN1_KRB_TGS_REQ	12
66 #define ASN1_KRB_TGS_REP	13
67 #define ASN1_KRB_AP_REQ		14
68 #define ASN1_KRB_AP_REP		15
69 #define ASN1_KRB_SAFE		20
70 #define ASN1_KRB_PRIV		21
71 #define ASN1_KRB_CRED		22
72 #define ASN1_KRB_ERROR		30
73 
74 #endif
75