2 * Copyright (c) 2006-2020 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * 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.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include "sanon_locl.h"
36 static uint8_t anonymous_identity;
38 _gss_sanon_anonymous_identity = (gss_name_t)&anonymous_identity;
40 _gss_sanon_anonymous_cred = (gss_cred_id_t)&anonymous_identity;
42 static uint8_t non_anonymous_identity;
44 _gss_sanon_non_anonymous_identity = (gss_name_t)&non_anonymous_identity;
46 _gss_sanon_non_anonymous_cred = (gss_cred_id_t)&non_anonymous_identity;
48 static gss_buffer_desc wellknown_user_name = {
49 SANON_WELLKNOWN_USER_NAME_LEN,
50 SANON_WELLKNOWN_USER_NAME
53 _gss_sanon_wellknown_user_name = &wellknown_user_name;
55 static gss_buffer_desc wellknown_service_name = {
56 SANON_WELLKNOWN_SERVICE_NAME_LEN,
57 SANON_WELLKNOWN_SERVICE_NAME
60 _gss_sanon_wellknown_service_name = &wellknown_service_name;
62 static gss_mo_desc sanon_mo[] = {
67 rk_UNCONST("SANON-X25519"),
68 _gss_mo_get_ctx_as_string,
72 GSS_C_MA_MECH_DESCRIPTION,
74 "Mechanism description",
75 rk_UNCONST("Heimdal Simple Anonymous (X25519) Mechanism"),
76 _gss_mo_get_ctx_as_string,
80 GSS_C_MA_MECH_CONCRETE,
96 GSS_C_MA_AUTH_INIT_ANON,
104 GSS_C_MA_AUTH_TARG_ANON,
184 GSS_C_MA_NEGOEX_AND_SPNEGO,
193 static gssapi_mech_interface_desc sanon_mech = {
196 { 10, rk_UNCONST("\x2b\x06\x01\x04\x01\xa9\x4a\x1a\x01\x6e") },
199 _gss_sanon_release_cred,
200 _gss_sanon_init_sec_context,
201 _gss_sanon_accept_sec_context,
202 _gss_sanon_process_context_token,
203 _gss_sanon_delete_sec_context,
204 _gss_sanon_context_time,
206 _gss_sanon_verify_mic,
209 _gss_sanon_display_status,
210 NULL, /* gm_indicate_mechs */
211 _gss_sanon_compare_name,
212 _gss_sanon_display_name,
213 _gss_sanon_import_name,
214 _gss_sanon_export_name,
215 _gss_sanon_release_name,
216 _gss_sanon_inquire_cred,
217 _gss_sanon_inquire_context,
218 _gss_sanon_wrap_size_limit,
219 NULL, /* gm_add_cred */
220 _gss_sanon_inquire_cred_by_mech,
221 _gss_sanon_export_sec_context,
222 _gss_sanon_import_sec_context,
223 _gss_sanon_inquire_names_for_mech,
224 _gss_sanon_inquire_mechs_for_name,
225 _gss_sanon_canonicalize_name,
226 _gss_sanon_duplicate_name,
227 _gss_sanon_inquire_sec_context_by_oid,
228 NULL, /* gm_inquire_cred_by_oid */
229 NULL, /* gm_set_sec_context_option */
230 NULL, /* gm_set_cred_option */
231 _gss_sanon_pseudo_random,
233 _gss_sanon_unwrap_iov,
234 _gss_sanon_wrap_iov_length,
235 NULL, /* gm_store_cred */
236 _gss_sanon_export_cred,
237 _gss_sanon_import_cred,
238 _gss_sanon_acquire_cred_from,
239 NULL, /* gm_acquire_cred_impersonate_name */
247 sizeof(sanon_mo) / sizeof(sanon_mo[0]),
248 NULL, /* gm_localname */
249 NULL, /* gm_authorize_localname */
250 NULL, /* gm_display_name_ext */
251 NULL, /* gm_inquire_name */
252 NULL, /* gm_get_name_attribute */
253 NULL, /* gm_set_name_attribute */
254 NULL, /* gm_delete_name_attribute */
255 NULL, /* gm_export_name_composite */
256 _gss_sanon_duplicate_cred,
257 _gss_sanon_add_cred_from,
258 NULL, /* gm_store_cred_into */
259 _gssspi_sanon_query_mechanism_info,
260 _gssspi_sanon_query_meta_data,
261 _gssspi_sanon_exchange_meta_data,
262 NULL, /* gm_store_cred_into2 */
263 NULL, /* gm_compat */
266 gssapi_mech_interface
267 __gss_sanon_initialize(void)