xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/krb5/asn.1/krbasn1.h (revision ba7b222e36bac28710a7f43739283302b617e7f5)
1 /* -*- mode: c; indent-tabs-mode: nil -*- */
2 #ifndef __KRBASN1_H__
3 #define __KRBASN1_H__
4 
5 #include "k5-int.h"
6 #include <stdio.h>
7 #include <errno.h>
8 #include <limits.h>             /* For INT_MAX */
9 #ifdef HAVE_STDLIB_H
10 #include <stdlib.h>
11 #endif
12 
13 /*
14  * If KRB5_MSGTYPE_STRICT is defined, then be strict about checking
15  * the msgtype fields.  Unfortunately, there old versions of Kerberos
16  * don't set these fields correctly, so we have to make allowances for
17  * them.
18  */
19 /* #define KRB5_MSGTYPE_STRICT */
20 
21 /*
22  * If KRB5_GENEROUS_LR_TYPE is defined, then we are generous about
23  * accepting a one byte negative lr_type - which is not sign
24  * extended. Prior to July 2000, we were sending a negative lr_type as
25  * a positve single byte value - instead of a signed integer. This
26  * allows us to receive the old value and deal
27  */
28 #define KRB5_GENEROUS_LR_TYPE
29 
30 typedef krb5_octet asn1_octet;
31 typedef krb5_error_code asn1_error_code;
32 
33 typedef enum { PRIMITIVE = 0x00, CONSTRUCTED = 0x20 } asn1_construction;
34 
35 typedef enum { UNIVERSAL = 0x00, APPLICATION = 0x40,
36                  CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class;
37 
38 typedef INT64_TYPE asn1_intmax;
39 typedef UINT64_TYPE asn1_uintmax;
40 
41 typedef int asn1_tagnum;
42 #define ASN1_TAGNUM_CEILING INT_MAX
43 #define ASN1_TAGNUM_MAX (ASN1_TAGNUM_CEILING-1)
44 
45 /* This is Kerberos Version 5 */
46 #define KVNO 5
47 
48 /* Universal Tag Numbers */
49 #define ASN1_BOOLEAN            1
50 #define ASN1_INTEGER            2
51 #define ASN1_BITSTRING          3
52 #define ASN1_OCTETSTRING        4
53 #define ASN1_NULL               5
54 #define ASN1_OBJECTIDENTIFIER   6
55 #define ASN1_ENUMERATED         10
56 #define ASN1_SEQUENCE           16
57 #define ASN1_SET                17
58 #define ASN1_PRINTABLESTRING    19
59 #define ASN1_IA5STRING          22
60 #define ASN1_UTCTIME            23
61 #define ASN1_GENERALTIME        24
62 #define ASN1_GENERALSTRING      27
63 
64 /* Kerberos Message Types */
65 #define ASN1_KRB_AS_REQ         10
66 #define ASN1_KRB_AS_REP         11
67 #define ASN1_KRB_TGS_REQ        12
68 #define ASN1_KRB_TGS_REP        13
69 #define ASN1_KRB_AP_REQ         14
70 #define ASN1_KRB_AP_REP         15
71 #define ASN1_KRB_SAFE           20
72 #define ASN1_KRB_PRIV           21
73 #define ASN1_KRB_CRED           22
74 #define ASN1_KRB_ERROR          30
75 
76 #endif
77