1 /* hej emacs det h{r {r en -*- c -*- fil */
4 * Copyright (c) 2002 - 2004, Stockholms Universitet
5 * (Stockholm University, Stockholm Sweden)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the university nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
40 const RXGK_MAX_TOKEN_LEN = 65536;
41 const RXGK_MAX_AUTHTOKEN = 256;
43 /* ctext is limited by mtu since its part of responce */
44 const RXGK_MAX_CTEXT = 768;
46 const RXGK_SERVICE_ID = 34567;
48 #define RXGK_ESTABLISH_GSS_CONTEXT 1
49 #define RXGK_COMBINE_RXGK_AUTH 2
51 typedef opaque RXGK_Token<RXGK_MAX_TOKEN_LEN>;
57 const RXGK_KEY_VERSION = 1;
58 const RXGK_KEY_MAXSIZE = 256;
59 const RXGK_KEY_MAXPRINCIPAL = 640;
60 const RXGK_KEY_ENCTYPES = 25;
61 const RXGK_MAX_LEVELS = 25;
62 const RXGK_MAX_NONCE = 64;
66 const RXGK_KEY_MAX_COMBINE = 20;
67 const RXGK_EXT_EXTENSION_SIZE = 2048;
70 * Challange token in the
73 const RXGK_CR_TOKEN_VERSION = 1;
79 struct RXGK_Challenge {
84 typedef opaque RXGK_Ticket_Crypt<RXGK_MAX_AUTHTOKEN>;
86 struct RXGK_Response {
89 RXGK_Ticket_Crypt rr_authenticator;
90 opaque rr_ctext<RXGK_MAX_CTEXT>;
93 struct RXGK_Response_Crypt {
97 afs_int32 call_numbers[4];
101 * Rx auth cred equivalent
104 const RXGK_EXT_EXTENSION_COMBINE = 1;
106 struct rxgk_combine_principal {
107 opaque combineprincipal<RXGK_KEY_MAXPRINCIPAL>;
110 struct rxgk_extension {
112 opaque data<RXGK_EXT_EXTENSION_SIZE>;
116 afs_int32 ticketversion;
118 opaque key<RXGK_KEY_MAXSIZE>;
123 afs_int64 expirationtime;
124 opaque ticketprincipal<RXGK_KEY_MAXPRINCIPAL>;
125 struct rxgk_extension ext<8>; /* XXX size */
129 * This is part of the rxs challange/response exchange. Its somewhat
130 * complicated since it support rekeying of a data stream.
133 const RXGK_VERSION = 1;
137 * Kerberos crypto framework enctypes
140 const RXGK_CRYPTO_DES_CBC_CRC = 1;
141 const RXGK_CRYPTO_DES_CBC_MD4 = 2;
142 const RXGK_CRYPTO_DES_CBC_MD5 = 4;
144 const RXGK_CRYPTO_AES256_CTS_HMAC_SHA1_96 = 18;
146 const RXGK_CLIENT_TO_SERVER = 0;
147 const RXGK_SERVER_TO_CLIENT = 1;
149 const RXGK_CLIENT_ENC_CHALLENGE = 1026;
150 const RXGK_SERVER_ENC_REKEY = 1026;
151 const RXGK_CLIENT_ENC_PACKETS = 1027;
152 const RXGK_CLIENT_CKSUM_PACKETS = 1028;
153 const RXGK_SERVER_ENC_PACKETS = 1029;
154 const RXGK_SERVER_CKSUM_PACKETS = 1030;
157 const RXGK_CLIENT_ENC_PACKET = 1026;
158 const RXGK_CLIENT_MIC_PACKET = 1027;
159 const RXGK_SERVER_ENC_PACKET = 1028;
160 const RXGK_SERVER_MIC_PACKET = 1029;
161 const RXGK_CLIENT_ENC_RESPONSE = 1030;
162 const RXGK_CLIENT_COMBINE_ORIG = 1032;
163 const RXGK_SERVER_COMBINE_NEW = 1034;
164 const RXGK_SERVER_ENC_TICKET = 1036;
168 * In packet protection since header isn't checksum-ed
171 struct rxgk_header_data {
172 afs_uint32 call_number;
173 afs_uint32 channel_and_seq;
181 /* XXX limit arrays */
183 typedef afs_int32 RXGK_Enctypes<RXGK_KEY_ENCTYPES>;
185 struct RXGK_client_start {
186 RXGK_Enctypes sp_enctypes;
187 afs_int32 sp_levels<RXGK_MAX_LEVELS>;
188 afs_int32 sp_lifetime;
189 afs_int32 sp_bytelife; /* max bytes in log 2 */
190 afs_int32 sp_nametag;
191 opaque sp_client_nonce<RXGK_MAX_NONCE>;
194 struct RXGK_ClientInfo {
195 afs_int32 ci_error_code;
196 afs_int32 ci_enctype;
198 afs_int32 ci_lifetime;
199 afs_int32 ci_bytelife;
200 afs_int64 ci_expiration;
201 opaque ci_mic<1024>; /* MIC over startparam */ /* XXX size */
202 RXGK_Ticket_Crypt ci_ticket;
203 opaque ci_server_nonce<RXGK_MAX_NONCE>;
206 const RXGK_WIRE_AUTH_ONLY = 0;
207 const RXGK_WIRE_INTEGRITY = 1;
208 const RXGK_WIRE_BIND = 2;
209 const RXGK_WIRE_ENCRYPT = 3;
212 * opaque_in and opaque_out is to allow multi-round trip GSS mech to
213 * keep state in the opaque and be state-less.
215 * input_token_buffer and output_token_buffer are both GSS context
218 * gss_status is the gss return code.
221 GSSNegotiate(IN RXGK_client_start *client_start,
222 IN RXGK_Token *input_token_buffer,
223 IN RXGK_Token *opaque_in,
224 OUT RXGK_Token *output_token_buffer,
225 OUT RXGK_Token *opaque_out,
226 OUT afs_uint32 *gss_status,
227 OUT RXGK_Token *rxgk_info) = RXGK_ESTABLISH_GSS_CONTEXT;