summaryrefslogtreecommitdiff
path: root/lib/libgssapi/generated/spnego_asn1.h
blob: a3c88baf1026c30a938e0365ef6c417cfaf66e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */
/* Do not edit */

#ifndef __spnego_asn1_h__
#define __spnego_asn1_h__

#include <stddef.h>
#include <time.h>

time_t timegm (struct tm*);

#ifndef __asn1_common_definitions__
#define __asn1_common_definitions__

typedef struct heim_octet_string {
  size_t length;
  void *data;
} heim_octet_string;

typedef char *heim_general_string;

typedef char *heim_utf8_string;

typedef struct heim_oid {
  size_t length;
  unsigned *components;
} heim_oid;

#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \
  do {                                                         \
    (BL) = length_##T((S));                                    \
    (B) = malloc((BL));                                        \
    if((B) == NULL) {                                          \
      (R) = ENOMEM;                                            \
    } else {                                                   \
      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
                       (S), (L));                              \
      if((R) != 0) {                                           \
        free((B));                                             \
        (B) = NULL;                                            \
      }                                                        \
    }                                                          \
  } while (0)

#endif

/*
MechType ::= OBJECT IDENTIFIER
*/

typedef heim_oid MechType;

int    encode_MechType(unsigned char *, size_t, const MechType *, size_t *);
int    decode_MechType(const unsigned char *, size_t, MechType *, size_t *);
void   free_MechType  (MechType *);
size_t length_MechType(const MechType *);
int    copy_MechType  (const MechType *, MechType *);


/*
MechTypeList ::= SEQUENCE OF MechType
*/

typedef struct MechTypeList {
  unsigned int len;
  MechType *val;
} MechTypeList;

int    encode_MechTypeList(unsigned char *, size_t, const MechTypeList *, size_t *);
int    decode_MechTypeList(const unsigned char *, size_t, MechTypeList *, size_t *);
void   free_MechTypeList  (MechTypeList *);
size_t length_MechTypeList(const MechTypeList *);
int    copy_MechTypeList  (const MechTypeList *, MechTypeList *);


/*
ContextFlags ::= BIT STRING {
  delegFlag(0),
  mutualFlag(1),
  replayFlag(2),
  sequenceFlag(3),
  anonFlag(4),
  confFlag(5),
  integFlag(6)
}
*/

typedef struct ContextFlags {
  unsigned int delegFlag:1;
  unsigned int mutualFlag:1;
  unsigned int replayFlag:1;
  unsigned int sequenceFlag:1;
  unsigned int anonFlag:1;
  unsigned int confFlag:1;
  unsigned int integFlag:1;
} ContextFlags;


int    encode_ContextFlags(unsigned char *, size_t, const ContextFlags *, size_t *);
int    decode_ContextFlags(const unsigned char *, size_t, ContextFlags *, size_t *);
void   free_ContextFlags  (ContextFlags *);
size_t length_ContextFlags(const ContextFlags *);
int    copy_ContextFlags  (const ContextFlags *, ContextFlags *);
unsigned ContextFlags2int(ContextFlags);
ContextFlags int2ContextFlags(unsigned);
const struct units * asn1_ContextFlags_units(void);

/*
NegTokenInit ::= SEQUENCE {
  mechTypes[0]    MechTypeList OPTIONAL,
  reqFlags[1]     ContextFlags OPTIONAL,
  mechToken[2]    OCTET STRING OPTIONAL,
  mechListMIC[3]  OCTET STRING OPTIONAL
}
*/

typedef struct NegTokenInit {
  MechTypeList *mechTypes;
  ContextFlags *reqFlags;
  heim_octet_string *mechToken;
  heim_octet_string *mechListMIC;
} NegTokenInit;

int    encode_NegTokenInit(unsigned char *, size_t, const NegTokenInit *, size_t *);
int    decode_NegTokenInit(const unsigned char *, size_t, NegTokenInit *, size_t *);
void   free_NegTokenInit  (NegTokenInit *);
size_t length_NegTokenInit(const NegTokenInit *);
int    copy_NegTokenInit  (const NegTokenInit *, NegTokenInit *);


/*
NegTokenTarg ::= SEQUENCE {
  negResult[0]      ENUMERATED {
    accept_completed(0),
    accept_incomplete(1),
    reject(2)
  } OPTIONAL,
  supportedMech[1]  MechType OPTIONAL,
  responseToken[2]  OCTET STRING OPTIONAL,
  mechListMIC[3]    OCTET STRING OPTIONAL
}
*/

typedef struct NegTokenTarg {
  enum  {
    accept_completed = 0,
    accept_incomplete = 1,
    reject = 2
  } *negResult;

  MechType *supportedMech;
  heim_octet_string *responseToken;
  heim_octet_string *mechListMIC;
} NegTokenTarg;

int    encode_NegTokenTarg(unsigned char *, size_t, const NegTokenTarg *, size_t *);
int    decode_NegTokenTarg(const unsigned char *, size_t, NegTokenTarg *, size_t *);
void   free_NegTokenTarg  (NegTokenTarg *);
size_t length_NegTokenTarg(const NegTokenTarg *);
int    copy_NegTokenTarg  (const NegTokenTarg *, NegTokenTarg *);




#endif /* __spnego_asn1_h__ */