xref: /freebsd/sys/kgssapi/gssapi_impl.h (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
5  * Authors: Doug Rabson <dfr@rabson.org>
6  * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $FreeBSD$
30  */
31 
32 #include "gssd.h"
33 
34 MALLOC_DECLARE(M_GSSAPI);
35 
36 struct _gss_ctx_id_t {
37 	KOBJ_FIELDS;
38 	gssd_ctx_id_t	handle;
39 };
40 
41 struct _gss_cred_id_t {
42 	gssd_cred_id_t	handle;
43 };
44 
45 struct _gss_name_t {
46 	gssd_name_t	handle;
47 };
48 
49 struct kgss_mech {
50 	LIST_ENTRY(kgss_mech) km_link;
51 	gss_OID		km_mech_type;
52 	const char	*km_mech_name;
53 	struct kobj_class *km_class;
54 };
55 LIST_HEAD(kgss_mech_list, kgss_mech);
56 
57 extern CLIENT *kgss_gssd_handle;
58 extern struct mtx kgss_gssd_lock;
59 extern struct kgss_mech_list kgss_mechs;
60 
61 CLIENT *kgss_gssd_client(void);
62 int kgss_oid_equal(const gss_OID oid1, const gss_OID oid2);
63 extern void kgss_install_mech(gss_OID mech_type, const char *name,
64     struct kobj_class *cls);
65 extern void kgss_uninstall_mech(gss_OID mech_type);
66 extern gss_OID kgss_find_mech_by_name(const char *name);
67 extern const char *kgss_find_mech_by_oid(const gss_OID oid);
68 extern gss_ctx_id_t kgss_create_context(gss_OID mech_type);
69 extern void kgss_delete_context(gss_ctx_id_t ctx, gss_buffer_t output_token);
70 extern OM_uint32 kgss_transfer_context(gss_ctx_id_t ctx);
71 extern void kgss_copy_buffer(const gss_buffer_t from, gss_buffer_t to);
72