xref: /titanic_41/usr/src/uts/common/gssapi/include/gssapiP_dummy.h (revision eb0cc229f19c437a6b538d3ac0d0443268290b7e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_GSSAPIP_DUMMY_H
28 #define	_GSSAPIP_DUMMY_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <gssapi/gssapi.h>
37 
38 #define	SEC_CONTEXT_TOKEN 1
39 #define	DUMMY_SIZE_OF_INT 4
40 
41 typedef void * dummy_token_t;
42 
43 /* dummy name structure for internal representation. */
44 typedef struct {
45 	gss_OID type;
46 	gss_buffer_t buffer;
47 } dummy_name_desc, *dummy_name_t;
48 
49 /* Structure for context handle */
50 typedef struct {
51 	OM_uint32 last_stat;
52 	int token_number;
53 	int established;
54 } dummy_gss_ctx_id_rec, *dummy_gss_ctx_id_t;
55 
56 /* Dummy oid structure */
57 static const gss_OID_desc dummy_oids[] = {
58 	{10, "\053\006\001\004\001\052\002\032\001\002"},
59 };
60 const gss_OID_desc * const gss_mech_dummy = dummy_oids+0;
61 static const gss_OID_set_desc dummy_oidsets[] = {
62 	{1, (gss_OID) dummy_oids+0},
63 };
64 const gss_OID_set_desc * const gss_mech_set_dummy = dummy_oidsets+0;
65 
66 #define	TWRITE_STR(ptr, str, len) \
67 	(void) memcpy((ptr), (char *) (str), (len)); \
68 	(ptr) += (len);
69 #ifndef	_KERNEL
70 
71 #ifdef DEBUG_ON
72 
73 #define	dprintf(a) printf(a)
74 #define	dprintf1(a, b) printf(a, b)
75 
76 #else
77 
78 #define	dprintf(a)
79 #define	dprintf1(a, b)
80 #define	DUMMY_STATIC
81 
82 #endif	/* DEBUG_ON */
83 
84 #else	/* _KERNEL */
85 
86 #if defined(DEBUG) && !defined(DUMMY_MECH_DEBUG)
87 #define	DUMMY_MECH_DEBUG
88 #endif
89 
90 #ifdef DUMMY_MECH_DEBUG
91 #define	DUMMY_MECH_LOG(A, B, C) \
92 	((void)((dummy_mech_log & (A)) && (printf((B), (C)), TRUE)))
93 #define	DUMMY_MECH_LOG0(A, B)   \
94 	((void)((dummy_mech_log & (A)) && (printf(B), TRUE)))
95 #else
96 #define	DUMMY_MECH_LOG(A, B, C)
97 #define	DUMMY_MECH_LOG0(A, B)
98 
99 #endif
100 
101 #define	dprintf(a)	DUMMY_MECH_LOG0(8, a)
102 #define	dprintf1(a, b)	DUMMY_MECH_LOG(8, a, b)
103 #define	DUMMY_STATIC	static
104 
105 #endif	/* _KERNEL */
106 
107 /*
108  * declarations of internal name mechanism functions
109  */
110 
111 OM_uint32 dummy_gss_acquire_cred
112 	(
113 		void *,			/* dummy context */
114 		OM_uint32 *,		/* minor_status */
115 		gss_name_t,		/* desired_name */
116 		OM_uint32,		/* time_req */
117 		gss_OID_set,		/* desired_mechs */
118 		gss_cred_usage_t,	/* cred_usage */
119 		gss_cred_id_t *,	/* output_cred_handle */
120 		gss_OID_set *,		/* actual_mechs */
121 		OM_uint32 *		/* time_rec */
122 	/* */);
123 
124 OM_uint32 dummy_gss_release_cred
125 	(
126 		void *,			/* dummy context */
127 		OM_uint32 *,		/* minor_status */
128 		gss_cred_id_t *		/* cred_handle */
129 	/* */);
130 
131 OM_uint32 dummy_gss_init_sec_context
132 	(
133 		void *,			/* dummy context */
134 		OM_uint32 *,		/* minor_status */
135 		gss_cred_id_t,		/* claimant_cred_handle */
136 		gss_ctx_id_t *,		/* context_handle */
137 		gss_name_t,		/* target_name */
138 		gss_OID,		/* mech_type */
139 		OM_uint32,		/* req_flags */
140 		OM_uint32,		/* time_req */
141 		gss_channel_bindings_t, /* input_chan_bindings */
142 		gss_buffer_t,		/* input_token */
143 		gss_OID *,		/* actual_mech_type */
144 		gss_buffer_t,		/* output_token */
145 		OM_uint32 *,		/* ret_flags */
146 		OM_uint32 *		/* time_rec */
147 	/* */);
148 
149 OM_uint32 dummy_gss_accept_sec_context
150 	(
151 		void *,			/* dummy context */
152 		OM_uint32 *,		/* minor_status */
153 		gss_ctx_id_t *,		/* context_handle */
154 		gss_cred_id_t,		/* verifier_cred_handle */
155 		gss_buffer_t,		/* input_token_buffer */
156 		gss_channel_bindings_t, /* input_chan_bindings */
157 		gss_name_t *,		/* src_name */
158 		gss_OID *,		/* mech_type */
159 		gss_buffer_t,		/* output_token */
160 		OM_uint32 *,		/* ret_flags */
161 		OM_uint32 *,		/* time_rec */
162 		gss_cred_id_t *		/* delegated_cred_handle */
163 	/* */);
164 
165 OM_uint32 dummy_gss_process_context_token
166 	(
167 		void *,			/* dummy context */
168 		OM_uint32 *,		/* minor_status */
169 		gss_ctx_id_t,		/* context_handle */
170 		gss_buffer_t		/* token_buffer */
171 	/* */);
172 
173 DUMMY_STATIC OM_uint32 dummy_gss_delete_sec_context
174 	(
175 		void *,			/* dummy context */
176 		OM_uint32 *,		/* minor_status */
177 		gss_ctx_id_t *,		/* context_handle */
178 		gss_buffer_t		/* output_token */
179 #ifdef	_KERNEL
180 	/* */, OM_uint32
181 #endif
182 	/* */);
183 
184 OM_uint32 dummy_gss_context_time
185 	(
186 		void *,			/* dummy context */
187 		OM_uint32 *,		/* minor_status */
188 		gss_ctx_id_t,		/* context_handle */
189 		OM_uint32 *		/* time_rec */
190 	/* */);
191 
192 DUMMY_STATIC OM_uint32 dummy_gss_sign
193 	(
194 		void *,			/* dummy context */
195 		OM_uint32 *,		/* minor_status */
196 		gss_ctx_id_t,		/* context_handle */
197 		int,			/* qop_req */
198 		gss_buffer_t,		/* message_buffer */
199 		gss_buffer_t		/* message_token */
200 #ifdef	_KERNEL
201 	/* */, OM_uint32
202 #endif
203 	/* */);
204 
205 DUMMY_STATIC OM_uint32 dummy_gss_verify
206 	(
207 		void *,			/* dummy context */
208 		OM_uint32 *,		/* minor_status */
209 		gss_ctx_id_t,		/* context_handle */
210 		gss_buffer_t,		/* message_buffer */
211 		gss_buffer_t,		/* token_buffer */
212 		int *			/* qop_state */
213 #ifdef	_KERNEL
214 	/* */, OM_uint32
215 
216 #endif
217 	/* */);
218 /* EXPORT DELETE START */
219 DUMMY_STATIC OM_uint32 dummy_gss_seal
220 	(
221 		void *,			/* dummy context */
222 		OM_uint32 *,		/* minor_status */
223 		gss_ctx_id_t,		/* context_handle */
224 		int,			/* conf_req_flag */
225 		int,			/* qop_req */
226 		gss_buffer_t,		/* input_message_buffer */
227 		int *,			/* conf_state */
228 		gss_buffer_t		/* output_message_buffer */
229 #ifdef	_KERNEL
230 	/* */, OM_uint32
231 #endif
232 	/* */);
233 
234 DUMMY_STATIC OM_uint32 dummy_gss_unseal
235 	(
236 		void *,			/* dummy context */
237 		OM_uint32 *,		/* minor_status */
238 		gss_ctx_id_t,		/* context_handle */
239 		gss_buffer_t,		/* input_message_buffer */
240 		gss_buffer_t,		/* output_message_buffer */
241 		int *,			/* conf_state */
242 		int *			/* qop_state */
243 #ifdef	_KERNEL
244 	/* */, OM_uint32
245 #endif
246 	/* */);
247 /* EXPORT DELETE END */
248 
249 OM_uint32 dummy_gss_display_status
250 	(
251 		void *,			/* dummy context */
252 		OM_uint32 *,		/* minor_status */
253 		OM_uint32,		/* status_value */
254 		int,			/* status_type */
255 		gss_OID,		/* mech_type */
256 		OM_uint32 *,		/* message_context */
257 		gss_buffer_t		/* status_string */
258 	/* */);
259 
260 OM_uint32 dummy_gss_indicate_mechs
261 	(
262 		void *,			/* dummy context */
263 		OM_uint32 *,		/* minor_status */
264 		gss_OID_set *		/* mech_set */
265 	/* */);
266 
267 OM_uint32 dummy_gss_compare_name
268 	(
269 		void *,			/* dummy context */
270 		OM_uint32 *,		/* minor_status */
271 		gss_name_t,		/* name1 */
272 		gss_name_t,		/* name2 */
273 		int *			/* name_equal */
274 	/* */);
275 
276 OM_uint32 dummy_gss_display_name
277 	(
278 		void *,			/* dummy context */
279 		OM_uint32 *,		/* minor_status */
280 		gss_name_t,		/* input_name */
281 		gss_buffer_t,		/* output_name_buffer */
282 		gss_OID *		/* output_name_type */
283 	/* */);
284 
285 OM_uint32 dummy_gss_import_name
286 	(
287 		void *,			/* dummy context */
288 		OM_uint32 *,		/* minor_status */
289 		gss_buffer_t,		/* input_name_buffer */
290 		gss_OID,		/* input_name_type */
291 		gss_name_t *		/* output_name */
292 	/* */);
293 
294 OM_uint32 dummy_gss_release_name
295 	(
296 		void *,			/* dummy context */
297 		OM_uint32 *,		/* minor_status */
298 		gss_name_t *		/* input_name */
299 	/* */);
300 
301 OM_uint32 dummy_gss_inquire_cred
302 	(
303 		void *,			/* dummy context */
304 		OM_uint32 *,		/* minor_status */
305 		gss_cred_id_t,		/* cred_handle */
306 		gss_name_t *,		/* name */
307 		OM_uint32 *,		/* lifetime */
308 		gss_cred_usage_t *,	/* cred_usage */
309 		gss_OID_set *		/* mechanisms */
310 	/* */);
311 
312 OM_uint32 dummy_gss_inquire_context
313 	(
314 		void *,			/* dummy context */
315 		OM_uint32 *,		/* minor_status */
316 		gss_ctx_id_t,		/* context_handle */
317 		gss_name_t *,		/* initiator_name */
318 		gss_name_t *,		/* acceptor_name */
319 		OM_uint32 *,		/* lifetime_rec */
320 		gss_OID *,		/* mech_type */
321 		OM_uint32 *,		/* ret_flags */
322 		int *,			/* locally_initiated */
323 		int *			/* open */
324 	/* */);
325 
326 /* New V2 entry points */
327 OM_uint32 dummy_gss_get_mic
328 	(
329 		void *,			/* dummy context */
330 		OM_uint32 *,		/* minor_status */
331 		gss_ctx_id_t,		/* context_handle */
332 		gss_qop_t,		/* qop_req */
333 		gss_buffer_t,		/* message_buffer */
334 		gss_buffer_t		/* message_token */
335 	/* */);
336 
337 OM_uint32 dummy_gss_verify_mic
338 	(
339 		void *,			/* dummy context */
340 		OM_uint32 *,		/* minor_status */
341 		gss_ctx_id_t,		/* context_handle */
342 		gss_buffer_t,		/* message_buffer */
343 		gss_buffer_t,		/* message_token */
344 		gss_qop_t *		/* qop_state */
345 	/* */);
346 
347 OM_uint32 dummy_gss_wrap
348 	(
349 		void *,			/* dummy context */
350 		OM_uint32 *,		/* minor_status */
351 		gss_ctx_id_t,		/* context_handle */
352 		int,			/* conf_req_flag */
353 		gss_qop_t,		/* qop_req */
354 		gss_buffer_t,		/* input_message_buffer */
355 		int *,			/* conf_state */
356 		gss_buffer_t		/* output_message_buffer */
357 	/* */);
358 
359 OM_uint32 dummy_gss_unwrap
360 	(
361 		void *,			/* dummy context */
362 		OM_uint32 *,		/* minor_status */
363 		gss_ctx_id_t,		/* context_handle */
364 		gss_buffer_t,		/* input_message_buffer */
365 		gss_buffer_t,		/* output_message_buffer */
366 		int *,			/* conf_state */
367 		gss_qop_t *		/* qop_state */
368 	/* */);
369 
370 OM_uint32 dummy_gss_wrap_size_limit
371 	(
372 		void *,			/* dummy context */
373 		OM_uint32 *,		/* minor_status */
374 		gss_ctx_id_t,		/* context_handle */
375 		int,			/* conf_req_flag */
376 		gss_qop_t,		/* qop_req */
377 		OM_uint32,		/* req_output_size */
378 		OM_uint32 *		/* max_input_size */
379 	/* */);
380 
381 OM_uint32 dummy_gss_add_cred
382 	(
383 		void *,			/* dummy context */
384 		OM_uint32 *,		/* minor_status */
385 		gss_cred_id_t,		/* input_cred_handle */
386 		gss_name_t,		/* desired_name */
387 		gss_OID,		/* desired_mech */
388 		gss_cred_usage_t,	/* cred_usage */
389 		OM_uint32,		/* initiator_time_req */
390 		OM_uint32,		/* acceptor_time_req */
391 		gss_cred_id_t *,	/* output_cred_handle */
392 		gss_OID_set *,		/* actual_mechs */
393 		OM_uint32 *,		/* initiator_time_rec */
394 		OM_uint32 *		/* acceptor_time_rec */
395 	/* */);
396 
397 OM_uint32 dummy_gss_inquire_cred_by_mech
398 	(
399 		void *,			/* dummy context */
400 		OM_uint32  *,		/* minor_status */
401 		gss_cred_id_t,		/* cred_handle */
402 		gss_OID,		/* mech_type */
403 		gss_name_t *,		/* name */
404 		OM_uint32 *,		/* initiator_lifetime */
405 		OM_uint32 *,		/* acceptor_lifetime */
406 		gss_cred_usage_t *	/* cred_usage */
407 	/* */);
408 
409 OM_uint32 dummy_gss_export_sec_context
410 	(
411 		void *,			/* dummy context */
412 		OM_uint32 *,		/* minor_status */
413 		gss_ctx_id_t *,		/* context_handle */
414 		gss_buffer_t		/* interprocess_token */
415 	/* */);
416 
417 OM_uint32 dummy_gss_import_sec_context
418 	(
419 		void *,			/* dummy context */
420 		OM_uint32 *,		/* minor_status */
421 		gss_buffer_t,		/* interprocess_token */
422 		gss_ctx_id_t *		/* context_handle */
423 	/* */);
424 
425 #if 0
426 OM_uint32 dummy_gss_release_oid
427 	(
428 		OM_uint32 *,		/* minor_status */
429 		gss_OID *		/* oid */
430 	/* */);
431 #endif
432 
433 OM_uint32 dummy_gss_internal_release_oid
434 	(
435 		void *,			/* dummy context  */
436 		OM_uint32 *,		/* minor_status */
437 		gss_OID *		/* oid */
438 	/* */);
439 
440 OM_uint32 dummy_gss_inquire_names_for_mech
441 	(
442 		void *,		/* dummy context */
443 		OM_uint32 *,		/* minor_status */
444 		gss_OID,		/* mechanism */
445 		gss_OID_set *		/* name_types */
446 	/* */);
447 
448 OM_uint32 dummy_pname_to_uid
449 	(
450 		void *,			/* dummy context */
451 		OM_uint32 *,		/* minor status */
452 		const gss_name_t,	/* pname */
453 		uid_t *			/* uidOut */
454 	/* */);
455 
456 
457 #ifdef	__cplusplus
458 }
459 #endif
460 
461 #endif /* _GSSAPIP_DUMMY_H */
462