Imported Upstream version 1.15.1
[platform/upstream/krb5.git] / src / lib / krb5 / asn.1 / krbasn1.h
1 /* -*- mode: c; c-basic-offset: 4; 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 int asn1_tagnum;
39 #define ASN1_TAGNUM_CEILING INT_MAX
40 #define ASN1_TAGNUM_MAX (ASN1_TAGNUM_CEILING-1)
41
42 /* This is Kerberos Version 5 */
43 #define KVNO 5
44
45 /* Universal Tag Numbers */
46 #define ASN1_BOOLEAN            1
47 #define ASN1_INTEGER            2
48 #define ASN1_BITSTRING          3
49 #define ASN1_OCTETSTRING        4
50 #define ASN1_NULL               5
51 #define ASN1_OBJECTIDENTIFIER   6
52 #define ASN1_ENUMERATED         10
53 #define ASN1_UTF8STRING         12
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