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