Run util/openssl-format-source -v -c .
[openssl.git] / crypto / krb5 / krb5_asn.h
1 /* krb5_asn.h */
2 /*
3  * Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project, **
4  * using ocsp/{*.h,*asn*.c} as a starting point
5  */
6
7 /* ====================================================================
8  * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in
19  *    the documentation and/or other materials provided with the
20  *    distribution.
21  *
22  * 3. All advertising materials mentioning features or use of this
23  *    software must display the following acknowledgment:
24  *    "This product includes software developed by the OpenSSL Project
25  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
26  *
27  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28  *    endorse or promote products derived from this software without
29  *    prior written permission. For written permission, please contact
30  *    openssl-core@openssl.org.
31  *
32  * 5. Products derived from this software may not be called "OpenSSL"
33  *    nor may "OpenSSL" appear in their names without prior written
34  *    permission of the OpenSSL Project.
35  *
36  * 6. Redistributions of any form whatsoever must retain the following
37  *    acknowledgment:
38  *    "This product includes software developed by the OpenSSL Project
39  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
40  *
41  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
45  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52  * OF THE POSSIBILITY OF SUCH DAMAGE.
53  * ====================================================================
54  *
55  * This product includes cryptographic software written by Eric Young
56  * (eay@cryptsoft.com).  This product includes software written by Tim
57  * Hudson (tjh@cryptsoft.com).
58  *
59  */
60
61 #ifndef HEADER_KRB5_ASN_H
62 # define HEADER_KRB5_ASN_H
63
64 /*
65  * #include <krb5.h>
66  */
67 # include <openssl/safestack.h>
68
69 #ifdef  __cplusplus
70 extern "C" {
71 #endif
72
73 /*
74  * ASN.1 from Kerberos RFC 1510
75  */
76
77 /*-     EncryptedData ::=   SEQUENCE {
78  *              etype[0]                      INTEGER, -- EncryptionType
79  *              kvno[1]                       INTEGER OPTIONAL,
80  *              cipher[2]                     OCTET STRING -- ciphertext
81  *      }
82  */
83 typedef struct krb5_encdata_st {
84     ASN1_INTEGER *etype;
85     ASN1_INTEGER *kvno;
86     ASN1_OCTET_STRING *cipher;
87 } KRB5_ENCDATA;
88
89 DECLARE_STACK_OF(KRB5_ENCDATA)
90
91 /*-     PrincipalName ::=   SEQUENCE {
92  *              name-type[0]                  INTEGER,
93  *              name-string[1]                SEQUENCE OF GeneralString
94  *      }
95  */
96 typedef struct krb5_princname_st {
97     ASN1_INTEGER *nametype;
98     STACK_OF(ASN1_GENERALSTRING) *namestring;
99 } KRB5_PRINCNAME;
100
101 DECLARE_STACK_OF(KRB5_PRINCNAME)
102
103 /*-     Ticket ::=      [APPLICATION 1] SEQUENCE {
104  *              tkt-vno[0]                    INTEGER,
105  *              realm[1]                      Realm,
106  *              sname[2]                      PrincipalName,
107  *              enc-part[3]                   EncryptedData
108  *      }
109  */
110 typedef struct krb5_tktbody_st {
111     ASN1_INTEGER *tktvno;
112     ASN1_GENERALSTRING *realm;
113     KRB5_PRINCNAME *sname;
114     KRB5_ENCDATA *encdata;
115 } KRB5_TKTBODY;
116
117 typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;
118 DECLARE_STACK_OF(KRB5_TKTBODY)
119
120 /*-     AP-REQ ::=      [APPLICATION 14] SEQUENCE {
121  *              pvno[0]                       INTEGER,
122  *              msg-type[1]                   INTEGER,
123  *              ap-options[2]                 APOptions,
124  *              ticket[3]                     Ticket,
125  *              authenticator[4]              EncryptedData
126  *      }
127  *
128  *      APOptions ::=   BIT STRING {
129  *              reserved(0), use-session-key(1), mutual-required(2) }
130  */
131 typedef struct krb5_ap_req_st {
132     ASN1_INTEGER *pvno;
133     ASN1_INTEGER *msgtype;
134     ASN1_BIT_STRING *apoptions;
135     KRB5_TICKET *ticket;
136     KRB5_ENCDATA *authenticator;
137 } KRB5_APREQBODY;
138
139 typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;
140 DECLARE_STACK_OF(KRB5_APREQBODY)
141
142 /*      Authenticator Stuff     */
143
144 /*-     Checksum ::=   SEQUENCE {
145  *              cksumtype[0]                  INTEGER,
146  *              checksum[1]                   OCTET STRING
147  *      }
148  */
149 typedef struct krb5_checksum_st {
150     ASN1_INTEGER *ctype;
151     ASN1_OCTET_STRING *checksum;
152 } KRB5_CHECKSUM;
153
154 DECLARE_STACK_OF(KRB5_CHECKSUM)
155
156 /*-     EncryptionKey ::=   SEQUENCE {
157  *              keytype[0]                    INTEGER,
158  *              keyvalue[1]                   OCTET STRING
159  *      }
160  */
161 typedef struct krb5_encryptionkey_st {
162     ASN1_INTEGER *ktype;
163     ASN1_OCTET_STRING *keyvalue;
164 } KRB5_ENCKEY;
165
166 DECLARE_STACK_OF(KRB5_ENCKEY)
167
168 /*-     AuthorizationData ::=   SEQUENCE OF SEQUENCE {
169  *              ad-type[0]                    INTEGER,
170  *              ad-data[1]                    OCTET STRING
171  *      }
172  */
173 typedef struct krb5_authorization_st {
174     ASN1_INTEGER *adtype;
175     ASN1_OCTET_STRING *addata;
176 } KRB5_AUTHDATA;
177
178 DECLARE_STACK_OF(KRB5_AUTHDATA)
179
180 /*-     -- Unencrypted authenticator
181  *      Authenticator ::=    [APPLICATION 2] SEQUENCE    {
182  *              authenticator-vno[0]          INTEGER,
183  *              crealm[1]                     Realm,
184  *              cname[2]                      PrincipalName,
185  *              cksum[3]                      Checksum OPTIONAL,
186  *              cusec[4]                      INTEGER,
187  *              ctime[5]                      KerberosTime,
188  *              subkey[6]                     EncryptionKey OPTIONAL,
189  *              seq-number[7]                 INTEGER OPTIONAL,
190  *              authorization-data[8]         AuthorizationData OPTIONAL
191  *      }
192  */
193 typedef struct krb5_authenticator_st {
194     ASN1_INTEGER *avno;
195     ASN1_GENERALSTRING *crealm;
196     KRB5_PRINCNAME *cname;
197     KRB5_CHECKSUM *cksum;
198     ASN1_INTEGER *cusec;
199     ASN1_GENERALIZEDTIME *ctime;
200     KRB5_ENCKEY *subkey;
201     ASN1_INTEGER *seqnum;
202     KRB5_AUTHDATA *authorization;
203 } KRB5_AUTHENTBODY;
204
205 typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;
206 DECLARE_STACK_OF(KRB5_AUTHENTBODY)
207
208 /*-  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =
209  *      type *name##_new(void);
210  *      void name##_free(type *a);
211  *      DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
212  *       DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
213  *        type *d2i_##name(type **a, const unsigned char **in, long len);
214  *        int i2d_##name(type *a, unsigned char **out);
215  *        DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
216  */
217
218 DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)
219 DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)
220 DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)
221 DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)
222 DECLARE_ASN1_FUNCTIONS(KRB5_TICKET)
223 DECLARE_ASN1_FUNCTIONS(KRB5_APREQ)
224
225 DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)
226 DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)
227 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)
228 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)
229 DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)
230
231 /* BEGIN ERROR CODES */
232 /*
233  * The following lines are auto generated by the script mkerr.pl. Any changes
234  * made after this point may be overwritten when the script is next run.
235  */
236
237 #ifdef  __cplusplus
238 }
239 #endif
240 #endif