xref: /freebsd/crypto/heimdal/lib/gssapi/spnego/external.c (revision 6a068746777241722b2b32c5d0bc443a2a64d80b)
1c19800e8SDoug Rabson /*
2c19800e8SDoug Rabson  * Copyright (c) 2004, PADL Software Pty Ltd.
3c19800e8SDoug Rabson  * All rights reserved.
4c19800e8SDoug Rabson  *
5c19800e8SDoug Rabson  * Redistribution and use in source and binary forms, with or without
6c19800e8SDoug Rabson  * modification, are permitted provided that the following conditions
7c19800e8SDoug Rabson  * are met:
8c19800e8SDoug Rabson  *
9c19800e8SDoug Rabson  * 1. Redistributions of source code must retain the above copyright
10c19800e8SDoug Rabson  *    notice, this list of conditions and the following disclaimer.
11c19800e8SDoug Rabson  *
12c19800e8SDoug Rabson  * 2. Redistributions in binary form must reproduce the above copyright
13c19800e8SDoug Rabson  *    notice, this list of conditions and the following disclaimer in the
14c19800e8SDoug Rabson  *    documentation and/or other materials provided with the distribution.
15c19800e8SDoug Rabson  *
16c19800e8SDoug Rabson  * 3. Neither the name of PADL Software nor the names of its contributors
17c19800e8SDoug Rabson  *    may be used to endorse or promote products derived from this software
18c19800e8SDoug Rabson  *    without specific prior written permission.
19c19800e8SDoug Rabson  *
20c19800e8SDoug Rabson  * THIS SOFTWARE IS PROVIDED BY PADL SOFTWARE AND CONTRIBUTORS ``AS IS'' AND
21c19800e8SDoug Rabson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22c19800e8SDoug Rabson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23c19800e8SDoug Rabson  * ARE DISCLAIMED.  IN NO EVENT SHALL PADL SOFTWARE OR CONTRIBUTORS BE LIABLE
24c19800e8SDoug Rabson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25c19800e8SDoug Rabson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26c19800e8SDoug Rabson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27c19800e8SDoug Rabson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28c19800e8SDoug Rabson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29c19800e8SDoug Rabson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30c19800e8SDoug Rabson  * SUCH DAMAGE.
31c19800e8SDoug Rabson  */
32c19800e8SDoug Rabson 
33*ae771770SStanislav Sedov #include "spnego_locl.h"
34c19800e8SDoug Rabson #include <gssapi_mech.h>
35c19800e8SDoug Rabson 
36c19800e8SDoug Rabson /*
37c19800e8SDoug Rabson  * RFC2478, SPNEGO:
38c19800e8SDoug Rabson  *  The security mechanism of the initial
39c19800e8SDoug Rabson  *  negotiation token is identified by the Object Identifier
40c19800e8SDoug Rabson  *  iso.org.dod.internet.security.mechanism.snego (1.3.6.1.5.5.2).
41c19800e8SDoug Rabson  */
42*ae771770SStanislav Sedov #if 0
43*ae771770SStanislav Sedov static gss_mo_desc spnego_mo[] = {
44*ae771770SStanislav Sedov     {
45*ae771770SStanislav Sedov 	GSS_C_MA_SASL_MECH_NAME,
46*ae771770SStanislav Sedov 	GSS_MO_MA,
47*ae771770SStanislav Sedov 	"SASL mech name",
48*ae771770SStanislav Sedov 	rk_UNCONST("SPNEGO"),
49*ae771770SStanislav Sedov 	_gss_mo_get_ctx_as_string,
50*ae771770SStanislav Sedov 	NULL
51*ae771770SStanislav Sedov     },
52*ae771770SStanislav Sedov     {
53*ae771770SStanislav Sedov 	GSS_C_MA_MECH_NAME,
54*ae771770SStanislav Sedov 	GSS_MO_MA,
55*ae771770SStanislav Sedov 	"Mechanism name",
56*ae771770SStanislav Sedov 	rk_UNCONST("SPNEGO"),
57*ae771770SStanislav Sedov 	_gss_mo_get_ctx_as_string,
58*ae771770SStanislav Sedov 	NULL
59*ae771770SStanislav Sedov     },
60*ae771770SStanislav Sedov     {
61*ae771770SStanislav Sedov 	GSS_C_MA_MECH_DESCRIPTION,
62*ae771770SStanislav Sedov 	GSS_MO_MA,
63*ae771770SStanislav Sedov 	"Mechanism description",
64*ae771770SStanislav Sedov 	rk_UNCONST("Heimdal SPNEGO Mechanism"),
65*ae771770SStanislav Sedov 	_gss_mo_get_ctx_as_string,
66*ae771770SStanislav Sedov 	NULL
67*ae771770SStanislav Sedov     },
68*ae771770SStanislav Sedov     {
69*ae771770SStanislav Sedov 	GSS_C_MA_MECH_NEGO,
70*ae771770SStanislav Sedov 	GSS_MO_MA
71*ae771770SStanislav Sedov     },
72*ae771770SStanislav Sedov     {
73*ae771770SStanislav Sedov 	GSS_C_MA_MECH_PSEUDO,
74*ae771770SStanislav Sedov 	GSS_MO_MA
75*ae771770SStanislav Sedov     }
76*ae771770SStanislav Sedov };
77*ae771770SStanislav Sedov #endif
78c19800e8SDoug Rabson 
79c19800e8SDoug Rabson static gssapi_mech_interface_desc spnego_mech = {
80c19800e8SDoug Rabson     GMI_VERSION,
81c19800e8SDoug Rabson     "spnego",
82*ae771770SStanislav Sedov     {6, rk_UNCONST("\x2b\x06\x01\x05\x05\x02") },
83*ae771770SStanislav Sedov     0,
84c19800e8SDoug Rabson     _gss_spnego_acquire_cred,
85c19800e8SDoug Rabson     _gss_spnego_release_cred,
86c19800e8SDoug Rabson     _gss_spnego_init_sec_context,
87c19800e8SDoug Rabson     _gss_spnego_accept_sec_context,
88c19800e8SDoug Rabson     _gss_spnego_process_context_token,
89c19800e8SDoug Rabson     _gss_spnego_internal_delete_sec_context,
90c19800e8SDoug Rabson     _gss_spnego_context_time,
91c19800e8SDoug Rabson     _gss_spnego_get_mic,
92c19800e8SDoug Rabson     _gss_spnego_verify_mic,
93c19800e8SDoug Rabson     _gss_spnego_wrap,
94c19800e8SDoug Rabson     _gss_spnego_unwrap,
95*ae771770SStanislav Sedov     NULL, /* gm_display_status */
96*ae771770SStanislav Sedov     NULL, /* gm_indicate_mechs */
97c19800e8SDoug Rabson     _gss_spnego_compare_name,
98c19800e8SDoug Rabson     _gss_spnego_display_name,
99c19800e8SDoug Rabson     _gss_spnego_import_name,
100c19800e8SDoug Rabson     _gss_spnego_export_name,
101c19800e8SDoug Rabson     _gss_spnego_release_name,
102c19800e8SDoug Rabson     _gss_spnego_inquire_cred,
103c19800e8SDoug Rabson     _gss_spnego_inquire_context,
104c19800e8SDoug Rabson     _gss_spnego_wrap_size_limit,
105*ae771770SStanislav Sedov     gss_add_cred,
106c19800e8SDoug Rabson     _gss_spnego_inquire_cred_by_mech,
107c19800e8SDoug Rabson     _gss_spnego_export_sec_context,
108c19800e8SDoug Rabson     _gss_spnego_import_sec_context,
109*ae771770SStanislav Sedov     NULL /* _gss_spnego_inquire_names_for_mech */,
110c19800e8SDoug Rabson     _gss_spnego_inquire_mechs_for_name,
111c19800e8SDoug Rabson     _gss_spnego_canonicalize_name,
112*ae771770SStanislav Sedov     _gss_spnego_duplicate_name,
113*ae771770SStanislav Sedov     _gss_spnego_inquire_sec_context_by_oid,
114*ae771770SStanislav Sedov     _gss_spnego_inquire_cred_by_oid,
115*ae771770SStanislav Sedov     _gss_spnego_set_sec_context_option,
116*ae771770SStanislav Sedov     _gss_spnego_set_cred_option,
117*ae771770SStanislav Sedov     _gss_spnego_pseudo_random,
118*ae771770SStanislav Sedov #if 0
119*ae771770SStanislav Sedov     _gss_spnego_wrap_iov,
120*ae771770SStanislav Sedov     _gss_spnego_unwrap_iov,
121*ae771770SStanislav Sedov     _gss_spnego_wrap_iov_length,
122*ae771770SStanislav Sedov #else
123*ae771770SStanislav Sedov     NULL,
124*ae771770SStanislav Sedov     NULL,
125*ae771770SStanislav Sedov     NULL,
126*ae771770SStanislav Sedov #endif
127*ae771770SStanislav Sedov     NULL,
128*ae771770SStanislav Sedov #if 0
129*ae771770SStanislav Sedov     _gss_spnego_export_cred,
130*ae771770SStanislav Sedov     _gss_spnego_import_cred,
131*ae771770SStanislav Sedov #else
132*ae771770SStanislav Sedov     NULL,
133*ae771770SStanislav Sedov     NULL,
134*ae771770SStanislav Sedov #endif
135*ae771770SStanislav Sedov     NULL,
136*ae771770SStanislav Sedov     NULL,
137*ae771770SStanislav Sedov     NULL,
138*ae771770SStanislav Sedov     NULL,
139*ae771770SStanislav Sedov     NULL,
140*ae771770SStanislav Sedov     NULL,
141*ae771770SStanislav Sedov     NULL,
142*ae771770SStanislav Sedov #if 0
143*ae771770SStanislav Sedov     spnego_mo,
144*ae771770SStanislav Sedov     sizeof(spnego_mo) / sizeof(spnego_mo[0]),
145*ae771770SStanislav Sedov #else
146*ae771770SStanislav Sedov     NULL,
147*ae771770SStanislav Sedov     0,
148*ae771770SStanislav Sedov #endif
149*ae771770SStanislav Sedov     NULL,
150*ae771770SStanislav Sedov     NULL,
151*ae771770SStanislav Sedov     NULL,
152*ae771770SStanislav Sedov     NULL,
153*ae771770SStanislav Sedov     NULL,
154*ae771770SStanislav Sedov     NULL,
155c19800e8SDoug Rabson };
156c19800e8SDoug Rabson 
157c19800e8SDoug Rabson gssapi_mech_interface
__gss_spnego_initialize(void)158c19800e8SDoug Rabson __gss_spnego_initialize(void)
159c19800e8SDoug Rabson {
160c19800e8SDoug Rabson 	return &spnego_mech;
161c19800e8SDoug Rabson }
162