Path: blob/main/crypto/heimdal/lib/gssapi/krb5/external.c
34923 views
/*1* Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8*9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11*12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* 3. Neither the name of the Institute nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233#include "gsskrb5_locl.h"34#include <gssapi_mech.h>3536/*37* The implementation must reserve static storage for a38* gss_OID_desc object containing the value39* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"40* "\x01\x02\x01\x01"},41* corresponding to an object-identifier value of42* {iso(1) member-body(2) United States(840) mit(113554)43* infosys(1) gssapi(2) generic(1) user_name(1)}. The constant44* GSS_C_NT_USER_NAME should be initialized to point45* to that gss_OID_desc.46*/4748gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_user_name_oid_desc =49{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")};5051/*52* The implementation must reserve static storage for a53* gss_OID_desc object containing the value54* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"55* "\x01\x02\x01\x02"},56* corresponding to an object-identifier value of57* {iso(1) member-body(2) United States(840) mit(113554)58* infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.59* The constant GSS_C_NT_MACHINE_UID_NAME should be60* initialized to point to that gss_OID_desc.61*/6263gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_machine_uid_name_oid_desc =64{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")};6566/*67* The implementation must reserve static storage for a68* gss_OID_desc object containing the value69* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"70* "\x01\x02\x01\x03"},71* corresponding to an object-identifier value of72* {iso(1) member-body(2) United States(840) mit(113554)73* infosys(1) gssapi(2) generic(1) string_uid_name(3)}.74* The constant GSS_C_NT_STRING_UID_NAME should be75* initialized to point to that gss_OID_desc.76*/7778gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_string_uid_name_oid_desc =79{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")};8081/*82* The implementation must reserve static storage for a83* gss_OID_desc object containing the value84* {6, (void *)"\x2b\x06\x01\x05\x06\x02"},85* corresponding to an object-identifier value of86* {iso(1) org(3) dod(6) internet(1) security(5)87* nametypes(6) gss-host-based-services(2)). The constant88* GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point89* to that gss_OID_desc. This is a deprecated OID value, and90* implementations wishing to support hostbased-service names91* should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,92* defined below, to identify such names;93* GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym94* for GSS_C_NT_HOSTBASED_SERVICE when presented as an input95* parameter, but should not be emitted by GSS-API96* implementations97*/9899gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_x_oid_desc =100{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")};101102/*103* The implementation must reserve static storage for a104* gss_OID_desc object containing the value105* {10, (void *)"\x2a\x86\x48\x86\xf7\x12"106* "\x01\x02\x01\x04"}, corresponding to an107* object-identifier value of {iso(1) member-body(2)108* Unites States(840) mit(113554) infosys(1) gssapi(2)109* generic(1) service_name(4)}. The constant110* GSS_C_NT_HOSTBASED_SERVICE should be initialized111* to point to that gss_OID_desc.112*/113gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_hostbased_service_oid_desc =114{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};115116/*117* The implementation must reserve static storage for a118* gss_OID_desc object containing the value119* {6, (void *)"\x2b\x06\01\x05\x06\x03"},120* corresponding to an object identifier value of121* {1(iso), 3(org), 6(dod), 1(internet), 5(security),122* 6(nametypes), 3(gss-anonymous-name)}. The constant123* and GSS_C_NT_ANONYMOUS should be initialized to point124* to that gss_OID_desc.125*/126127gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_anonymous_oid_desc =128{6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")};129130/*131* The implementation must reserve static storage for a132* gss_OID_desc object containing the value133* {6, (void *)"\x2b\x06\x01\x05\x06\x04"},134* corresponding to an object-identifier value of135* {1(iso), 3(org), 6(dod), 1(internet), 5(security),136* 6(nametypes), 4(gss-api-exported-name)}. The constant137* GSS_C_NT_EXPORT_NAME should be initialized to point138* to that gss_OID_desc.139*/140141gss_OID_desc GSSAPI_LIB_VARIABLE __gss_c_nt_export_name_oid_desc =142{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") };143144/*145* This name form shall be represented by the Object Identifier {iso(1)146* member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)147* krb5(2) krb5_name(1)}. The recommended symbolic name for this type148* is "GSS_KRB5_NT_PRINCIPAL_NAME".149*/150151gss_OID_desc GSSAPI_LIB_VARIABLE __gss_krb5_nt_principal_name_oid_desc =152{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };153154/*155* draft-ietf-cat-iakerb-09, IAKERB:156* The mechanism ID for IAKERB proxy GSS-API Kerberos, in accordance157* with the mechanism proposed by SPNEGO [7] for negotiating protocol158* variations, is: {iso(1) org(3) dod(6) internet(1) security(5)159* mechanisms(5) iakerb(10) iakerbProxyProtocol(1)}. The proposed160* mechanism ID for IAKERB minimum messages GSS-API Kerberos, in161* accordance with the mechanism proposed by SPNEGO for negotiating162* protocol variations, is: {iso(1) org(3) dod(6) internet(1)163* security(5) mechanisms(5) iakerb(10)164* iakerbMinimumMessagesProtocol(2)}.165*/166167gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_proxy_mechanism_oid_desc =168{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")};169170gss_OID_desc GSSAPI_LIB_VARIABLE __gss_iakerb_min_msg_mechanism_oid_desc =171{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") };172173/*174* Context for krb5 calls.175*/176177#if 0178static gss_mo_desc krb5_mo[] = {179{180GSS_C_MA_SASL_MECH_NAME,181GSS_MO_MA,182"SASL mech name",183rk_UNCONST("GS2-KRB5"),184_gss_mo_get_ctx_as_string,185NULL186},187{188GSS_C_MA_MECH_NAME,189GSS_MO_MA,190"Mechanism name",191rk_UNCONST("KRB5"),192_gss_mo_get_ctx_as_string,193NULL194},195{196GSS_C_MA_MECH_DESCRIPTION,197GSS_MO_MA,198"Mechanism description",199rk_UNCONST("Heimdal Kerberos 5 mech"),200_gss_mo_get_ctx_as_string,201NULL202},203{204GSS_C_MA_MECH_CONCRETE,205GSS_MO_MA206},207{208GSS_C_MA_ITOK_FRAMED,209GSS_MO_MA210},211{212GSS_C_MA_AUTH_INIT,213GSS_MO_MA214},215{216GSS_C_MA_AUTH_TARG,217GSS_MO_MA218},219{220GSS_C_MA_AUTH_INIT_ANON,221GSS_MO_MA222},223{224GSS_C_MA_DELEG_CRED,225GSS_MO_MA226},227{228GSS_C_MA_INTEG_PROT,229GSS_MO_MA230},231{232GSS_C_MA_CONF_PROT,233GSS_MO_MA234},235{236GSS_C_MA_MIC,237GSS_MO_MA238},239{240GSS_C_MA_WRAP,241GSS_MO_MA242},243{244GSS_C_MA_PROT_READY,245GSS_MO_MA246},247{248GSS_C_MA_REPLAY_DET,249GSS_MO_MA250},251{252GSS_C_MA_OOS_DET,253GSS_MO_MA254},255{256GSS_C_MA_CBINDINGS,257GSS_MO_MA258},259{260GSS_C_MA_PFS,261GSS_MO_MA262},263{264GSS_C_MA_CTX_TRANS,265GSS_MO_MA266}267};268#endif269270/*271*272*/273274static gssapi_mech_interface_desc krb5_mech = {275GMI_VERSION,276"kerberos 5",277{9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") },2780,279_gsskrb5_acquire_cred,280_gsskrb5_release_cred,281_gsskrb5_init_sec_context,282_gsskrb5_accept_sec_context,283_gsskrb5_process_context_token,284_gsskrb5_delete_sec_context,285_gsskrb5_context_time,286_gsskrb5_get_mic,287_gsskrb5_verify_mic,288_gsskrb5_wrap,289_gsskrb5_unwrap,290_gsskrb5_display_status,291_gsskrb5_indicate_mechs,292_gsskrb5_compare_name,293_gsskrb5_display_name,294_gsskrb5_import_name,295_gsskrb5_export_name,296_gsskrb5_release_name,297_gsskrb5_inquire_cred,298_gsskrb5_inquire_context,299_gsskrb5_wrap_size_limit,300_gsskrb5_add_cred,301_gsskrb5_inquire_cred_by_mech,302_gsskrb5_export_sec_context,303_gsskrb5_import_sec_context,304_gsskrb5_inquire_names_for_mech,305_gsskrb5_inquire_mechs_for_name,306_gsskrb5_canonicalize_name,307_gsskrb5_duplicate_name,308_gsskrb5_inquire_sec_context_by_oid,309_gsskrb5_inquire_cred_by_oid,310_gsskrb5_set_sec_context_option,311_gsskrb5_set_cred_option,312_gsskrb5_pseudo_random,313#if 0314_gk_wrap_iov,315_gk_unwrap_iov,316_gk_wrap_iov_length,317#else318NULL,319NULL,320NULL,321#endif322_gsskrb5_store_cred,323_gsskrb5_export_cred,324_gsskrb5_import_cred,325_gsskrb5_acquire_cred_ext,326NULL,327NULL,328NULL,329NULL,330NULL,331NULL,332#if 0333krb5_mo,334sizeof(krb5_mo) / sizeof(krb5_mo[0]),335#else336NULL,3370,338#endif339_gsskrb5_pname_to_uid,340_gsskrb5_authorize_localname,341NULL,342NULL,343NULL,344NULL,345NULL,346NULL,347NULL348};349350gssapi_mech_interface351__gss_krb5_initialize(void)352{353return &krb5_mech;354}355356357