2 * Copyright (c) 2005 Doug Rabson
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $FreeBSD: src/lib/libgssapi/mech_switch.h,v 1.1 2005/12/29 14:40:20 dfr Exp $
30 #define GSSAPI_MECH_H 1
34 typedef OM_uint32 GSSAPI_CALLCONV _gss_acquire_cred_t
35 (OM_uint32
*, /* minor_status */
36 const gss_name_t
, /* desired_name */
37 OM_uint32
, /* time_req */
38 const gss_OID_set
, /* desired_mechs */
39 gss_cred_usage_t
, /* cred_usage */
40 gss_cred_id_t
*, /* output_cred_handle */
41 gss_OID_set
*, /* actual_mechs */
42 OM_uint32
* /* time_rec */
45 typedef OM_uint32 GSSAPI_CALLCONV _gss_release_cred_t
46 (OM_uint32
*, /* minor_status */
47 gss_cred_id_t
* /* cred_handle */
50 typedef OM_uint32 GSSAPI_CALLCONV _gss_init_sec_context_t
51 (OM_uint32
*, /* minor_status */
52 const gss_cred_id_t
, /* initiator_cred_handle */
53 gss_ctx_id_t
*, /* context_handle */
54 const gss_name_t
, /* target_name */
55 const gss_OID
, /* mech_type */
56 OM_uint32
, /* req_flags */
57 OM_uint32
, /* time_req */
58 const gss_channel_bindings_t
,
59 /* input_chan_bindings */
60 const gss_buffer_t
, /* input_token */
61 gss_OID
*, /* actual_mech_type */
62 gss_buffer_t
, /* output_token */
63 OM_uint32
*, /* ret_flags */
64 OM_uint32
* /* time_rec */
67 typedef OM_uint32 GSSAPI_CALLCONV _gss_accept_sec_context_t
68 (OM_uint32
*, /* minor_status */
69 gss_ctx_id_t
*, /* context_handle */
70 const gss_cred_id_t
, /* acceptor_cred_handle */
71 const gss_buffer_t
, /* input_token_buffer */
72 const gss_channel_bindings_t
,
73 /* input_chan_bindings */
74 gss_name_t
*, /* src_name */
75 gss_OID
*, /* mech_type */
76 gss_buffer_t
, /* output_token */
77 OM_uint32
*, /* ret_flags */
78 OM_uint32
*, /* time_rec */
79 gss_cred_id_t
* /* delegated_cred_handle */
82 typedef OM_uint32 GSSAPI_CALLCONV _gss_process_context_token_t
83 (OM_uint32
*, /* minor_status */
84 const gss_ctx_id_t
, /* context_handle */
85 const gss_buffer_t
/* token_buffer */
88 typedef OM_uint32 GSSAPI_CALLCONV _gss_delete_sec_context_t
89 (OM_uint32
*, /* minor_status */
90 gss_ctx_id_t
*, /* context_handle */
91 gss_buffer_t
/* output_token */
94 typedef OM_uint32 GSSAPI_CALLCONV _gss_context_time_t
95 (OM_uint32
*, /* minor_status */
96 const gss_ctx_id_t
, /* context_handle */
97 OM_uint32
* /* time_rec */
100 typedef OM_uint32 GSSAPI_CALLCONV _gss_get_mic_t
101 (OM_uint32
*, /* minor_status */
102 const gss_ctx_id_t
, /* context_handle */
103 gss_qop_t
, /* qop_req */
104 const gss_buffer_t
, /* message_buffer */
105 gss_buffer_t
/* message_token */
108 typedef OM_uint32 GSSAPI_CALLCONV _gss_verify_mic_t
109 (OM_uint32
*, /* minor_status */
110 const gss_ctx_id_t
, /* context_handle */
111 const gss_buffer_t
, /* message_buffer */
112 const gss_buffer_t
, /* token_buffer */
113 gss_qop_t
* /* qop_state */
116 typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_t
117 (OM_uint32
*, /* minor_status */
118 const gss_ctx_id_t
, /* context_handle */
119 int, /* conf_req_flag */
120 gss_qop_t
, /* qop_req */
121 const gss_buffer_t
, /* input_message_buffer */
122 int *, /* conf_state */
123 gss_buffer_t
/* output_message_buffer */
126 typedef OM_uint32 GSSAPI_CALLCONV _gss_unwrap_t
127 (OM_uint32
*, /* minor_status */
128 const gss_ctx_id_t
, /* context_handle */
129 const gss_buffer_t
, /* input_message_buffer */
130 gss_buffer_t
, /* output_message_buffer */
131 int *, /* conf_state */
132 gss_qop_t
* /* qop_state */
135 typedef OM_uint32 GSSAPI_CALLCONV _gss_display_status_t
136 (OM_uint32
*, /* minor_status */
137 OM_uint32
, /* status_value */
138 int, /* status_type */
139 const gss_OID
, /* mech_type */
140 OM_uint32
*, /* message_context */
141 gss_buffer_t
/* status_string */
144 typedef OM_uint32 GSSAPI_CALLCONV _gss_indicate_mechs_t
145 (OM_uint32
*, /* minor_status */
146 gss_OID_set
* /* mech_set */
149 typedef OM_uint32 GSSAPI_CALLCONV _gss_compare_name_t
150 (OM_uint32
*, /* minor_status */
151 const gss_name_t
, /* name1 */
152 const gss_name_t
, /* name2 */
153 int * /* name_equal */
156 typedef OM_uint32 GSSAPI_CALLCONV _gss_display_name_t
157 (OM_uint32
*, /* minor_status */
158 const gss_name_t
, /* input_name */
159 gss_buffer_t
, /* output_name_buffer */
160 gss_OID
* /* output_name_type */
163 typedef OM_uint32 GSSAPI_CALLCONV _gss_import_name_t
164 (OM_uint32
*, /* minor_status */
165 const gss_buffer_t
, /* input_name_buffer */
166 const gss_OID
, /* input_name_type */
167 gss_name_t
* /* output_name */
170 typedef OM_uint32 GSSAPI_CALLCONV _gss_export_name_t
171 (OM_uint32
*, /* minor_status */
172 const gss_name_t
, /* input_name */
173 gss_buffer_t
/* exported_name */
176 typedef OM_uint32 GSSAPI_CALLCONV _gss_release_name_t
177 (OM_uint32
*, /* minor_status */
178 gss_name_t
* /* input_name */
181 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_t
182 (OM_uint32
*, /* minor_status */
183 const gss_cred_id_t
, /* cred_handle */
184 gss_name_t
*, /* name */
185 OM_uint32
*, /* lifetime */
186 gss_cred_usage_t
*, /* cred_usage */
187 gss_OID_set
* /* mechanisms */
190 typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_context_t
191 (OM_uint32
*, /* minor_status */
192 const gss_ctx_id_t
, /* context_handle */
193 gss_name_t
*, /* src_name */
194 gss_name_t
*, /* targ_name */
195 OM_uint32
*, /* lifetime_rec */
196 gss_OID
*, /* mech_type */
197 OM_uint32
*, /* ctx_flags */
198 int *, /* locally_initiated */
202 typedef OM_uint32 GSSAPI_CALLCONV _gss_wrap_size_limit_t
203 (OM_uint32
*, /* minor_status */
204 const gss_ctx_id_t
, /* context_handle */
205 int, /* conf_req_flag */
206 gss_qop_t
, /* qop_req */
207 OM_uint32
, /* req_output_size */
208 OM_uint32
* /* max_input_size */
211 typedef OM_uint32 GSSAPI_CALLCONV
_gss_add_cred_t (
212 OM_uint32
*, /* minor_status */
213 const gss_cred_id_t
, /* input_cred_handle */
214 const gss_name_t
, /* desired_name */
215 const gss_OID
, /* desired_mech */
216 gss_cred_usage_t
, /* cred_usage */
217 OM_uint32
, /* initiator_time_req */
218 OM_uint32
, /* acceptor_time_req */
219 gss_cred_id_t
*, /* output_cred_handle */
220 gss_OID_set
*, /* actual_mechs */
221 OM_uint32
*, /* initiator_time_rec */
222 OM_uint32
* /* acceptor_time_rec */
225 typedef OM_uint32 GSSAPI_CALLCONV
_gss_inquire_cred_by_mech_t (
226 OM_uint32
*, /* minor_status */
227 const gss_cred_id_t
, /* cred_handle */
228 const gss_OID
, /* mech_type */
229 gss_name_t
*, /* name */
230 OM_uint32
*, /* initiator_lifetime */
231 OM_uint32
*, /* acceptor_lifetime */
232 gss_cred_usage_t
* /* cred_usage */
235 typedef OM_uint32 GSSAPI_CALLCONV
_gss_export_sec_context_t (
236 OM_uint32
*, /* minor_status */
237 gss_ctx_id_t
*, /* context_handle */
238 gss_buffer_t
/* interprocess_token */
241 typedef OM_uint32 GSSAPI_CALLCONV
_gss_import_sec_context_t (
242 OM_uint32
*, /* minor_status */
243 const gss_buffer_t
, /* interprocess_token */
244 gss_ctx_id_t
* /* context_handle */
247 typedef OM_uint32 GSSAPI_CALLCONV
_gss_inquire_names_for_mech_t (
248 OM_uint32
*, /* minor_status */
249 const gss_OID
, /* mechanism */
250 gss_OID_set
* /* name_types */
253 typedef OM_uint32 GSSAPI_CALLCONV
_gss_inquire_mechs_for_name_t (
254 OM_uint32
*, /* minor_status */
255 const gss_name_t
, /* input_name */
256 gss_OID_set
* /* mech_types */
259 typedef OM_uint32 GSSAPI_CALLCONV
_gss_canonicalize_name_t (
260 OM_uint32
*, /* minor_status */
261 const gss_name_t
, /* input_name */
262 const gss_OID
, /* mech_type */
263 gss_name_t
* /* output_name */
266 typedef OM_uint32 GSSAPI_CALLCONV
_gss_duplicate_name_t (
267 OM_uint32
*, /* minor_status */
268 const gss_name_t
, /* src_name */
269 gss_name_t
* /* dest_name */
272 typedef OM_uint32 GSSAPI_CALLCONV
_gss_inquire_sec_context_by_oid (
273 OM_uint32
*minor_status
,
274 const gss_ctx_id_t context_handle
,
275 const gss_OID desired_object
,
276 gss_buffer_set_t
*data_set
279 typedef OM_uint32 GSSAPI_CALLCONV
_gss_inquire_cred_by_oid (
280 OM_uint32
*minor_status
,
281 const gss_cred_id_t cred
,
282 const gss_OID desired_object
,
283 gss_buffer_set_t
*data_set
286 typedef OM_uint32 GSSAPI_CALLCONV
_gss_set_sec_context_option (
287 OM_uint32
*minor_status
,
288 gss_ctx_id_t
*cred_handle
,
289 const gss_OID desired_object
,
290 const gss_buffer_t value
293 typedef OM_uint32 GSSAPI_CALLCONV
_gss_set_cred_option (
294 OM_uint32
*minor_status
,
295 gss_cred_id_t
*cred_handle
,
296 const gss_OID desired_object
,
297 const gss_buffer_t value
301 typedef OM_uint32 GSSAPI_CALLCONV
_gss_pseudo_random(
302 OM_uint32
*minor_status
,
303 gss_ctx_id_t context
,
305 const gss_buffer_t prf_in
,
306 ssize_t desired_output_len
,
310 typedef OM_uint32 GSSAPI_CALLCONV
311 _gss_wrap_iov_t(OM_uint32
*minor_status
,
312 gss_ctx_id_t context_handle
,
316 gss_iov_buffer_desc
*iov
,
319 typedef OM_uint32 GSSAPI_CALLCONV
320 _gss_unwrap_iov_t(OM_uint32
*minor_status
,
321 gss_ctx_id_t context_handle
,
323 gss_qop_t
*qop_state
,
324 gss_iov_buffer_desc
*iov
,
327 typedef OM_uint32 GSSAPI_CALLCONV
328 _gss_wrap_iov_length_t(OM_uint32
* minor_status
,
329 gss_ctx_id_t context_handle
,
333 gss_iov_buffer_desc
*iov
,
336 typedef OM_uint32 GSSAPI_CALLCONV
337 _gss_store_cred_t(OM_uint32
*minor_status
,
338 gss_cred_id_t input_cred_handle
,
339 gss_cred_usage_t cred_usage
,
340 const gss_OID desired_mech
,
341 OM_uint32 overwrite_cred
,
342 OM_uint32 default_cred
,
343 gss_OID_set
*elements_stored
,
344 gss_cred_usage_t
*cred_usage_stored
);
346 typedef OM_uint32 GSSAPI_CALLCONV
347 _gss_export_cred_t(OM_uint32
*minor_status
,
348 gss_cred_id_t cred_handle
,
349 gss_buffer_t cred_token
);
351 typedef OM_uint32 GSSAPI_CALLCONV
352 _gss_import_cred_t(OM_uint32
* minor_status
,
353 gss_buffer_t cred_token
,
354 gss_cred_id_t
* cred_handle
);
357 #define GMI_VERSION 2
360 #define GM_USE_MG_CRED 1 /* uses mech glue credentials */
363 typedef struct gssapi_mech_interface_desc
{
366 gss_OID_desc gm_mech_oid
;
368 _gss_acquire_cred_t
*gm_acquire_cred
;
369 _gss_release_cred_t
*gm_release_cred
;
370 _gss_init_sec_context_t
*gm_init_sec_context
;
371 _gss_accept_sec_context_t
*gm_accept_sec_context
;
372 _gss_process_context_token_t
*gm_process_context_token
;
373 _gss_delete_sec_context_t
*gm_delete_sec_context
;
374 _gss_context_time_t
*gm_context_time
;
375 _gss_get_mic_t
*gm_get_mic
;
376 _gss_verify_mic_t
*gm_verify_mic
;
377 _gss_wrap_t
*gm_wrap
;
378 _gss_unwrap_t
*gm_unwrap
;
379 _gss_display_status_t
*gm_display_status
;
380 _gss_indicate_mechs_t
*gm_indicate_mechs
;
381 _gss_compare_name_t
*gm_compare_name
;
382 _gss_display_name_t
*gm_display_name
;
383 _gss_import_name_t
*gm_import_name
;
384 _gss_export_name_t
*gm_export_name
;
385 _gss_release_name_t
*gm_release_name
;
386 _gss_inquire_cred_t
*gm_inquire_cred
;
387 _gss_inquire_context_t
*gm_inquire_context
;
388 _gss_wrap_size_limit_t
*gm_wrap_size_limit
;
389 _gss_add_cred_t
*gm_add_cred
;
390 _gss_inquire_cred_by_mech_t
*gm_inquire_cred_by_mech
;
391 _gss_export_sec_context_t
*gm_export_sec_context
;
392 _gss_import_sec_context_t
*gm_import_sec_context
;
393 _gss_inquire_names_for_mech_t
*gm_inquire_names_for_mech
;
394 _gss_inquire_mechs_for_name_t
*gm_inquire_mechs_for_name
;
395 _gss_canonicalize_name_t
*gm_canonicalize_name
;
396 _gss_duplicate_name_t
*gm_duplicate_name
;
397 _gss_inquire_sec_context_by_oid
*gm_inquire_sec_context_by_oid
;
398 _gss_inquire_cred_by_oid
*gm_inquire_cred_by_oid
;
399 _gss_set_sec_context_option
*gm_set_sec_context_option
;
400 _gss_set_cred_option
*gm_set_cred_option
;
401 _gss_pseudo_random
*gm_pseudo_random
;
402 _gss_wrap_iov_t
*gm_wrap_iov
;
403 _gss_unwrap_iov_t
*gm_unwrap_iov
;
404 _gss_wrap_iov_length_t
*gm_wrap_iov_length
;
405 _gss_store_cred_t
*gm_store_cred
;
406 _gss_export_cred_t
*gm_export_cred
;
407 _gss_import_cred_t
*gm_import_cred
;
408 } gssapi_mech_interface_desc
, *gssapi_mech_interface
;
410 gssapi_mech_interface
411 __gss_get_mechanism(gss_OID
/* oid */);
413 gssapi_mech_interface
__gss_spnego_initialize(void);
414 gssapi_mech_interface
__gss_krb5_initialize(void);
415 gssapi_mech_interface
__gss_ntlm_initialize(void);
417 void gss_mg_collect_error(gss_OID
, OM_uint32
, OM_uint32
);
419 #endif /* GSSAPI_MECH_H */